Rank: Member Groups: Member
Joined: 9/23/2019 Posts: 19
|
After we upgraded from version 23.4.26 to version 25.0.99 we got tons of exceptions on production related to document generation. Our costumers are unable to generate documents any longer. This is the stack trace we got (same error every time).
Exception in rendering PDF (file attached). Exception Message: Property 'Pages' can not be empty.. Inner . Stack at EO.Internal.xvvu.abiu[a](String deb, Boolean dec) at EO.Internal.xvnw..ctor(PdfDocument ala, xvvu alb) at EO.Pdf.PdfDocument..ctor(xvvh agp, Boolean agq) at EO.Pdf.PdfDocument..ctor(Stream stream)
System.Exception: at EO.Internal.xvvu.abiu (EO.Pdf, Version=25.0.99.0, Culture=neutral, PublicKeyToken=e92353a6bf73fffc) at EO.Internal.xvnw..ctor (EO.Pdf, Version=25.0.99.0, Culture=neutral, PublicKeyToken=e92353a6bf73fffc) at EO.Pdf.PdfDocument..ctor (EO.Pdf, Version=25.0.99.0, Culture=neutral, PublicKeyToken=e92353a6bf73fffc) at EO.Pdf.PdfDocument..ctor (EO.Pdf, Version=25.0.99.0, Culture=neutral, PublicKeyToken=e92353a6bf73fffc)
Could not reproduce this error locally or on our test environment so I can not provide you with any documents. Code looks something like this:
foreach (var document in parameters.Documents) { documentHelper = document; parameters.Request.PageHeaders.TryGetValue(document.DocumentType, out var pageHeader);
PdfDocument pdf = new PdfDocument(); pdf = this.RenderPdfDocument(document, pageHeader, parameters.Request.Info); }
private PdfDocument RenderPdfDocument(DocumentInfo document, PageHeaderOptions pageHeader, PdfInfo pdfInfo) { PdfDocument pdf; var subHeaderCount = 0; var leftAlignedHeaders = pageHeader?.SubHeaders?.Where(x => x.AlignLeft); var rightAlignedHeaders = pageHeader?.SubHeaders?.Where(x => !x.AlignLeft);
subHeaderCount = leftAlignedHeaders?.Count() > rightAlignedHeaders?.Count() ? leftAlignedHeaders?.Count() ?? 0 : rightAlignedHeaders?.Count() ?? 0;
if (document.AttachmentType == AttachmentType.Pdf) { pdf = new PdfDocument(document.Stream); ////on this line it throws exception ResizePdfPages(pdf, document, subHeaderCount, isCon); } else { throw new NotImplementedException("Unknown binder element."); }
SetDocumentInfo(pdf, document.Metadata?.Title, pdfInfo);
void ResizePdfPages(PdfDocument pdfDocument, DocumentInfo docInfo, int subHeaderCount, bool isCon) { var margin = new AcmPadding( 0, PageSizes.TopMargin + PageSizes.DetermineHeaderHeight(subHeaderCount, isCon), 0, PageSizes.BottomMargin);
foreach (var page in pdfDocument.Pages) { if (docInfo.Metadata?.Resize ?? true) { this.PageResizer.ResizeA4(page, margin); } } }
return pdf; }
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,296
|
Hi, Where do you get document.Stream object? If you load it from a file, can you send us the file? Once we have the contents of the file, we can debug into it and see what we can find. See here for more information on sending us files: https://www.essentialobjects.com/forum/test_project.aspxThanks!
|
Rank: Member Groups: Member
Joined: 9/23/2019 Posts: 19
|
Do not have since we can not reproduce the issue on our machines.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,296
|
You will have to try to reproduce it first. There is no way for us to tell you what went wrong unless we can reproduce it in our envirnment and see exactly what went wrong. The only thing we can tell you is the contents of the stream object is wrong. Our code is looking for a "Pages" collection which should exists in every valid PDF file but it doesn't exist in your stream.
|
Rank: Member Groups: Member
Joined: 9/23/2019 Posts: 19
|
Why does it work with version 23.4.26 then? Maybe some changelogs related to this area could help us solve the mystery.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,296
|
You can't troubleshoot that way. Our product is based on Chromium browser engine and there are multiple million lines of code changes between these two versions. Assuming the problem is triggered by one of these million lines of code changes, it is not possible for us to guess on which one of these changes triggered the problem. Even if we try, we won't be able to cover all the possiblities before the world ends.
You will need to back trace from the point of failure until you can find the root of the problem. We know the contents of the stream is wrong. The next step would be to find out:
1. How is it wrong? If the content comes from a file, you can send us the file. If you don't have such a file, you can save the contents of the stream into a physical file and send the file to us. 2. Where did it go wrong? You will need to look into your code and trace backwards on where this stream object comes from and then back trace step by step until you find the root of the problem.
|