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

Author: Kurt Wendt

Posted: 2017-05-25 at 09:56:04

Alan - as I wrote in the original posting - the PDF Files come from a Client. Its also Digitally Signed. On that PDF - they need to have name and addresses on the PDF - based upon data from an Excel file. Thus a mail merge. But, yeah - PDF already exists! It is NOT something that I can generate from VFP - so, VFP is NOT involved - thus why I posted as [NF].

Regards,

Kurt Wendt

Senior Systems Analyst

Tel. +1-212-747-9100

www.GlobeTax.com

-----Original Message-----

From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Alan Bourke

Sent: Thursday, May 25, 2017 4:16 AM

To: profoxtech@leafe.com

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

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

[excessive quoting removed by server]

_______________________________________________

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/80838F1CA795B14EA1AF48659F35166F18FFA9E4@DREXCH02.corp.globetax.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 Kurt Wendt