[LRUG] PDF generation from HTML with complex JS
Stephen Bartholomew
steve at curve21.com
Wed Nov 2 09:25:38 PDT 2011
Yeah that's certainly what it looks like, but wkhtmltopdf uses webkit as a
headless browser - and you can tell it to wait before producing the html.
Using a browser does seem like the obvious option, but even printing
straight from safari for example doesn't correctly show the map. Feels
like a screenshot is the only way right now!
Steve
On Wed, Nov 2, 2011 at 4:16 PM, Derek Ekins <derek at spathi.com> wrote:
> I've not done this but I guess the key thing here is you need to execute
> the JS to get the final html.
> To do that you could use one of the headless browsers out there like
> htmlunit to load the page and then save the html it produces and pass that
> to your pdf generator.
>
> Like I said - haven't tried but it may do the trick!
>
> On 2 November 2011 16:08, Stephen Bartholomew <steve at curve21.com> wrote:
>
>> Hey all,
>>
>> On the subject of PDF generation, has anyone had success converting
>> JS-heavy pages to PDF?
>>
>> The page in question is an Open Layers based map with vector layers.
>> There's an example of the map here:
>> http://communities4renewables.co.uk/open/maps/5cdbb6b2-33ed-4e7f-ad59-a24327006711
>>
>> I've tried using wkhtmltopdf which somewhat works but renders different
>> layers inconsistantly depending on the configuration. I've tried timeouts
>> and all the advice I can find online. I know there are paid solutions like
>> prince etc but I'm reluctant to invest in that without an idea of the
>> success.
>>
>> Any help/experience would appreciated!
>>
>> Cheers,
>>
>> Steve
>>
>> --
>> Stephen Bartholomew
>>
>> Curve21
>>
>> www.curve21.com
>> 07729 60 60 79
>> steve at curve21.com
>>
>>
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org
>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>
>>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
--
Stephen Bartholomew
Curve21
www.curve21.com
07729 60 60 79
steve at curve21.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20111102/de1fdd39/attachment-0003.html>
More information about the Chat
mailing list