PDF corrupted

Stimulsoft Reports.NET discussion
Post Reply
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

PDF corrupted

Post by Fabio Pagano »

Good evening.

Sometimes we find some exported pdf corrupted. Attached is a sample of a corrupted pdf.

If we check the PDF using the tool at https://www.pdf-online.com/osa/repair.aspx, the result is:

---
The file is corrupt and cannot be repaired, but possibly recovered
Errors:

Open file.
Analyze Objects.
0x80410308 - E - The "endobj" keyword is missing.
- Object No.: 2
- File: File_Not_Correctly_Opened.pdf
0x80410308 - E - The "endobj" keyword is missing.
- Object No.: 2
- File: File_Not_Correctly_Opened.pdf
Analyze Outlines.
Analyze Pages.
0x80410113 - E - The file is corrupt and cannot be repaired. Some of the contents can possibly be recovered.
- Page No.: 1
- File: File_Not_Correctly_Opened.pdf
Close file.
3-Heights(TM) PDF repair tool, evaluation license valid until unbounded
--

The export settings are:

Code: Select all

Dim PdfExportSettings As New Stimulsoft.Report.Export.StiPdfExportSettings
PdfExportSettings.PdfACompliance = True
The Stimulreport version is 2015.2.0.0.

May you kindly help me?

Thank you.
Attachments
File_Not_Correctly_Opened.pdf
(159.6 KiB) Downloaded 494 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: PDF corrupted

Post by Alex K. »

Hello,

Why do you think that it is corrupted? Only on the basis of the test? The file opens in Acrobat Reader DC. Is there a problem on any file, or on a specific file?
Also, please send the mdc-file of this report in order to test the export.

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Re: PDF corrupted

Post by Fabio Pagano »

Good morning.

We use the product "ceTe DynamicPDF Merger" to merge pdfs saved from StimulReport.
The following merge code gave us error:

Code: Select all

Dim b() = System.IO.File.ReadAllBytes("c:\file_not_correctyl_opened.pdf")
Dim SingleDocument As ceTe.DynamicPDF.Merger.PdfDocument = New ceTe.DynamicPDF.Merger.PdfDocument(b)
The second statement gave error "There was an error while parsing the input PDF file".

At first we though for a problem in the ceTe software, but then we analyzed the PDF file with the online tool https://www.pdf-online.com/osa/validate.aspx and found it corrupted (see first post). Other PDF files created by StimulReport are not reported as corrupted and ceTe software loads them correctly. i have few other cases of exported PDF corrupted, say about 0,01%.

As far as I know, the Adobe PDF reader implements a self-repair during opening, that's the reason why the document is shown in the reader. I also found a post of ceTe where they talked about this self-repairing of Adobe pdf reader, stating that in their pdf merger software they didn't implement any autocorrection (sorry I couldn't have been able to find that post again).

I've attached the zipped mdz file from whom the pdf is generated. I've generated the pdf (attached to the first post) from the report preview, using the "Save" button, with the default pdf options that you can see in the attached screenshot "PDFExportSettings-png.png".

The error found by the online control tool (see first post) is:
--
The "endobj" keyword is missing.
--

Thank you.
Attachments
PDF Export settings
PDF Export settings
PDFExportSettings-png.png (7.74 KiB) Viewed 4278 times
S000000001.zip
Report that generates the exported pdf
(426.92 KiB) Downloaded 216 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: PDF corrupted

Post by Alex K. »

Hello,

The problem is solved.
The patch will be available in the next prerelease build.

For your version you can use the following workaround:
The problem occurs some symbols in the ReportAlias, in particular, the bracket characters. Please try to remove it from ReportAlias.

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Re: PDF corrupted

Post by Fabio Pagano »

Good evening.

Thank you for the answer.

I also confirm that the workaround solves the problem.

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: PDF corrupted

Post by Alex K. »

Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.
Post Reply