0

I am looping the below shortened Code for more than 1000 Employees. Process gets very slow due to the Last line in below Code. It is taking more time to generate a single PDF for each Employee.

string headerContents = "<div style='font-family:Times-roman;padding: 0px 0px 0px 1px;'>";
headerContents += headDesign;
headerContents += "</div><br/><br/><br/><br/>";
StringReader sr = new StringReader(headerContents);

XMLWorkerHelper.GetInstance().ParseXHtml(writer, document, sr);

I searched it but didn't get any specific solution for the Slowness. Please can anyone share some Solution.

Anup
  • 9,396
  • 16
  • 74
  • 138
  • Is it an option to build a native PDF table instead of parsing HTML? https://www.mikesdotnetting.com/article/86/itextsharp-introducing-tables or perhaps speed it up by disabling the font lookup https://stackoverflow.com/a/26220259/169714 – JP Hellemons Dec 19 '18 at 09:06
  • And how large is the html in `headDesign`? Could you provide the full string? – JP Hellemons Dec 20 '18 at 08:55

1 Answers1

-1

you also can use html agility pack to parse html file,html text,any website etc.

//for html file
var doc = new HtmlDocument();
doc.LoadHtml(html);

var web = new HtmlWeb();
var doc = web.Load("url");
vijay joshi
  • 38
  • 1
  • 10
  • HTML agility pack is nice indeed. However it's not suitable for this case. It's not the parsing, it's the parsing of HTML into a PDF. – JP Hellemons Dec 19 '18 at 09:09
  • hmmm, we also can use aspose pdf to convert html to pdf . – vijay joshi Dec 20 '18 at 08:40
  • i think below link is help to resolve it .. https://html-agility-pack.net/knowledge-base/35594030/how-can-i-use-itext-to-convert-html-with-images-and-hyperlinks-to-pdf- – vijay joshi Dec 20 '18 at 08:41