Hi,
Thanks for your response and the code. Unfortunately, it doesn't work with
the PDF that I created using Adobe LiveCycle ES 2 (on Windows Vista). If
viewed using Acrobat, the field is empty or unchanged. But with FormTest,
the text field is updated. I tried your form (f941.pdf) and the fields are
also updated. Could this be a font issue? I noticed that the font used in
the PDF file is LucidaSans (Type: TrueType, Encoding:Ansi, Actual Font:
Adobe Sans MM, Actual Font Type: Type 1). Should this be "Arial" or similar
to the value in doc.CreateFont ("Arial")?
Thanks,
On Tue, May 11, 2010 at 9:29 PM, dennis jenkins <[email protected]
> wrote:
> Hello,
>
> Just ignore the "Deman loading..." stuff (I commented out that code in
> my own copy of podofo).
>
> I had the same problem a few months ago. I needed to fill out a form
> and have my changes "visible" inside Adobe Reader. A few helpful
> individuals on this list provided me with the information that I needed. I
> ended up implementing this function, which I call before filling in the
> individual form text fields. I won't claim that my solution is the "correct
> solution", but it works for me.
>
> // See section 12.7.3.3 (page 434) of ISO-32000-1:2008.
> // Need to construct an appearance stream for each form field,
> // or configure document to generated one dynamically.
>
> // See section 12.7.4.3 (page 444) of ISO-32000-1:2008.
> // Shows a correct "Appearance Stream" for a text field.
>
> // We can always directly hack the dictionary thuslu:
> // PdfAnnotation::GetObject()->GetDictionary()
>
> static void HackPdfFormDocument (PdfDocument &doc)
> {
> //
> http://www.mail-archive.com/[email protected]/msg01155.html
> // Stolen from PdfAcroForm::Init()
> // doc.GetAcroForm()->Init
> (PdfAcroForm::ePdfAcroFormDefaultAppearance_BlackText12pt);
>
> PdfObject *pObj = doc.GetAcroForm()->GetObject();
>
> pObj->GetDictionary().AddKey (PdfName ("NeedAppearances"),
> PdfVariant (true));
>
> if (!pObj->GetDictionary().HasKey("DA"))
> {
> PdfFont *pFont = doc.CreateFont ("Arial");
> PdfObject *pResource = NULL;
> PdfObject *pFontDict = NULL;
>
> // Create "DR" key.
> if (!pObj->GetDictionary().HasKey (PdfName ("DR")))
> {
> pObj->GetDictionary().AddKey (PdfName ("DR"),
> PdfDictionary());
> }
> pResource = pObj->GetDictionary().GetKey( PdfName("DR") );
>
> if (!pResource->GetDictionary().HasKey( PdfName ("Font")))
> {
> pResource->GetDictionary().AddKey (PdfName
> ("Font"), PdfDictionary());
> }
> pFontDict = pResource->GetDictionary().GetKey(
> PdfName("Font") );
>
> pFontDict->GetDictionary().AddKey( pFont->GetIdentifier(),
> pFont->GetObject()->Reference() );
>
> // Create "DA" key.
> std::ostringstream oss;
> PdfLocaleImbue (oss);
> oss << "0 0 0 rg /" << pFont->GetIdentifier().GetName() <<
> " 12 Tf";
> pObj->GetDictionary().AddKey( PdfName("DA"), PdfString(
> oss.str() ) );
> }
> }
>
>
>
>
> On Tue, May 11, 2010 at 12:55 AM, shoks <[email protected]> wrote:
>
>> What does it mean?
>>
>> I've tried running FormTest to fill-up a form that contains a text and
>> textfield. The form was created using Adobe Livecycle ES2. Was able to enter
>> the value for the textfield but the output PDF, the field is still empty. Is
>> this a known limitation? Am I missing something? I can email the form if it
>> would help.
>>
>> ---
>>
>> s...@shovm:~/work/webprint/podofo/latest/svn-051110/podofo-build/test/FormTest$
>> ./FormTest basicform1.pdf out.pdf
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> Demand loading on, but can't demand-load from object stream.
>> <<
>> /Type /XRef
>> /DecodeParms <<
>> /Columns 4
>> /Predictor 12Attached is the PDF form.
>> >>
>> /Filter /FlateDecode
>> /ID [ <EB0100EDF7912D45B347600E6C6DE8B6>
>> <587040659ED7434A94715F5497439722> ]
>> /Index [ 34 21 ]
>> /Info 33 0 R
>> /Length 62
>> /Prev 81584
>> /Root 35 0 R
>> /Size 34
>> /W [ 1 2 1 ]
>> >>Page 1 contains 1 fields.
>> Field:
>> Type : TextField
>> Current value:
>> Enter new value (if empty value is unchanged):
>> this is a test
>>
>> s...@shovm
>> :~/work/webprint/podofo/latest/svn-051110/podofo-build/test/FormTest$
>> --
>>
>>
>> Thanks
>>
>> ------------------------------------------------------------------------------
>>
>>
>> _______________________________________________
>> Podofo-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/podofo-users
>>
>>
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Podofo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/podofo-users
>
>
------------------------------------------------------------------------------
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users