4

Websupergoo abcpdf is very slow when generate large pdf from HTML or URL

 Doc theDoc = new Doc();
 theDoc.Page = theDoc.AddPage();
 int theID;
 theDoc.HtmlOptions.UseScript = false;
 theDoc.HtmlOptions.DoMarkup = false;
 theID = theDoc.AddImageHtml(html);
 while (true)
 {
    theDoc.FrameRect(); // add a black border
    if (!theDoc.Chainable(theID))
                break;
    theDoc.Page = theDoc.AddPage();
   theID = theDoc.AddImageToChain(theID);
  }

AddImageHtml is very slow, the pdf is 16 pages.

Any idea how can I improve the performance?

By the way I tried to Use 'AddImageUrl' but that is slow as well.

Note: I am using ABCpdf8.

Update: here is html sample to be converted to pdf

Thanks in advance

Rana
  • 1,170
  • 3
  • 14
  • 28

1 Answers1

1

From AbcPDF documentation

AddImageHtml Method ABCpdf saves this HTML into a temporary file and renders the file using a 'file://' protocol specifier. So this is a convenience method - it doesn't offer any performance enhancements.

Did you try "Paged" parameter?

theID = theDoc.AddImageUrl(html,true, 300, false);
or
theID = theDoc.AddImageHtml(html,true, 300, false);

Try with a simple HTML. If it's faster, maybe the web you're parsing it's too much complex.

Edit:

16 pages is not a large PDF for ABCPdf. I have tested your HTML. I have used v8 and v10 of ABCPDF. I have tested it on 2 machines: a W10 Machine and WIN XP... I have got the PDF almost inmediatly in both.

Abcpdf is using your enviroment, so you have to check your Internet Explorer version (try changing the .htmloptions.engine to Gecko), or maybe, the "production" HTML has a css on a unvalid URL, or a "enterprise filter" ....

Morcilla de Arroz
  • 2,104
  • 22
  • 29
  • tried that as well but didn't help, I believe it is about number of pages, because I tried to generate 16 pdf pages from small html (one div in each page) but that was slow as well . Thanks – Rana Dec 01 '16 at 15:51
  • could you tell the url you are trying to convert to pdf? – Morcilla de Arroz Dec 01 '16 at 16:19
  • I cannot give url but here is the html http://plnkr.co/edit/w5d1GFjGL4EVDdSTWyQB?p=info – Rana Dec 02 '16 at 08:32