Using WebKit renderer to produce PDF output
Hi, I need to produce a tool that can generate PDFs from HTML. The best solution I can think of is to use WebKit's layout engine, and plug my own PDF generator in as a renderer backend. I don't want to reinvent the wheel though - so I'm asking here has this been done already, or are there other obvious solution out there that I'm missing? Any thoughts or suggestions appreciated. Thanks, Ben
On May 13, 2009, at 2:11 PM, Ben Harper wrote:
I need to produce a tool that can generate PDFs from HTML. The best solution I can think of is to use WebKit's layout engine, and plug my own PDF generator in as a renderer backend. I don't want to reinvent the wheel though - so I'm asking here has this been done already, or are there other obvious solution out there that I'm missing?
It depends what platform you’re talking about. The Mac OS X version of WebKit already offers this capability, since printing on Mac OS X is based on PDF. The PDFOperationWithView method of NSPrintOperation can work for this purpose. -- Darin
Unfortunately the platform is Windows. Regarding the method that you're describing - I assume the PDF generation is handled by CoreGraphics? Ben On Wed, May 13, 2009 at 11:17 PM, Darin Adler <darin@apple.com> wrote:
On May 13, 2009, at 2:11 PM, Ben Harper wrote:
I need to produce a tool that can generate PDFs from HTML. The best solution I can think of is to use WebKit's layout engine, and plug my own PDF generator in as a renderer backend. I don't want to reinvent the wheel though - so I'm asking here has this been done already, or are there other obvious solution out there that I'm missing?
It depends what platform you’re talking about. The Mac OS X version of WebKit already offers this capability, since printing on Mac OS X is based on PDF. The PDFOperationWithView method of NSPrintOperation can work for this purpose.
-- Darin
Hi Ben,
I need to produce a tool that can generate PDFs from HTML. The best solution I can think of is to use WebKit's layout engine, and plug my own PDF generator in as a renderer backend.
On both, Windows or Linux, you could try using Cairo's PDF backend for your purpose [1], i.e. create a modified cairo-based GraphicsContext that outputs to PDF. Regards, Dominik [1] http://cairographics.org/manual/cairo-pdf-surface.html
-----Original Message----- From: webkit-dev-bounces@lists.webkit.org [mailto:webkit-dev-bounces@lists.webkit.org] On Behalf Of Ben Harper Sent: Wednesday, May 13, 2009 11:42 PM To: Darin Adler Cc: webkit-dev@lists.webkit.org Subject: Re: [webkit-dev] Using WebKit renderer to produce PDF output
Unfortunately the platform is Windows. Regarding the method that you're describing - I assume the PDF generation is handled by CoreGraphics?
Ben
On Wed, May 13, 2009 at 11:17 PM, Darin Adler <darin@apple.com> wrote:
On May 13, 2009, at 2:11 PM, Ben Harper wrote:
I need to produce a tool that can generate PDFs from HTML. The best solution I can think of is to use WebKit's layout engine, and plug my own PDF generator in as a renderer backend. I don't want to reinvent the wheel though - so I'm asking here has this been done already, or are there other obvious solution out there that I'm missing?
It depends what platform you're talking about. The Mac OS X version of WebKit already offers this capability, since printing on Mac OS X is based on PDF. The PDFOperationWithView method of NSPrintOperation can work for this purpose.
-- Darin
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
________________________________________ Access Systems Germany GmbH Essener Strasse 5 | D-46047 Oberhausen HRB 13548 Amtsgericht Duisburg Geschaeftsfuehrer: Michel Piquemal, Tomonori Watanabe, Yusuke Kanda www.access-company.com CONFIDENTIALITY NOTICE This e-mail and any attachments hereto may contain information that is privileged or confidential, and is intended for use only by the individual or entity to which it is addressed. Any disclosure, copying or distribution of the information by anyone else is strictly prohibited. If you have received this document in error, please notify us promptly by responding to this e-mail. Thank you.
I need to produce a tool that can generate PDFs from HTML. The best solution I can think of is to use WebKit's layout engine, and plug my own PDF generator in as a renderer backend. I don't want to reinvent the wheel though - so I'm asking here has this been done already, or are there other obvious solution out there that I'm missing? Any thoughts or suggestions appreciated.
With QtWebKit, that is easy. Check this project for an example: http://code.google.com/p/wkhtmltopdf/ -- Ariya Hidayat, Software Engineer Qt Software, Nokia Devices R&D
participants (4)
-
Ariya Hidayat
-
Ben Harper
-
Darin Adler
-
Dominik Roettsches