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 - Damaged PDF generated (Chapter II)...
  FAQ FAQ  Forum Search   Register Register  Login Login

Damaged PDF generated (Chapter II)...

 Post Reply Post Reply
Author
Message
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Topic: Damaged PDF generated (Chapter II)...
    Posted: 12 Dec 07 at 10:13AM
Hello !

I'm still suffering a lot with form field replacement & QuickPDF (see my other postings).

I have a PDF template, which is a PDF with empty form fields and I "stuff" content into those fields grabbing this content from a database.

So far, simple.

What happens is that SOMETIMES, a damaged PDF is generated.

I replaced QuickPDF inside my application by PDFTK, as Chicks suggested some time ago.

When using PDFTK, under the SAME CIRCUMSTANCES, I get a perfectly fine PDF.

As a matter of fact my application generates 2 PDFs : one via QuickPDF and now another one, via PDFTK, simultaneosly. That is, it generates two output files, one from each tool.

I have supplied a kit :

http://www.DES.online.unimep.br/au/pub/kitpdftk.zip

There inside :
  • AG284D.PDF is the template itself.
  • LOG.TXT is a log file where I transcript the field names and values that I'm supposed to replace, from bottom up.
  • QPDF.PDF is the PDF generated via QuicPDF.
  • PDFTK.FDF is the FDF file that I build on my own.
  • PDFTK.BAT is the batch file I use to run PDFTK.
  • PDFTK.PDF is the PDF generated by PDFTK.
The circumstances (EXEcutable, DATA, machine) and everything else are the SAME but QuickPDF generates a wrong PDF and PDFTK generates a OK one.

My conclusion is that there's a bug on QuickPDF field replacement or flattening.

Someone can help me ?

I see no other alternative but to replace QuickPDF by PDFTK, what I TOTALLY dislike....

My logic to replace fields on QUICKPDF is like this :

LNT:=LOQPDF:FORMFIELDCOUNT()
FOR LNI:=LNT TO 1 STEP -1
  LCFNAME:=LOQPDF:GETFORMFIELDTITLE(LNI)
  IF  EMPTY(LCFNAME)
      // SHOUT 'EMPTY FORM FIELD NAME' AND GET OUT
  END IF
  // SEARCHES FOR THIS FORM FIELD (LCFNAME) VALUE AND IF NOT FOUND, GET OUT
  IF  (LNF:=ASCAN(LAPAGES[LNIPAGE,2],{|E,I| LCFNAME == E[1]})) == 0
      // SHOUT 'FORM FIELD VALUE NOT FOUND'
      // GET OUT
  END IF
  LCFVALUE:=LAPAGES[LNIPAGE,2,LNF,2]
  IF  LCFVALUE == NIL
      // SHOULD I HAVE A NULL FIELD VALUE, EMPTIES IT
      LCFVALUE := ""
  END IF
  IF  NOT (LXRESULT:=LOQPDF:SETFORMFIELDVALUE(LNI,LCFVALUE)) == 1
      // COULD NOT SET FORM FIELD VALUE
      // GET OUT
  END IF
  IF  NOT (LXRESULT:=LOQPDF:FLATTENFORMFIELD(LNI)) == 1
      // COULD NOT FLATTEN FORM FIELD
      // GET OUT
  END IF
  // BUILDS FDF FILE...
  LCFDF+="<<"                                                                         + CRLF + ;
         "/T (■" + CHR(255) + CHARMIX(REPLICATE(CHR(0),LEN(LCFNAME)),LCFNAME) + ")" + CRLF + ;
         "/V (■" + CHR(255) + CHARMIX(REPLICATE(CHR(0),LEN(LCFVALUE)),LCFVALUE) + ")" + CRLF + ;
         ">>"                                                                         + CRLF
  M->PCOLOG+=STRTRIM(PROCLINE()) + " CAMPO # " + STRTRIM(LNI) + " : " + LCFNAME + " / " + LCFVALUE + CRLF
  // BUILDS THE LOG FILE
NEXT




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