Hi, Thanks for your very good problem description.
Please try to enable the line below in PdfAcroForm::Init ():
m_pObject->GetDictionary().AddKey( PdfName("NeedAppearances"),
PdfVariant(true) );
Enabling this line should fix your problem.
Best regards,
Dom
Am Dienstag 16 März 2010 schrieb dennis jenkins:
> Hello PoDoFo Community,
>
> I am having difficulty understanding why PDF forms created and
> populated with podofo do not work in Adobe Reader as desired. I wrote
> code to create a one page PDF with one form field and set text on it.
> The text is clearly in the form (when viewed with PoDoFoBrowser 0.5
> (win32)). Yet when I open the PDF in Adobe Reader (9.2.0, win32), the
> field appears empty. When I click on the text field my value is
> visible. When I click off of the field, my value disappears. (My
> code is below)
>
> I'm using the latest podofo from svn (rev 1199, checked out this
> morning), and the PDF 1.3 spec from Adobe's web site [1]. I studied
> the sample code in "podofo/test/FormTest" [2]. I skimmed most of the
> PDF reference manual, and intently read (twice) section 7.6,
> "Interactive Forms".
>
> My ultimate goal is to write a routine that will read a third
> party PDF (with a form on it), fill in the fields and save the form.
> At a later time a user would then load the form into and further edit
> it, email it and/or print it. When I failed to get this to work with
> the desired forms (US / IRS tax form "941" [3]), I created a small app
> to build a custom PDF with a simplified form. I get the same results
> with both forms.
>
> I've viewed both forms inside PoDoFoBrowser. Some annotation
> elements have different attributes, but they are essentially the same.
>
> I have three theories:
>
> a) It is simply not possible to construct a PDF form with data
> pre-populated using "PdfTextField.SetText()".
>
> b) I'm doing something wrong.
>
> c) I need to set some additional attributes or values in the
> annotation element, or its parent object, or in the document object
> itself.
>
> At this time I can see only one possible hack: To read the form
> field's "rects" and create a text overlay in the same position. This
> is indeed a hack as this will prevent the user from properly editing
> the form at a later time (prior to them printing or otherwise using
> it).
>
> Although I am using PoDoFoBrowser and Adobe Reader on win32, I am
> doing my development on Gentoo Linux. This, hopefully, does not
> matter.
>
> I would very much appreciate any suggestions, assistance, etc...
> If it would be helpful, I can post the "stuff" that PoDoFoBrowser
> shows inside the forms. However, it is fairly easy to download the
> "941" form and view it directly.
>
> Thank you for your time.
>
>
> [1] http://www.adobe.com/devnet/pdf/pdfs/PDFReference13.pdf
>
> [2]
> https://podofo.svn.sourceforge.net/svnroot/podofo/podofo/trunk/test/FormTe
> st/FormTest.cpp
>
> [3] http://www.irs.gov/pub/irs-pdf/f941.pdf
>
>
>
> // "main()", "#include" and original error handling omitted for brevity.
> // "HelloWorld" line shamelessly stolen from the PoDoFo online example.
>
> void RunPdfTest (const char *filename)
> {
> PdfStreamedDocument doc (filename);
> PdfPage *pPage = doc.CreatePage (PdfPage::CreateStandardPageSize
> (ePdfPageSize_Letter));
>
> PdfPainter painter;
> painter.SetPage (pPage);
> PdfFont *pFont = doc.CreateFont ("Arial");
> pFont->SetFontSize (18.0);
> painter.SetFont (pFont);
> painter.DrawText (56.69, pPage->GetPageSize().GetHeight() - 56.69,
> "Hello World!" );
>
> PdfTextField text (pPage, PdfRect (100, 200, 300, 400), &doc);
> text.SetFieldName ("text-field");
> text.SetText ("test");
> text.SetMultiLine (false);
>
> painter.FinishPage ();
> doc.Close();
> }
>
> ---------------------------------------------------------------------------
> --- Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Podofo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/podofo-users
>
--
**********************************************************************
Dominik Seichter - [email protected]
KRename - http://www.krename.net - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
PoDoFo - http://podofo.sf.net - PDF generation and parsing library
SchafKopf - http://schafkopf.berlios.de - Schafkopf, a card game, for KDE
Alan - http://alan.sf.net - A Turing Machine in Java
**********************************************************************
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
_______________________________________________ Podofo-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/podofo-users
