I’m modifying PDF files by adding AcroForm annotations to them.

An example is at http://aapro.net/PDF/ImageButton.pdf.

My open/save/close code is like this:

        PDDocument document = null;
        String outdoc;
        try {
                document = PDDocument.load(inFile);
            } catch (IOException exc) {
                System.out.println("Can't open " + inFile + "; " +  
exc.getMessage());
                return;
            }

        // Do stuff...

        try {
                document.save(outFile);
            } catch (IOException exc) {
                JOptionPane.showMessageDialog(null, "Cannot save output:\n" + 
exc.getMessage());
            }
        try {
                document.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

When I open this PDF file in Acrobat XI or Reader DC (or my colleague opens in 
Acrobat DC) and do nothing, when I try to quit it prompts us to save changes. 
We would like for this prompt not to happen.

I would like to learn what  I can do in my Java code so that we don’t get this 
prompt.

If I say “yes” to the prompt, the next time I open the file and quit, no prompt.

The difference between unsaved and saved look like this in PDFDebugger:

Before Save                                |    After Save
                                           |
 / Filter: FlateDecode                    |    -<> DecodeParms: (2)
[ ] ID: (2)                                |        84 Columns: 4
[ ] Index: (2)                             |        84 Predictor: 12
    84 0: 0                                |     / Filter: FlateDecode
    84 1: 45                               |    +[ ]ID: (2)
+<> Info: (9) [70R]                        |    -[ ]Index: (10)
84 Length: 146                            |        84 0: 5
+<> Root: (9) [1 0 R] /T:Catalog           |        84 1: 3
84 Size: 46                               |        84 2: 10
  / Type: XRef                             |        84 3: 1
+[ ]W: (3)                                 |        84 4: 13
                                           |        84 5: 1
                                           |        84 6: 21
                                           |        84 7: 1
                                           |        84 8: 46
                                           |        84 9: 5
                                           |    +<> Info: (9) [7 0 R]
                                           |     84 Length: 51
                                           |     84 Prev: 64262
                                           |    +<> Root: (9) [1 O R] /T:Catalog
                                           |     84 Size: 46
                                           |      / Type: XRef
                                           |    +[ ]W: (3)

The difference in an ASCII diff is that the saved version has the following 
lines added on at the end.

Thanks for any assistance.
Gary Grosso

5 0 obj
<</Length 3710/Subtype/XML/Type/Metadata>>stream
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.4-c005 78.147326, 
2012/08/23-13:03:03        ">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
      <rdf:Description rdf:about=""
            xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/";
            xmlns:xmp="http://ns.adobe.com/xap/1.0/";
            xmlns:pdf="http://ns.adobe.com/pdf/1.3/";
            xmlns:pdfx="http://ns.adobe.com/pdfx/1.3/";
            xmlns:dc="http://purl.org/dc/elements/1.1/";>
         
<xmpMM:InstanceID>uuid:b9a5830c-b192-49f2-b586-09b2e1064d60</xmpMM:InstanceID>
         
<xmpMM:DocumentID>uuid:4AAB167C-A73E-ABDB-4ED3-0ABC7699AF68</xmpMM:DocumentID>
         <xmp:CreateDate>2017-08-08T13:21:03-04:00</xmp:CreateDate>
         <xmp:ModifyDate>2017-08-08T13:22:23-04:00</xmp:ModifyDate>
         <xmp:CreatorTool>PTC Arbortext Editor with Styler</xmp:CreatorTool>
         <xmp:MetadataDate>2017-08-08T13:22:23-04:00</xmp:MetadataDate>
         <pdf:Producer>PDFlib+PDI 9.0.6 (C++/Win64)</pdf:Producer>
         <pdfx:ConfigFile>C:\Program Files\PTC\Arbortext Editor 
6.1\M060\app\standard.appcf</pdfx:ConfigFile>
         
<pdfx:Stylesheet>C:\Oberon\Allegiant\SVN\trunk\FCOM\custom\doctypes\forms\forms.style</pdfx:Stylesheet>
         <pdfx:PTCArbortextBuild>R61M080-1026</pdfx:PTCArbortextBuild>
         <pdfx:EPSprocessor>PStill version 1.84.36</pdfx:EPSprocessor>
         <pdfx:PrintEngine>Arbortext Advanced Print Publisher 11.0.3487/W 
Library-x64</pdfx:PrintEngine>
         <dc:format>application/pdf</dc:format>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
endstream
endobj
6 0 obj
<</CO[]/DA(/Helv 0 Tf 0 g)/DR 13 0 R/Fields[10 0 R]>>
endobj
7 0 obj
<</ConfigFile(C:\\Program Files\\PTC\\Arbortext Editor 
6.1\\M060\\app\\standard.appcf)/CreationDate(D:20170808132103-04'00')/Creator(PTC
 Arbortext Editor with Styler)/EPSprocessor(PStill version 
1.84.36)/ModDate(D:20170808132223-04'00')/PTCArbortextBuild(R61M080-1026)/PrintEngine(Arbortext
 Advanced Print Publisher 11.0.3487/W Library-x64)/Producer(PDFlib+PDI 9.0.6 
\(C++/Win64\))/Stylesheet(C:\\Oberon\\Allegiant\\SVN\\trunk\\FCOM\\custom\\doctypes\\forms\\forms.style)>>
endobj
10 0 obj
<</AA 15 0 R/AP<</N 47 0 R>>/F 5/FT/Btn/Ff 65536/MK 16 0 R/P 4 0 R/Rect[54.0283 
598.847 125.745 656.847]/Subtype/Widget/T(btnWithImage1)/Type/Annot>>
endobj
13 0 obj
<</Encoding<</PDFDocEncoding 48 0 R>>/Font 21 0 R>>
endobj
21 0 obj
<</Helv 46 0 R/ZaDb 49 0 R/cou 27 0 R/coub 28 0 R/coubo 29 0 R/couo 30 0 R/hel 
31 0 R/helb 32 0 R/helbo 33 0 R/helo 34 0 R/sym 35 0 R/timb 36 0 R/timbi 37 0 
R/timi 38 0 R/timr 39 0 R/zap 40 0 R>>
endobj
46 0 obj
<</BaseFont/Helvetica/Encoding 48 0 R/Name/Helv/Subtype/Type1/Type/Font>>
endobj
47 0 obj
<</BBox[0.0 0.0 71.7167 58.0]/FormType 1/Length 148/Matrix[1.0 0.0 0.0 1.0 0.0 
0.0]/Resources<</Font<</Helv 46 0 
R>>/ProcSet[/PDF/Text]>>/Subtype/Form/Type/XObject>>stream
0.878433 g
0 0 71.7167 58 re
f
0 G
0.5 0.5 70.7167 57 re
s
q
1 1 69.7167 56 re
W
n
0 g
0 G
BT
/Helv 19.031 Tf
0 g
2.033 22.5909 Td
(HELLO!) Tj
ET
Q

endstream
endobj
48 0 obj
<</Differences[24/breve/caron/circumflex/dotaccent/hungarumlaut/ogonek/ring/tilde
 39/quotesingle 96/grave 
128/bullet/dagger/daggerdbl/ellipsis/emdash/endash/florin/fraction/guilsinglleft/guilsinglright/minus/perthousand/quotedblbase/quotedblleft/quotedblright/quoteleft/quoteright/quotesinglbase/trademark/fi/fl/Lslash/OE/Scaron/Ydieresis/Zcaron/dotlessi/lslash/oe/scaron/zcaron
 160/Euro 164/currency 166/brokenbar 168/dieresis/copyright/ordfeminine 
172/logicalnot/.notdef/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu
 183/periodcentered/cedilla/onesuperior/ordmasculine 
188/onequarter/onehalf/threequarters 
192/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]/Type/Encoding>>
endobj
49 0 obj
<</BaseFont/ZapfDingbats/Name/ZaDb/Subtype/Type1/Type/Font>>
endobj
50 0 obj
<</DecodeParms<</Columns 4/Predictor 
12>>/Filter/FlateDecode/ID[<9B9DBC0FEADD069C338DBD87079C3F29><D8B96B6A7536534DBA4B1DBFF40568A2>]/Index[5
 3 10 1 13 1 21 1 46 5]/Info 7 0 R/Length 51/Prev 64262/Root 1 0 R/Size 
51/Type/XRef/W[1 3 0]>>stream
hÞbbdøÓÍÄÀÈš‰ÁH0½
________________________________
ŒË@\ë
ˆbÅ[1] Ö ®/@€

Reply via email to