Reputation: 85
We have a program that modifies a pdf for mailing. We noticed an issue with docusign envelope fields and signatures. They do not stay on the pdf when we modify. I tried everything i can think of in pdfbox.
The only workaround i found is foxit flatten signature when printing and adobe save as pdf do create a flattened pdf that works. I cannot render the whole pdf to an image because i need the pdf text fields to be evaluated programatically.
Anyway to create the same flatten that foxit and adobe to with pdfbox. I am so stumped:(
Not sure if this helps but I am able to access the item in the document this way.
PDDocument doc = PDDocument.load( myFile );
PDPageTree allPages = doc.getDocumentCatalog().getPages();
PDPage page1 = allPages.get(1);
COSDictionary pageDict = page1.getCOSObject();
COSDictionary newPageDict = new COSDictionary(pageDict);
COSDictionary test = newPageDict.getCOSDictionary(COSName.RESOURCES);
test = test.getCOSDictionary(COSName.XOBJECT);
test = test.getCOSDictionary(COSName.F);
test = test.getCOSDictionary(COSName.RESOURCES);
test = test.getCOSDictionary(COSName.XOBJECT);
The item exists in a COSName{X0}, but it does not appear pdfbox can access this so I cannot flatten it. I'd like to itterate through entire document for any non identifiable COSNames and render it to an image because that does work then use that image? Anyway to do this?
Upvotes: 0
Views: 188