Why do I, as a developer, have to go through so much trouble developing PDF download options for my clients when everyone in the world can simply hit Ctrl+P and life is good?

The current issue I'm working on is dealing with Google Charts, so I'm not stating that offering PDF downloads in general is relatively difficult. On the contrary, particular cases are more trouble than they seem to be worth.

See also: @media print {}

Update: With a little research, I was able to find a perfectly workable solution. "Just hit Ctrl+P" now sounds like a ridiculous thing to say. Thanks everyone for your input.

If you're interested to know what I decided to do, I realized that Google Charts are output as SVG markup and I think I should be able to use TCPDF to render them in a PDF document.

A. As a customer I don't want to wreck the environment or my personal officespace managing prints "of everything". B. PDF allows fine grain control over the print output. HTML does not. C. I don't understand how "write less do more" applies in this case.
–
P.Brian.MackeyJan 21 '13 at 20:33

1

I concede what I initially proposed was "write less" and "do less." I appreciate you tactfully calling me out on that.
–
Micah - ps I love youJan 21 '13 at 20:47

1

When you do implement a server-side generated PDF, please put some thought into what the generated file name will be. I have a bank that strongly encourages me to retrieve monthly statements and other reports from their web site as PDF. However, every document is named simply "statement.pdf" and it falls on the user to change that name when saving the file. This gets tedious for the site user.
–
RBerteigJan 22 '13 at 1:19

3 Answers
3

You dont 'have to' do anything. But if you want to ensure the PDF looks exactly the same for each person who downloads it, you need to render it yourself. Otherwise you're depending on various web browsers & print engines to render the PDF, and the results may not be that great.

And of course, you also cant assume that every device that might access the document is capable of printing or creating a pdf.

Great arguments. I definitely concede on the "every device might not be capable of printing or creating a PDF" argument.
–
Micah - ps I love youJan 21 '13 at 19:04

2

I've had to do this because we wanted both custom headers and footers on printed pages, and to support IE 7+. Using pdfs was way easier and more reliable than hacking together cross-browser support.
–
TacroyJan 21 '13 at 19:29

2

plus most websites have a TON of crap that doesn't need to be on a printout, a printer friendly version should at least be provided
–
ratchet freakJan 21 '13 at 20:03

1

@ratchetfreak - while I'm on the side of PDF in this discussion, proper use of CSS styles and media selectors will remove the "TON of crap" that is unnecessary for printing
–
HorusKolJan 22 '13 at 4:23

Web pages are not designed for print, they are designed to be rendered on a screen. As such, there's no guarantee that it will even fit within the dimensions of a standard paper size. Printing web pages to paper when they are not designed to fit on paper usually results in a mess. Giving your web application the ability to render important pages that a user might want a hard-copy of (such as receipts of banking transactions, or tickets to events) as printer-friendly PDF makes it much easier for people to produce those hard copies.

+1 because I think your answer states the rationale for server side rendering much better than mine.
–
GrandmasterBJan 21 '13 at 19:04

Is this an argument against the usefulness of @media print {}? Granted, I have limited experience with this CSS property.
–
Micah - ps I love youJan 21 '13 at 19:09

1

@MicahDelaneBolen: I've never used @media print{}. When I've needed to produce printable data, I've always done it via PDF. Granted, PDF assumes that the client will have PDF reader installed, but based on what I've seen, this has been a de-facto standard since the mid 1990's. Another option that doesn't even require a PDF reader would be pre-formatted text (using <pre/>) that has been tested to fit on a standard letter-sized page, but that is probably only an option where the output is simple text.
–
FrustratedWithFormsDesignerJan 21 '13 at 19:16

1

@MicahDelaneBolen, @media print{} would be a good idea if it were ever used, and if its users had ever bothered to test it by actually printing even the most rudimentary test pages. It has the potential to be the right answer. In practice, I don't think I have ever come across a site where the print experience (even those with a printer-friendly mode) just worked and did a good job. At least with a generated PDF, I know that someone had to think about layout from a page-by=page point of view.
–
RBerteigJan 22 '13 at 1:16

In addition to the other answers, there is the fact that a great many people can't just hit ctrl-p -- for instance, I'm typing this on an iPad and do not have a printer that I can use from it. But I can save a pdf in GoodReader or DropBox and later transfer it to a computer with a printer.

In addition, the user may not want a hard copy so much as a permanent record -- if I save something as a pdf, I can name it and store it where I can find it later (even without internet access). If I rely upon you as the company to keep track of it for me, then I'm in trouble when you keep it for X months and I need it X+1 months later (just had this exact problem with a copy of a check, kept online for 120 days, needed it after that. Fortunately, I FIRST needed it within the limit so I made a copy).