WordPress.org

Ready to get started?Download WordPress

Forums

Working PDF support! (18 posts)

  1. wahgnube
    Member
    Posted 7 years ago #

    One of the most-frequently asked questions on my journal is how I have PDF support working "so seamlessly."

    I use a plug-in called WP2PDF.

    Unfortunately, WP2PDF, often misbehaves and is non-trivial to install and configure. The following tutorial details some of the things I have done--including changes to its code--to make it work.

    Now you can have PDF support for your web log too!

  2. Pizdin Dim
    Member
    Posted 7 years ago #

    "Now you can have PDF support for your web log too!"

    Why would anyone want that? Offering a PDF version of a blog entry seems pointless when all you've got to do is fix your stylesheet to exclude those elements (forms, links, etc) which are useless on paper.

    I don't doubt the effort you've made to get it to work, it just seems like a feature not worth spending time on.

  3. wahgnube
    Member
    Posted 7 years ago #

    You're right.

    I feel like an idiot.

  4. Pizdin Dim
    Member
    Posted 7 years ago #

    It was not my intent to belittle you. I'm sure you're learnt some valuable things from the exercise, just put it down to (valuable) experience.

    I would suggest you eperiment with a "print" stylesheet. Perhaps this article might be a good starting point.

    If you implement it nicely, your users have to do nothing apart from simply print the page.

  5. drmike
    Member
    Posted 7 years ago #

    Actually the request comes up from time to time in wp.com land.

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Creating a print stylesheet is extremely easy to do if you use Firefox with the Web Developer extension. Just load your page, hit CTRL-SHIFT-E to edit the CSS. This will let you edit the CSS and see the changes in real time. Then edit it until it looks like something worth printing and copy your stylesheet into print.css as described in the article above. Neat, huh?

    PDF support is nifty, but if all it's doing is generating a printable version of the post, then it seems like overkill to me. Still cool, nevertheless. Works better with images, I'm sure.

  7. wahgnube
    Member
    Posted 7 years ago #

    pizdin_dim: No offence taken. I just feel like an idiot for not realising I could just tweak the CSS. I came at it from the perspective of "fetching a post (or posts) in a convenient form to read later."

    I used to feature really long posts on my journal, and it seemed like a cool idea at the time.

  8. wahgnube
    Member
    Posted 7 years ago #

    As drmike pointed out, I only posted the instructions because people keep asking me how I got it to work.

    What pushed me over the top was a couple of these people offered me money to instruct them (perhaps they really value their time, or something), and I decided to free information I believed ought to be free.

  9. wahgnube
    Member
    Posted 7 years ago #

    Otto42: Thanks for the tip Otto, I will try it out soon.

    I'm slightly old-school in that I type my pages/stylesheets out in Emacs, refreshing my browser from time to time.

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Oh, no, I use vi for text editing. You can't out old-school me! :)

    But the functionality in that extension makes it *really* easy to see changes and to find what the information about the DIVs you want to eliminate are. It's well worth the trouble.

  11. wahgnube
    Member
    Posted 7 years ago #

    So we know where our allegiances lie, I am not a fan of vi.

    (There, I said it!)

  12. snowcrash
    Member
    Posted 7 years ago #

    Hi Wahgnube

    Will try your pluguin - I actually think is it useful plugin, esp as some people may want to save a post as a pdf file.

    cheers

  13. snowcrash
    Member
    Posted 7 years ago #

    Hello Wahgnube

    In your instructions on http://emphaticallystatic.org/taming-pdf-support/ it says edit wp-includes/template-functions-links.php though this file does not exist for WP2.13? Is there another file to edit?

    thanks

  14. wahgnube
    Member
    Posted 7 years ago #

    (Glad you caught that. I have been "upgrading" WordPress since even before it was WordPress. My file structure is most messed up.)

    I just downloaded a fresh copy of 2.2 to check it out. Try adding the WP2PDF code to wp-includes/link-template.php instead.

  15. snowcrash
    Member
    Posted 7 years ago #

    Hi

    I figured that out eventually.

    Though getting errors on WP2.13 - seems to be conflicting with some plugins on my home test site? For example,

    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp-content\plugins\dd-formmailer\dd-formmailer.php on line 18

    Also, for http://localhost/wp213/wp2pdf/wp2pdf.php
    I get:

    Warning: fopen(../pdf/actualitydotlog-20070527-115521.pdf) [function.fopen]: failed to open stream: No such file or directory in C:\xampp\htdocs\wp213\wp2pdf\fpdf.php on line 1300
    FPDF error: Unable to create output file: ../pdf/actualitydotlog-20070527-115521.pdf
  16. wahgnube
    Member
    Posted 7 years ago #

    1. I am unsure what the problem with this formmailer plug-in is, but you could try disabling it while testing the pdf plug-in. Sort out problems with running them both together after first getting them to work individually.
    2. Try to create a folder pdf in the same level as you have the wp2pdf folder, and make sure it is writable.
  17. snowcrash
    Member
    Posted 7 years ago #

    Hi

    I'm not having any luck. I've got quite a few plugins running and many seem to be in conflict. Deleted some of them, but hasn't solved it yet. It may be something to do with the order of plugin activation.

    Also, can't login in now, get:

    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp-login.php on line 12
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp-includes\pluggable.php on line 313
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp-includes\pluggable.php on line 314
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp-includes\pluggable.php on line 275

    I created the folder pdf, and a pdf file does get created in it, but incomplete and also still get errors for http://localhost/wp213/wp2pdf/wp2pdf.php:

    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp2pdf\wp2pdf.php on line 519
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp2pdf\wp2pdf.php on line 520
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp2pdf\wp2pdf.php on line 522
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp2pdf\wp2pdf.php on line 523
    
    Warning: filesize() [function.filesize]: stat failed for '../pdf/' . actualitydotlog-20070528-014147.pdf in C:\xampp\htdocs\wp213\wp2pdf\wp2pdf.php on line 524
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp2pdf\wp2pdf.php on line 524
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp2pdf\wp2pdf.php on line 526
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp2pdf\wp2pdf.php on line 527
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp213\wp-includes\link-template.php:526) in C:\xampp\htdocs\wp213\wp2pdf\wp2pdf.php on line 528
    
    Warning: readfile(actualitydotlog-20070528-014147.pdf) [function.readfile]: failed to open stream: No such file or directory in C:\xampp\htdocs\wp213\wp2pdf\wp2pdf.php on line 532

    I'll probably have to start from scratch and get rid of all the plugins as you suggest. Will feedback

    thanks

  18. wahgnube
    Member
    Posted 7 years ago #

    I googled a bit and here is what I found. (See the last question.)

    Try removing whitespace after the ?> at the end of each of these files. Your warning/error messages tell you which are the offending lines.

    Another similar tip.

Topic Closed

This topic has been closed to new replies.

About this Topic