Hello Claudius and thanks a ton for your answer!

I found the solution in your first example, the problem was the way I
declared my PdfStamper.
I changed this row:
Dim stamper As New PdfStamper(reader, New FileStream(sOutputFile,
FileMode.Append))
to this:
Dim stamper As New PdfStamper(reader, New FileStream(sOutputFile,
FileMode.Open), Chr(0), True)
and now it works perfectly!

I hope you find the answers you need as well, I'm not that into XML so I'm
afraid I'm not much help there.

Thanks again! / Fredrik

2009/10/27 claud108 <claud...@yahoo.com>

>
> Hi, Fredrik,
>
>
> The example http://www.1t3xt.info/examples/browse/?page=example&id=348will
> save you, as it can be used to prefill a PDF and preserve the usage rights
> (namely, further filling and saving by the user).
>
> But you have to pay attention to address the fields to set values to.
>
> I used the example http://1t3xt.info/examples/browse/?page=example&id=440to
> get the XFA of the PDF file, after I examined the datasets element and
> adrressed the desired element by using the the its parent axis starting
> below data child element of datasets element.
>
> Now I am looking for a method to lookup within the datasets element and
> automatically generate a Java array containing (field name (appropriately
> addressed as above), value). I don't know Java, so that I will try to force
> a XSLT transformation of the datasets element pushed out the PDF file, in
> order to obtain this array.
>
> The most adequate and elegant way to solve this is by using XFA of the PDF
> file. I managed to replace the XFA with but the usage rights aren't
> preserved (I've got an answer on this ML that this is possible, but with
> some work; I would gladly do it, but I don't know Java). This way is simple
> elegant.
>
> When I will solve the lookup, I will tell you.
>
> Good luck,
> Claudius
>
>
> Hogler wrote:
> >
> > Hi! Working on a project using itextsharp and vb.net where I want to
> > produce
> > a partially filled out PDF with editable forms and the option to sign
> with
> > a
> > digital signature. I had it working just fine until last week when I
> > started
> > getting an error when trying to save the final document in Adobe Reader.
> > The
> > message says: "The document could not be saved. There was a problem
> > reading
> > this document (26). " I have a template PDF with forms and extended
> > features
> > enabled which I want to make an editable copy of with some of the forms
> > filled out with data from database. The idea is to be able to take the
> > pre-filled document out on a laptop to be filled out completely and
> signed
> > offline. The problem seems to occur as soon as I open the document with
> > PdfStamper, set the value of a field and then close the document, using
> > the
> > code below. I even tried it with a blank PDF with just one field called
> > "test" and still get the same error. ' -- Dim reader As PdfReader = New
> > PdfReader(sDocTemplate) Dim stamper As New PdfStamper(reader, New
> > FileStream(sOutputFile, FileMode.Append))
> > stamper.AcroFields.SetField("test", "hello") stamper.Close() ' -- When I
> > open the produced PDF there is a small window saying something about the
> > document being damaged and repaired, then it opens and everything seems
> > fine. The forms contain the proper data and everything, but when trying
> to
> > save it the mentioned error message is displayed. As I said, it was
> > working
> > fine right up until this error appeared out of the blue. I haven't
> updated
> > any relevant software that I know of and I think I've eliminated all
> > sources
> > of error right down to itextsharp when testing with a blank pdf. Any
> ideas
> > of what could be wrong would be highly appreciated! / Fredrik
> >
> >
> ------------------------------------------------------------------------------
> > Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> > is the only developer event you need to attend this year. Jumpstart your
> > developing skills, take BlackBerry mobile applications to market and stay
> > ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> > http://p.sf.net/sfu/devconference
> > _______________________________________________
> > iText-questions mailing list
> > iText-questions@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
> >
> > Buy the iText book: http://www.1t3xt.com/docs/book.php
> > Check the site with examples before you ask questions:
> > http://www.1t3xt.info/examples/
> > You can also search the keywords list:
> > http://1t3xt.info/tutorials/keywords/
> >
>
> --
> View this message in context:
> http://www.nabble.com/Can%27t-save-PDF-after-filling-in-form-fields-with-iTextSharp-tp26078435p26086081.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
>
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to