Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is a crucial question to many:

Searching the web, I have found several command line tools that allow you to convert a HTML-document to a PDF-document, however they all seem to use their own, and rather incomplete rendering engine, resulting in poor quality

How can you print the rendered output of a modern web-browser to pdf, (and/or svg) whilst retaining as much vector graphics as possible?

There is a solution called: webkit-pdf (which renders everything to bitmap graphics)

I am looking for options, alternatives, suggestions perhaps even a printer-driver or webservices?

Update: So far I found the following

Links:

Thanks

share|improve this question

closed as off-topic by m4573r, random May 8 at 22:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – m4573r, random
If this question can be reworded to fit the rules in the help center, please edit the question.

    
You may want PDFCreator (printer-driver). I just printed a HTML page with VML vector graph embedded from IE browser, a SVG graph from Firefox browser, PDFCreator retains these vector stuffs. –  LiuYan 刘研 Sep 26 '12 at 9:12
    
@LiuYan刘研 this should probably be an answer. please elaborate. The browsers restrict and reformat their printed output. there are some css-media tricks to include background images, but even then... –  Lo Sauer Sep 26 '12 at 13:30
add comment

2 Answers

Rendered output is, by definition, a bitmap image.

The vector objects from which that bitmap image was constructed are not accessible from that rendered image.

You would have to return to the original HTML and CSS (etc) and use that original material to produce a new vector-based representation using a new parallel implementation of the layout algorithms that were used to produce the bitmap.


Chrome's "Print as PDF" function seems to preserve the vector nature of fonts and some other parts of the final image - you can zoom in indefinitely, as shown below, without the obvious pixellation you get from bitmap images in PDFs.

enter image description here

share|improve this answer
    
Internal browser print functions are not what I am looking for. For rendering see ( en.wikipedia.org/wiki/Render ). Web browser engine: software that takes information and displays the formatted content on the screen –  Lo Sauer Sep 26 '12 at 9:10
    
@Lo: It may help if you edit your question to specify which "options, alternatives and suggestions" you have already ruled out (reasons might also be useful to potential answerers) –  RedGrittyBrick Sep 26 '12 at 9:16
    
"How can you print the rendered output of a modern web-browser to pdf" ? Change the way your question is worded if this is not the answer you require. –  HaydnWVN Sep 26 '12 at 9:16
    
@HaydnWVN, RedGrittyBrick please see fit to edit however you would like to improve the question and content. Feel free to make this into a community wiki. –  Lo Sauer Sep 26 '12 at 13:33
    
I see no benefit to wiki'ing this. It's your question for your problem. How do we know what you're trying to achieve? RedGrittyBrick already answered your original question! –  HaydnWVN Sep 26 '12 at 14:15
add comment

You may want PDFCreator (printer-driver), it's an open source project hosted at sourceforge.net.

I just printed a HTML page with VML (MSDN) vector graph embedded from IE browser, a SVG graph from Firefox browser, to PDFCreator, and PDFCreator retains these vector data.

If you don't care about the difference of rendered results between screen and printer device (as you mentioned in comment about the media attribute of style tag), then PDFCreator is an answer.


Samples

Original rendered output of browser to screen device (SVG logo displayed in Firefox 15.0.1)

SVG graph displayed in Firefox

Print to PDFCreator printer (rendered to printer device)

View PDF in zoom level 100%

PDF zoom 100%

View PDF in zoom level 150% (lossless zoom)

PDF zoom 150%


More samples based on VML vector graph

yes, it's just rotated text, but it IS VML vector graph

HTML code of the VML vector graph

<html xmlns:v='urn:schemas-microsoft-com:vml'>
    <head>
        <style>v\: * { behavior:url(#default#VML); display:inline-block }</style>
    </head>

    <body>
        <v:line from="0,100" to="200,0" style="float:left">
            <v:path textpathok="True"/>
            <v:textpath on="True" string="SuperUser.com"/>
        </v:line>
        <h1>Q479701</h1>
        <p>
            PDFCreator retains vector graph
        </p>
    </body>
</html>
share|improve this answer
    
this is great. The problem then is how to print a complete website as is? (without applying those crippling printer-stylesheets or whatever the browser do...). Is this possible in the IE? –  Lo Sauer Sep 28 '12 at 5:46
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.