Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Page to Image- text fields not showing  correctly
  FAQ FAQ  Forum Search   Register Register  Login Login

Page to Image- text fields not showing correctly

 Post Reply Post Reply
Author
Message
alecd4 View Drop Down
Beginner
Beginner


Joined: 29 Sep 11
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote alecd4 Quote  Post ReplyReply Direct Link To This Post Topic: Page to Image- text fields not showing correctly
    Posted: 02 Nov 11 at 5:10PM
I am using QuickPDF to render pages from a  pdf file to image file. PDF file has several form fields that my application sets values to using the following APIs

SetNeedAppearances
SetFormFieldValue
SetFormFieldPrintable



Then my application calls SetFormFieldReadOnly against every field in a form.

This works just fine resulting in form with correct data in readonly fields (text,list,checkbox,radio)

Unfortunately when I render pages from that pdf to an image file text fields come with no data. Lists, checkboxes, and radio are fine.

Printing that pdf in Acrobat Reader shows all fields correctly

What I am doing wrong?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 02 Nov 11 at 7:07PM
So try it with first readonly and then printable ... perhaps then it works?
The other thing:
What are the returning values after the function-calls... 0 or 1?
BTW: It could be that QuickPDF has still the loaded pdf in memory?
Perhaps you should save your modified pdf and after a new load it will work like you want it?

Cheers, Ingo
Back to Top
alecd4 View Drop Down
Beginner
Beginner


Joined: 29 Sep 11
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote alecd4 Quote  Post ReplyReply Direct Link To This Post Posted: 02 Nov 11 at 7:37PM
setreadonly doesn't affect the result.

Return value from all API calls is 1 indicating success. In fact, text value are there. The result is correct except when rendering to file.

Pdf update and rendering are different events. Even if performed by different apps rendering of text fields fails.

You can see those in Acrobat and Reader. Printing also shows text fields.

Interestingly if I open pdf file in question after field update with Acrobat then save it without modification then the  rendering works just fine showing text values in the image.

I submitted test file. Case 9225


Edited by alecd4 - 02 Nov 11 at 8:31PM
Back to Top
alecd4 View Drop Down
Beginner
Beginner


Joined: 29 Sep 11
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote alecd4 Quote  Post ReplyReply Direct Link To This Post Posted: 02 Nov 11 at 10:52PM
I created simple pdf file that has a form with a single text field.
Here is the code I was using to set values

            PDFLibrary qp = new PDFLibrary(@"QuickPDFDLL0811.DLL");
            qp.UnlockKey("license here");
            qp.LoadFromFile("test.pdf", "");
            qp.SetNeedAppearances(1);
            int total = qp.FormFieldCount();
            for (int j = 1; j <= total; j++)
            {
                value="value-value";
                int ret=qp.SetFormFieldValue(j, value);
                int ret2 = qp.SetFormFieldPrintable(j, 1);
            }
            qp.SaveToFile("test2.pdf");

Open test2.pdf to confirm that new text values are set correctly.

Rendering test2.pdf pages to file doesn't show text values.


Edited by alecd4 - 02 Nov 11 at 10:56PM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 03 Nov 11 at 7:07AM
Hi Alec!
 
... or try it the other way round and check the returning values for:
GetFormFieldPrintable
GetFormFieldType
GetFormFieldVisible
GetFormFieldReadOnly
... perhaps a way to determine the real problem?
... or has it to do with XFA- and non-XFA-formfields?
I'll stop here. But it's only a user-user-forum here - if you don't get a solution here you should use the official support pages.
 
Cheers, Ingo
 


Edited by Ingo - 03 Nov 11 at 7:07AM
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 03 Nov 11 at 9:14AM
QP.SetNeedAppearances(1) 

This tells Acrobat Reader that it should draw the formfields itself and that there are no 'appearance streams' in the file to help render the form fields.  

If you need QPL to render the form fields with QPL and RenderPageToFile then you need to replace SetNeedAppearances(1) with

            QP.SetNeedAppearances(0);
            for (int i = 1; i <= QP.FormFieldCount(); i++)
                    QP.UpdateAppearanceStream(i);

This tells QPL to create appearance streams for each of the formfield objects.

Andrew.



Back to Top
alecd4 View Drop Down
Beginner
Beginner


Joined: 29 Sep 11
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote alecd4 Quote  Post ReplyReply Direct Link To This Post Posted: 04 Nov 11 at 9:08PM
            QP.SetNeedAppearances(0);
            for (int i = 1; i <= QP.FormFieldCount(); i++)
                    QP.UpdateAppearanceStream(i);

Above  helps

//error processing is removed
int id=Lib.LoadFromFile(path, password);
Lib.SetNeedAppearances(0);
int total = Lib.FormFieldCount();
for (int j = 1; j <= total; j++)
{
    Lib.UpdateAppearanceStream(j);
}
Lib.RenderPageToFile(dpi, no, option, path2);
Lib.RemoveDocument(id);


Does it make sense to call UpdateAppearanceStream() after I update formfields with new values and store updated pdf file? The reason is to store appearance stream for each form item in pdf file.





Edited by alecd4 - 04 Nov 11 at 10:01PM
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store