PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

PDF validation fail on PDF v1.7 (Object already in table)
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3788
Page 1 of 1

Author:  surensaluka [ Mon May 14, 2018 6:32 am ]
Post subject:  PDF validation fail on PDF v1.7 (Object already in table)

Hi,
I use PDFTRon for .NET to generate a PDF from Word documents. But when I send the generated document through PDFSharp component to validate the document it fails with the following error.

Exception message: Object already in table.
Stack trace: at PdfSharp.Pdf.Advanced.PdfCrossReferenceTable.Add(PdfReference iref)
at PdfSharp.Pdf.IO.Parser.ReadXRefStream(PdfCrossReferenceTable xrefTable)
at PdfSharp.Pdf.IO.Parser.ReadXRefTableAndTrailer(PdfCrossReferenceTable xrefTable)
at PdfSharp.Pdf.IO.Parser.ReadTrailer()
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider)
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode)
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, PdfDocumentOpenMode openmode)
at BoardAppUtil.Util.FileUtility.ValidatePDFRestrictedModification(Byte[] fileData) in D:\Projects\BoardPACWeb_TFS_Workspace\BoardApp\Web\BoardAppWeb\BoardAppUtil\Util\FileUtility.cs:line 260


Following line is used to open the PDFTron generated PDF to modify by the PDFSharp.
I need to add an additiona page to this document. I use PDFSharp for that.

PdfDocument inputDocument1 = PdfReader.Open(pdfStm, PdfDocumentOpenMode.Modify);

I can send the PDFTron generated document which fails the PDFSharp's "Open" function. (Please specify an email address)

Author:  Thomas Hoevel [ Mon May 14, 2018 9:33 am ]
Post subject:  Re: PDF validation fail on PDF v1.7 (Object already in table

Hi!

This is the result from QPDF:
Code:
D:>qpdf --check "PDFTron converted file.pdf"
checking PDFTron converted file.pdf
PDF Version: 1.7
File is not encrypted
File is linearized
ERROR: linearized file contains an uncompressed object after a compressed one in a cross-reference stream
WARNING: page 0 has shared identifier entries
WARNING: page 0: shared object 7: in hint table but not computed list
WARNING: page 0: shared object 8: in hint table but not computed list
WARNING: page 0: shared object 9: in hint table but not computed list
WARNING: page 0: shared object 10: in hint table but not computed list

AFAIK the object 14 0 appears twice in the PDF file. Adobe Reader uses one and ignores the other, PDFsharp throws an exception.
I do not know which ob those two objects should be prioritized and which should be ignored.

BTW: A GIF file with 6350 bytes is converted to a 7039 JPEG file and then embedded in PDF.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/