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!
Page to Image- text fields not showing correctly |
Post Reply |
Author | |
alecd4
Beginner Joined: 29 Sep 11 Status: Offline Points: 10 |
Post Options
Thanks(0)
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? |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
alecd4
Beginner Joined: 29 Sep 11 Status: Offline Points: 10 |
Post Options
Thanks(0)
|
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 |
|
alecd4
Beginner Joined: 29 Sep 11 Status: Offline Points: 10 |
Post Options
Thanks(0)
|
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 |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
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. |
|
alecd4
Beginner Joined: 29 Sep 11 Status: Offline Points: 10 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store