HTML to PDF using chromium

604 views
Skip to first unread message

Viswa Prakash

unread,
Jun 26, 2018, 2:43:29 AM6/26/18
to Chromium-dev
Hi Everyone,

I need to convert HTML to PDF using chromium, I have built the source in my local windows machine. My aim is to create a C++ wrapper for converting HTML to PDF using the chromium source build in my machine. can anyone provide instructions and suggestions here? 

Chromium source build directory also very large size, and it takes very long time to complete a single build. Is there any option to build the source only for HTML to PDF conversion module. 


Thanks,
Prakash V

Viswa Prakash

unread,
Jun 26, 2018, 2:46:34 AM6/26/18
to Chromium-dev
I do not want to use chrome pre-build assemblies, I'm aware about print-to-pdf in headless app. But I do not want to headless shell. I need to provide options for conversion from C++ program and convert it to pdf in C++ project. 

PhistucK

unread,
Jun 26, 2018, 2:49:15 AM6/26/18
to prakashvis...@gmail.com, Chromium-dev
Headless also has C++ bindings, which might help your case.

PhistucK


On Tue, Jun 26, 2018 at 9:46 AM Viswa Prakash <prakashvis...@gmail.com> wrote:
I do not want to use chrome pre-build assemblies, I'm aware about print-to-pdf in headless app. But I do not want to headless shell. I need to provide options for conversion from C++ program and convert it to pdf in C++ project. 

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/f8d9e77f-f84c-4279-be63-535a69d8785b%40chromium.org.

Lei Zhang

unread,
Jun 26, 2018, 3:05:18 AM6/26/18
to Viswa Prakash, Chromium-dev
Parsing and rendering web content is very complicated. Building a
stripped down version of headless_shell is probably as small as it
gets. The majority of the build time is probably spent building Blink,
which is required because that's the rendering engine.

You also said "I do not want to headless shell" but you need to
elaborate on what you want exactly.
> --
> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "Chromium-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/b0e1f2bb-1cac-47bd-8e74-d6c1c2c73186%40chromium.org.

Viswa Prakash

unread,
Jun 26, 2018, 8:33:24 AM6/26/18
to Chromium-dev, prakashvis...@gmail.com
Hi Lei Zhang,

headless shell internally launch the chrome process for converting html to pdf. I do not want to launch chrome process. Instead of this, it is possible to directly convert the HTML to PDF in C++. 

Lei Zhang

unread,
Jun 26, 2018, 4:06:13 PM6/26/18
to Viswa Prakash, Chromium-dev
If that is really what you want, then Chromium, with its multi-process
architecture, is probably not right for you. See
https://www.chromium.org/developers/design-documents/process-models

The closest you can get is with single process mode, but in my
experience, single process mode is often broken in weird ways.

On Tue, Jun 26, 2018 at 5:33 AM, Viswa Prakash
> https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/e95dea60-4c38-49a2-8be1-806b3e29d491%40chromium.org.

ol...@chromium.org

unread,
Jun 27, 2018, 3:32:04 PM6/27/18
to Chromium-dev, prakashvis...@gmail.com
Just a suggestion - https://wkhtmltopdf.org/ seems to do exactly what you want already, and is also open-source - it might be less work to use that instead of chromium.


On Tuesday, June 26, 2018 at 10:06:13 PM UTC+2, Lei Zhang wrote:
If that is really what you want, then Chromium, with its multi-process
architecture, is probably not right for you. See
https://www.chromium.org/developers/design-documents/process-models

The closest you can get is with single process mode, but in my
experience, single process mode is often broken in weird ways.

Reply all
Reply to author
Forward
0 new messages