The code you posted doesn't call any of the doc.save() methods.  It also 
never sets anything in the acroform.  What version of PDFBox are you 
using?  When you say it doesn't work, do you mean it throws an exception? 
Is this only an issue with AcroForm, or with the entire PDF (i.e. Can you 
make other changes to the PDF and save them properly)?  Can you provide 
all your code and put the PDF online somewhere and send us a link so we 
can try to duplicate the issue?

I haven't dealt with AcroForms at all, so I'm not sure I can help you, but 
I can tell you that we'll at least need the code which updates & saves the 
data before we can help with why it won't update & save.

---- 
Thanks,
Adam





From:
mathieu fabre <[email protected]>
To:
[email protected]
Date:
08/24/2010 14:09
Subject:
Re: need help for stream part in a PDF file



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



?  Click here to submit conditions  

This email and any content within or attached hereto from  Sun West Mortgage 
Company, Inc.  is confidential and/or legally privileged. The information is 
intended only for the use of the individual or entity named on this email. If 
you are not the intended recipient, you are hereby notified that any 
disclosure, copying, distribution or the taking of any action in reliance on 
the contents of this email information is strictly prohibited, and that the 
documents should be returned to this office immediately by email. Receipt by 
anyone other than the intended recipient is not a waiver of any privilege. 
Please do not include your social security number, account number, or any other 
personal or financial information in the content of the email. Should you have 
any questions, please call  (800) 453 7884.   

Reply via email to