Support » Plugins » WP2PDF doesn’t redirect to generated PDF

  • Resolved wahgnube

    (@wahgnube)


    Hello all. I’ve just set up WP2PDF on my journal:
    http://actuality.wahgnube.org/

    Apart from a few minor glitches (not being able to read — and so on), it generates the PDF files properly. I have tried to set it up so that, near the post permalink, there is an option to download a PDF of the post (That little icon of a file.)

    I’ve chosen the option to save files on webserver, then relocate in the configuration for WP2PDF, but the web browser doesn’t seem to relocate to the generated file. I just see a blank screen instead.

    I would like to auto-redirect the browser to this generated file. Is there something else I should be doing? Please try it out and let me know. Thanks in advance.

Viewing 1 replies (of 1 total)
  • I have fixed my issues. Here are the changes to get the link to download the generated PDF, in case someone else is interested. The only changes are in the wee end of wp2pdf.php. The code is taken from php.net’s description of the header() function.

    Assuming you’ve set behaviour to save, make the following changes to wp2pdf.php.

    […snip…]
    if ($behaviour=="save") {
    $pdf->Output($pdffilename.'.pdf');
    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Pragma: public");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Some date in the past
    header('Content-type: application/pdf');
    header('Content-Disposition: attachment; filename="actualitydotlog.pdf"');
    readfile('actualitydotlog.pdf');
    echo ('It's broken. Meh. For now, you can fetch it from <a href="'.$root_url.'/'.$pdffilename.'.pdf'.'">here</a>.');
    } else {
    $pdf->Output($pdffilename.'.pdf',I);

    […snip…]

    See it functioning at my weblog!

Viewing 1 replies (of 1 total)
  • The topic ‘WP2PDF doesn’t redirect to generated PDF’ is closed to new replies.