|
Rank: Newbie Groups: Member
Joined: 9/5/2023 Posts: 2
|
Under pressure (we tested ~10 simultaneous reports at a time) it could randomly generate blank pages. It contains hidden text which you can select by mouse, but it's not visible in final PDF. As workaround: Global static lock for endpoint solves the problem. Like
Code: C#
private static object _lock = new object();
....
public async Task<...> GenerateReportEndpoint(...)
{
lock(_lock) {[size=3][/size][size=5][/size]
.........
string viewHtmlContent = ...;
var pdfDocument = new PdfDocument();
HtmlToPdf.ConvertHtml(viewHtmlContent, pdfDocument);
.......
}}
Possibility to generate only 1 report at a time that's not how it should work in production. -.Net Framework 4.8 -ASP.NET MVC Could we have it fixed, please ?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,206
|
Hi, Can you send a result HTML with the blank text to us so that we can take a look? You can use the contact us page to send us the PDF file: https://www.essentialobjects.com/contactThanks!
|
|
Rank: Newbie Groups: Member
Joined: 9/8/2023 Posts: 1
|
Hi Team, We shared our HTML result with the blank text, but haven't heard back yet. Please, let us know how the investigation going. We are currently monitoring the lock workaround solving the problem, but we certainly need to find a proper fix for it. It affects about 10% of pdf files generated at the moment under the heavy load.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,206
|
Hi,
We looked into the PDF file you sent to us. The issue has to do with the page header. The page header has a full page size white background and this white background is what blocked the main contents. In another word, the main contents are correctly generated, however they are subsequently covered by a full page white "cover" that is a part of your page header. So the issue is the page header, not the main contents. How do you generate the page header?
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 9/5/2023 Posts: 2
|
We apply header and footer in the code like that. In our multithreading tests it makes ~50-60% of broken pages for really the +- same html's.
var pdfDocument = new PdfDocument(); HtmlToPdf.ConvertHtml(viewHtmlContent, pdfDocument, options);
var pagesCount = pdfDocument.Pages.Count; for (var i = 0; i < pagesCount; i++) { options.OutputArea = new RectangleF(headerLeft, headerTop, headerWidth, headerHeight); HtmlToPdf.ConvertHtml(headerViewHtmlContent, pdfDocument.Pages[i], options);
options.OutputArea = new RectangleF(0, 11.2f, footerWidth, 1); HtmlToPdf.ConvertHtml(footerViewHtmlContent, pdfDocument.Pages[i], options); }
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,206
|
We are not aware that ConvertHtml will automatically render enlarged white background. So the problem is more likely in your html. Please try to replace it with fixed hardcoded html as a test. If that problem still occurs after that, please try to isolate the problem into a test project and send the test project to us. Once we have that we will be happy to look further.
|
|