Receiving Error on PDF Flattening

Product:
PDFNet SDK (AMD64)

Product Version:
10.12.0

Please give a brief summary of your issue:
When trying to flatten a particular pdf it errors out.

Please describe your issue and provide steps to reproduce it:
This might or might not be an application bug but reporting it anyway so you can look into it. The issue is that when trying to flatten a pdf document it errors out. Not sure what is different about this document, but it seems it has some links and other objects. I am not sure how to attach the file here, but I am including the error message below.

Exception: pdftron.Common.PDFNetException: Exception:
         Message: Bad String
         Conditional expression: false
         Version      : 10.12.0-2867facaf1
         Platform     : Windows
         Architecture : AMD64
         Filename     : Parser.cpp
         Function     : trn::SDF::Parser::LexHexString
         Linenumber   : 1179

at pdftron.Common.PDFNetException.REX(IntPtr result)
at pdftron.PDF.PDFDoc.FlattenAnnotations(Boolean forms_only)
at pdftron.PDF.PDFDoc.FlattenAnnotations()

Please provide a link to a minimal sample where the issue is reproducible:

 public override Stream FlattenPdf(
     Stream pdfStream)
 {
     var outputStream = new MemoryStream();
     using var pdfDoc = new PDFDoc(pdfStream);
     pdfDoc.FlattenAnnotations();
     pdfDoc.Save(outputStream, SDFDoc.SaveOptions.e_compatibility);
     pdfDoc.Close();
     outputStream.Position = 0;
     return outputStream;
 }
1 Like

Hi Arman,

Can you please provide the input PDF that is giving you the error?

Also, can you perform other operations on the PDF or is it just flattening that is causing a problem?

I also see you are using a memory stream, does the problem occur when loading the PDF from your system directly?

1 Like

Hi Kia,

I can share the file, but I don’t know how to attach it here. Please advise.

We only have license to use your library for flattening PDF documents so I can’t perform other operations on it. Like I mentioned in my previous post, this only happens for this file. I think it would be good for you to investigate it and see if it is something that you need to fix on your end.

I haven’t tried reading it from file system directly, but I think the result should be the same. Once I provide you the file you can test it on your end.

1 Like

Hi Arman,

You can upload the file to the following one drive:
https://apryse-my.sharepoint.com/:f:/p/kmirsalehi/EgReD7bNrUpGtJfF-X-kVbsB1h9iQI76iCEu3DIIoKtcAA?e=pgajSD

1 Like

Hi Kia,

The file has been uploaded.

1 Like

ok thanks for the information

1 Like