pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Vacondio <andrea.vacon...@gmail.com>
Subject Form flattening with or without refresh
Date Mon, 13 May 2019 14:11:58 GMT
Hi, we are having some issue when we try to flatten the form in the file
We get slightly different results depending on the value of refresh
appearance, in particular when we set it to true we get a slightly wrong
positioning of the text field value.
Shouldn't we expect the same result in both cases?
This is the test code (PDFBox 2.0.15):

    public void testFlatten() throws IOException {
        PDDocument testPdf = PDDocument.load(new
        PDAcroForm form = testPdf.getDocumentCatalog().getAcroForm();
        List<PDField> fields = new ArrayList<PDField>();

        testPdf.getDocumentCatalog().getAcroForm().flatten(fields, false);
        File file = new

I isolated the field in the test case but we also get the same result when
flattening the whole form, I included the Acrobat version of the flattened
If we flatten the whole form with refreshAppearance=false we get pretty
much the same result as Acrobat, same number From XObjects, but if we
flatten with refreshAppearance=true we get a lot of Form XObjects (I guess
one for each field, even empty ones) and a slightly wrong positioning of
the text field.
Could you please help me understand what's the issue here?

Here the files:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message