A PDF file has textboxes. The file contains textboxes, images, objects and table. The textboxes contain text. I would like to write a C# script that will run through an Excel file and take the data from the Excel file and past it into a particular location in the textboxes in the PDF file and update the PDF file and copying over everything else in the PDF file then save it. Do I need to find the exact coordinates of each object and text in the PDF file to do this? Is it even possible to do this?
Input PDF File:
Update PDF File:
1
You need to use different library like
To Read data from the Excel file: Use a library like EPPlus or ClosedXML.
Manipulate the PDF file: Use a library like iTextSharp or PdfSharp to manipulate the PDF file.
e.g
form.SetField("TextBox1", excelData[0, 0]);
Update textboxes in the PDF: Use the PDF library to find and update the textboxes with the data from the Excel file.
Save the updated PDF file: Save the changes to a new PDF file.