Matt St. Jean - 2013-06-20

Greetings,

I open a PDF file, change a field, and save it - but the value is not displayed in Acrobat X 10.1.4 when I open it there. However, when I open the saved file with PDF Clown and quickwatch the Form, I do in fact see the updated data. And when i drag the output PDF into Chrome I do see the value!!!

PDF File: http://www.irs.gov/pub/irs-prior/f1040ez--2012.pdf
PDF Clown Version: svn://svn.code.sf.net/p/clown/code/trunk Revision:108

Thanks,
Matt

Sample code:

    private void Run()
    {

        File file = new File("C:\\Users\\mstjean\\Desktop\\f1040ez--2012.pdf");
        //File file = new File("C:\\Users\\mstjean\\Desktop\\f1040ez--2012 OUT.pdf"); // To quickwatch output file

        Document document = file.Document;
        org.pdfclown.documents.interaction.forms.Form form = document.Form;

        if (form == null)
        {
            MessageBox.Show("No form");
            return;
        }

        try
        {
            form.Fields["topmostSubform[0].Page1[0].Entity[0].p1-t4[0]"].Value = "XXXXXXXXXXXXXXXXX";
        }
        catch (Exception exc)
        {
            MessageBox.Show("No such field name: " + exc.Message);
            return;
        }

        try
        {
            file.Save("C:\\Users\\mstjean\\Desktop\\f1040ez--2012 OUT.pdf", SerializationModeEnum.Incremental);
        }
        catch (Exception exc)
        {
            MessageBox.Show("Can't save: " + exc.Message);
        }
    }
 
Last edit: Matt St. Jean 2013-06-20