Winnovative HTML to PDF converter

I'm trying to convert an aspx page to a PDF using the Winnovative HTML to PDF converter, but before the page is converted, I want some javascript to be run. I know the javascript works as I've tested the standalone aspx page without converting it to a PDF. However, when it is converted, it appears that the javascript hasn't been run. I have read the FAQs on the Winnovative website (http://www.winnovative-software.com/FAQ.aspx) and as a result I've added the following to my code to ensure javascript can be allowed to run:

pdfConverter.ScriptsEnabled = True
pdfConverter.InternetSecurityZone = InternetSecurityZone.LocalMachine

Adding this code still didn't work so I tried commenting out my main javascript and testing a very simple bit of javascript to see if that works. The javascript I tried was simply:

var item = $(".items")[0];
items.style.display = "none";

The element with a class of "items" surrounds everything on the page. When I generated the PDF again, all the contents had disappeared as expected. This means that javascript is running.

I then wondered if maybe the PDF is being generated before my javascript has had a chance to run so that's why the effects can't be seen. I found in the Winnovative website's FAQs that the PDF converter has a ConversionDelay property which can be used to specify an additional period of time in seconds to wait for asynchronous content to be loaded before starting PDF rendering. So I added the following:

pdfConverter.ConversionDelay = 30

Even after this delay, my javascript still does not run. Can anyone please offer any guidance? Thanks.

6
задан Curt 10 November 2011 в 11:33
поделиться