Re: [NF] URGENT Request - MailMerge w/PDF

Author: Alan Bourke

Posted: 2017-05-25 at 03:16:23

Not clear on what you're trying to do - are these actual PDF forms or do

you just need to put data into an existing vanilla PDF?

If it's any help I did some code recently to add a customer signature

captured from a signature pad to a PDF invoice. One of the methods I

investigated was generating the invoice first and then merging the

signature graphic in. It used the free Debenu Quick PDF Lite Library

(http://www.debenu.com/products/development/debenu-pdf-library-lite/)

which has support for merging graphics into PDFs. Ultimately I didn't

end up going down this route but here's the business end of it FWIW. You

might need the paid version to merge text or fill PDF forms.

* -- Parameters are target PDF, the filename of the graphic with the

signature, and the image dimensions.

Function SignPDF(lcPDFFile as String, lcSigFile as String, loParms as

Object)

Local lnFileID, lnImageID

With goApplication.oDebenuPDF

If .LoadFromFile(lcPDFFile, "") > 0

? "PageHeight=" + Transform(.PageHeight)

.SelectPage(1) && - -TODO each page

or last?

.NormalizePage(0)

.SetOrigin(1) && -- Top left

lnFileID = .SelectedDocument

lnImageID = .AddImageFromFile(lcSigFile, 0)

If lnImageID > 0

If .SelectImage(lnImageID) > 0

if .DrawImage(loParms.ImgLeft, loParms.ImgTop, ;

loParms.ImgWidth, loParms.ImgHeight) > 0

If .SaveToFile(lcPDFFile) = 0

?"ERROR: Could not save " + lcPDFFile

Else

? "Merge successful."

Endif

Else

? "Could not draw image."

endif

Else

? "Could not select image."

Endif

Else

? "ImageID = 0"

Endif

Else

? "Could not load image file."

EndIf

EndWith

Endfunc

--

Alan Bourke

alanpbourke (at) fastmail (dot) fm

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/1495700183.755737.988057400.18277E2D@webmail.messagingengine.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2017 Alan Bourke