No one can help me for this problem ...?
2010/8/13 mathieu fabre <[email protected]>
> Hi,
>
> I recently use the PDFBox librairy and I would like to change the stream
> part of an object which is an AcroForm Object (a stream in PDF Form object).
>
> in the PDF, for example we have this:
> *
> 83 0 obj<</Subtype/Form
> /Length 637
> /Filter[/FlateDecode]
> /Name/FRM
> /Matrix[1.0 0.0 0.0 1.0 -9.21249 -82.235]
> /Resources 214 0 R
> /Type/XObject
> /BBox[0.0 0.0599976 18.425 164.41]
> /FormType 1>>
> stream
>
> some stream unreadable... that i want to change with other stream
>
> endstream
> endobj*
>
>
> In the JAVA code, i am able to go to the object with the code :
>
> // Create the PDF Document
> PDDocument doc = PDDocument.load(myFile);
>
> // Extract the catalog
> PDDocumentCatalog catalog = doc.getDocumentCatalog();
>
> // Retrieve the AcroForm
> PDAcroForm acroForm = catalog.getAcroForm();
>
> // Retrieve all fields that should be change
> List listField = acroForm.getFields();
> Iterator<PDField> it = listField.iterator();
>
> // Loop on each field
> while(it.hasNext())
> {
> // Cast to PDField
> PDField field = (PDField)it.next();
>
> // Retrive the COSObject containing the stream part
> COSDictionary dicoField = (COSDictionary)field.getCOSObject();
> COSDictionary mkField =
> (COSDictionary)dicoField.getDictionaryObject(cosName1);
> COSDictionary iField =
> (COSDictionary)mkField.getDictionaryObject(cosName2);
>
> // Here, i am on the good object (83 0) and if I print the iField, I
> obtain same information as in the PDF file
> // But I am not able to have acces to the STREAM part of the
> COSObject/COSDictionary
> }
>
> Could you help please ? I don't know how to change the stream part. I
> thought the COSOject could give me this possibility... :|
>
> Thanks, in advance
>
> --
> Mat
>
--
Mat