CFPDF add text on an existing pdf

New Here ,
Nov 05, 2020 Nov 05, 2020

Copy link to clipboard

Copied

Is there a way to add multiple text values to an exisiting PDF? I would need to read the value from the database and add these values to an exisiting PDF in certain locations and multiple lines. The key word is an exisiting PDF. Thank you for any help?

Name______

Address________

City_____

Views

75

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 05, 2020 Nov 05, 2020

Copy link to clipboard

Copied

I do not know a way to add text to a standard PDF but we do this sort of thing all the time with PDF Forms. If you have Adobe Acrobat, or other tool, you can take a standard PDF and add form fields which you can programatically enter the values using code such as

cfpdfform(action="populate", source="#vTemplate#", destination="#vDoc#", overwrite="true")
{
  cfpdfformparam( name="namefield", value="value for name");
  cfpdfformparam( name="addressfield", value="value for address");
  cfpdfformparam( name="cityfield", value="value for city");
}

The source attribute is your PDF form and the destination is the result PDF with the form populated. 

After populating if you want the result PDF to be protected so you cannot edit the data you need use the following 

 

	cfpdf(	action = "write",
			source = "source PDF",
			destination = "output PDF",
			flatten = "yes",
			overwrite="yes"
	);

 

I have had mixed results with "Flatten" and it sometimes leaves the form editable, securing the PDF will stop someone editing

 

	cfpdf(	action = "protect",
			source = "source PDF",
			destination = "output PDF",
			overwrite="yes",
			NewOwnerPassword="ppppppp",
			permissions="allowprinting"
	);

  

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 05, 2020 Nov 05, 2020

Copy link to clipboard

Copied

Thank you for the reply. Unfortunately these are forms already made. For instance an insurance form woth predefined areas. However I will give acrobat a shot and see if they have some sort or flat input box or area that you can't see.

 

Thanks again.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 05, 2020 Nov 05, 2020

Copy link to clipboard

Copied

We have the same thing, get existing forms then convert them so we can complete with CF. Using Acrobat you can overlay text entry fields on the existing form, it even has a tool to guess where the entry fields need to be and does a very good job of giving you a first pass. You can then manually adjust the size of the fields and the font, etc. You can also add check boxes and complete with CF.

 

 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 06, 2020 Nov 06, 2020

Copy link to clipboard

Copied

LATEST

There's an advanced, undocumented method that you can use.  Search for "coldfusion itext pdfstamp".  Here's a post from the Adobe Support Community:
https://community.adobe.com/t5/coldfusion/adding-text-to-pdf-using-itext-instead-of-cfpdf/td-p/21964...

 

I've used the iText PDFStamp approach to add text, QR codes and images to a PDF ticket templates and have been doing it since ColdFusion 8.

 

The best approach, when possible, is to add unique form fields to the PDF and use CFPDFForm to populate them.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines