AdaskoTheBeAsT / WkHtmlToX

C# wrapper for wkhtmltopdf.org Html to Pdf library
MIT License
4 stars 4 forks source link

Generated pdfs are corrupted after first request #2

Closed revocengiz closed 3 years ago

revocengiz commented 3 years ago

Hi, first of all thank you for putting effort to make this project. When I try sample project WebApiCore The pdf generated from first request is looking as expected but in the flowing requests every things gets kind the text only Here is sample html you provide. Look at the how paragraph getting inline. image

When try complex html it getting worse, here is the sample image

Do you have any suggestions why this is happening after first request. Thanks in advance.

Sample html I use

complexpdf.zip

AdaskoTheBeAsT commented 3 years ago

I will try to investigate that issue - thanks for sample html it will be easier to reproduce

AdaskoTheBeAsT commented 3 years ago

Hi,

I am still working on this. It seems that conversion can be done only in thread which initialized lib. Tricky part is that in web apps there is a need to create separate conversion thread and unfortunately use singleton. Anyway I will change internals significantly for this and provide proper tests

AdaskoTheBeAsT commented 3 years ago

Hi @revocengiz

I have done that - it required lots of rework as it seems lib can be loaded only once and initialized in its working thread. Soon v5.0.0 should be in nuget - there is api breaking change - please take a look at readme and samples

revocengiz commented 3 years ago

Awesome, I did test same sample and it's working as expected now. I appreciate for your work. Thank you. :) I'll prepare same benchmark test and share with you.

AdaskoTheBeAsT commented 3 years ago

Cool - happy to help :) yes please share benchmarks - I am very interested in that. I will close that issue.