Flattened document with .NET SDK, not flattened in Adobe Reader

431 views Asked by At

Using Foxit .NET SDK in an application to flatten a PDF. When I open the document using Phantom PDF document appears to be flattened. When the document is opened using Adobe Reader, the document appears not to be flattened and the form fields accessible. This is the code I'm currently using:

                // Code added to "Flatten" the PDFs
            SignatureFieldFlatteningOptions sFFO = new SignatureFieldFlatteningOptions();

            sFFO = SignatureFieldFlatteningOptions.Retain;

            FormFlatteningOptions fFO = new FormFlatteningOptions();

            fFO.DigitalSignatures = sFFO;

            mergeDocument.FormFlattening = fFO;

            mergeDocument.CompressionLevel = 9;

            byte[] pdfModifiedOutput = mergeDocument.Draw();

Is there something I should be doing differently? Has anyone else seen this problem?

2

There are 2 answers

1
crmauch On

Well, I found out that the problem is that I didn't have the true nature of the problem described to me. Turns out that users are using the "Typewriter" feature of Foxit PhantomPDF. The comments added by the typewriter remain editable and movable after the file has been "flattened". Any reason why this is and how I could get these "fields" to flatten?

0
Huy Tran On

The SDK you are using is "Foxit PDF SDK for .NET." What I recommend instead is "Foxit PDF SDK for Windows (.NET API)," I am aware that the naming is very similar, however, the API for these two are different. Make a request for the "Foxit PDF SDK for Windows (.NET API)", you will receive a evaluation package(.zip file). In the evaluation package, you can find the flattening project at "examples\simple_demo\pdfflatten\pdfflatten.cs" The line of code that will flatten both annotation and form fields is page.Flatten(true, (int)PDFPage.FlattenOptions.e_FlattenAll);