Welcome Guest Search | Active Topics | Sign In | Register

Adding text to an existing PDF file Options
Gabe
Posted: Thursday, March 15, 2018 4:00:09 PM
Rank: Member
Groups: Member

Joined: 5/4/2016
Posts: 19
We have been using EO.PDF for a while in our application, largely to convert HTML documents to PDF. Recently we have bee tasked with adding text to an existing PDF document, specifically the following form...
https://studentaid.ed.gov/sa/sites/default/files/public-service-employment-certification-form.pdf

Reading through the documentation, I can see how one can modify a PDF to input data in to form fields. Unfortunately this document does not contain form fields and we would need to "add text" on top of it using X,Y positions. Looking at your documentation, it appears we may be able to do this with the PDF creator functionality, but this is not clear.

Can you point me to some documentation to where one could open this existing PDF and add text on top for specific X,Y positions? Also, adding images in the same way would also be useful.
eo_support
Posted: Friday, March 16, 2018 3:19:22 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Adding text to an existing PDF file and creating new PDF file are very much the same. So you can use any interface that you use to create new PDF file to add text to existing PDF file. The key is you need to supply the existing file/page. For example, the following code create a new PDF file:

Code: C#
//Create a new PdfDocument
PdfDocument doc = new PdfDocument();

//Output "test" to it
HtmlToPdf.ConvertHtml("test", doc);

The following code do the same on an existing file:
Code: C#
//Open an existing PDF file
PdfDocument doc = new PdfDocument("your_existing_file.pdf");

//Output "test" to it --- Note that this line is the same
HtmlToPdf.ConvertHtml("test", doc);


Note that the difference is on the first line, not on the second line. All options that applies to the new document applies to existing document as well. For example, to set page margins, you would set HtmlToPdf.Options.OutputArea.

While almost all options work the same way for new document and existing document, some options matters more to one scenario than other. For example, HtmlToPdf.Options.StartPageIndex may matter more and used much more often for an existing document than a new document.

The PDF creator interface always works with both new PDF document and existing PDF document in very similar way ---- the main difference is the document you supplied.

Hope this helps. Please feel free to let us know if you still have any more question.

Thanks!


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.