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!
![]() |
Damaged PDF generated |
Post Reply ![]() |
Author | |
jabaltie ![]() Senior Member ![]() ![]() Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
![]() ![]() ![]() ![]() ![]() Posted: 22 Nov 07 at 5:49AM |
Hello !
I have had a very hard time here with QuickPDF and the form field functions.... My architecture there is like this : I use PDF templates, which are simply PDFs with empty form fields. To design those templates, I use Open Office, which is free and has a button to export to PDF. My application loads those templates and stuff content into their form fields. After doing it, it Flattens all of the PDF form fields and saves the resulting PDF (or prints it). It happens that SOMETIMES the generated PDF is wrong, that is, some fields are replaced by others. Or , sometimes one field completely overlaps the other. I CAN NOT REPRODUCE the problem, that is, if I generate AGAIN the same template, with the SAME DATA, under the SAME CIRCUMSTANCES, I'll have a perfect PDF being generated. I've struggled with this problem for a while an figured out that, when I DO NOT use the FlattenFormField function, I'll have no problem. However, I need this function cause I generate those PDFs to be viewed by a web browser. And, of course, we do not want to leave those fields open for the end user cause they could fill them up with other content. Just don't know what else I can do if not replacing QuickPDF by another product... Before I do that , maybe someone else here can help me ! Here's a sample template : http://www.DES.online.unimep.br/au/pub/ag284d.pdf The contents I'm using to replace the form field values are here : http://www.DES.online.unimep.br/au/pub/ag284d.xml (as a matter of fact, my application parses the XML and then loads the template and replaces the form field contents). What I have tried so far (and of course has not worked) : - Replacing the fields from bottom up, instead of top down - Replacing the form fields all at once and then flattening them all at once, at the end - Save the PDF without flattening and reloading it right after in order to flatten and save it again right away - Isolate the application from a multi threaded context to a single threaded context - Use the DLL version instead of the ActiveX one I'll provide later some samples of the wrong PDFs generated. Would you have any other suggestions ? The best clue I have is regarded to the FlattenFormField funcion cause it takes way, way too long to run and when I use it on the application, I'll have the problem.... Thank you so much ! |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi!
OpenOffice(-Writer) is similar to Word... Is it possible to create OO-templates with textfields (like a serial letter in Word) and then generate pdf-documents? Best regards, Ingo |
|
![]() |
|
jabaltie ![]() Senior Member ![]() ![]() Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
![]() ![]() ![]() ![]() ![]() |
Yes. You can use Open Office to generate a document with form fields.
Then, export this document to PDF and you'll have a PDF with empty form fields. With Acrobat Reader you can fill in those fields and print. Or, using QuickPDF you can make your application stuff content into those fields and then save back the PDF (or print it). Got it ? |
|
![]() |
|
jabaltie ![]() Senior Member ![]() ![]() Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
![]() ![]() ![]() ![]() ![]() |
As I said before, I have provided some samples of damaged PDFs and other PDFs which are generated OK :
This one is OK : http://www.DES.online.unimep.br/au/pub/ag284dOK.PDF This one is NOT OK : http://www.DES.online.unimep.br/au/pub/ag284dE1.PDF Right below the "Legenda:" it appears a "2007" content. This is not the content expected for this field... |
|
![]() |
|
Michel_K17 ![]() Newbie ![]() ![]() www.exp-systems.com Joined: 25 Jan 03 Status: Offline Points: 297 |
![]() ![]() ![]() ![]() ![]() |
Anything that you can generate to describe the problem well or help determine the source could be useful. It might be interesting to try to get statistical data. For example:
Run a program to fill and then flatten the same PDF 100 times. How many were OK and how many were bad? If all are OK, then it may be a starting condition issue. If not, then it might be a buffer or a timer issue. Cheers! |
|
Michel
|
|
![]() |
|
jabaltie ![]() Senior Member ![]() ![]() Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
![]() ![]() ![]() ![]() ![]() |
Well, I've been trying hard to make a program to emulate the problem.
If only I could have that...... Anyway, more observations : - Statistica data : it happens once or twice in 10 generated PDFs. - Sometimes it happens at the very first, others at the end, others at the middle. - It happens with SAME data submitted to the forms. What I'm doing right now is this : the code is called from XBase++ via ActiveX. XBase++ is a Clipper successor. I wonder if the problem is not regarded to the function being called from XBase++ itself. Maybe if it were called from VB the problem would not happen. In order to do that, what I'll do is to make my XBase++ code generate the VBScript code and then launch the CSCRIPT interpretor. All this only to validade if the problem is on XBase++ level or inside VBScript itself. I hope that I can evidentiate (make it happen) with VBScript too because then I'll be able to post the source code here. Should you have any other ideas (or hipothesys to validate), let me know OK ? Thanks 4 your help ! |
|
![]() |
|
jabaltie ![]() Senior Member ![]() ![]() Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
![]() ![]() ![]() ![]() ![]() |
Well folks I guess I have something very, very interesting here !!!!!!!!
I rewrote my source code from XBase++ ("a la" Clipper) to VBScript, as I had said before that I would do. Big suprise ![]() While Flattening a form field, VBScript denies to do it . Because there is a form field inside the PDF that has a blank name ! So, the template PDF that is being load is WRONG , I guess. I have provided a very useful kit where you can reproduce the problem there at your side. The kit contains : A VBscript source code file (TEST027.VBS) and the its corresponding template PDF file (AG284D.PDF). Please get the kit from here : http://www.DES.online.unimep.br/au/pub/quick.zip One more comment : - Try to quote the flattenformfield function. That is, let the "for/next" run across all of the form fields without flattenning them all (as the sample below). You'll see that this empty form field is not listed ! Why ? --------- FOR LNI=1 TO 122 FORMFIELDNAME=OBJQPDF.GETFORMFIELDTITLE(LNI) SELECT CASE FORMFIELDNAME CASE "TCOCAMPUS" IF NOT OBJQPDF.SETFORMFIELDVALUE(LNI,"DOWNTON") = 1 THEN GETOUT("ERROR WHILE SETTING FORM FIELD VALUE : '" + FORMFIELDNAME + "'") END IF ' CASE ELSE ' GETOUT("CAN NOT FIND THE VALUE OF FIELD '" + FORMFIELDNAME + "'") END SELECT WSCRIPT.ECHO "'" + FORMFIELDNAME + "'" ' IF NOT OBJQPDF.FLATTENFORMFIELD(LNI) = 1 THEN ' GETOUT("ERROR WHILE FLATTENING THIS FORM FIELD '" + FORMFIELDNAME + "'") ' END IF NEXT |
|
![]() |
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