Copy link to clipboard
Copied
I am looking for support with importing data from an Excel (table) column to live update a PDF.
We generate lists every quarter and the winners needed to be updated by grouping. We currently copy and paste over 100 times to complete the task. I am looking for a method to automate.
Thank you!
Copy link to clipboard
Copied
Hi,
Did you try "Import Data..." of the "Prepare Form" tool?
You need to save the Excel sheet in .txt file format and the title of each column need to have the same name as the corresponding field.
Else, that can be done via a script.
@+
Copy link to clipboard
Copied
I do not see an import function at the moment on my existing PDF. Is there a method to 'add' this function?
Also, if you do have a smaple scritp I would love to review it.
Thanks for the support.
Copy link to clipboard
Copied
I am using Adobe Acrobat PRO with the ability to combine, edit etc.
Copy link to clipboard
Copied
You should get the "Prepare Form" tool!
And about the script, it is depending on your need. So I need more information about the Excel sheet and your form.
@+
Copy link to clipboard
Copied
The best way to describe it is that I have 60 cities across cananda, with winners in every city. I dont know how many winners there will be in each city until the end of the quarter.
For example: Toronto could have 15 winners this month and 7 the next.
I get an excel list with all winners across all cities and then I need to separate them by city (I can do the excel work) and generate a PDF for only 1 city and deliver that to the manager of that city in PDF.
Copy link to clipboard
Copied
Is it possible to share an entire Excel sheet with fictive data!
The script is able to generate automatically the form for each city without separating in Excel.
If you could share the form too... You can modify the background of the page with a blank page and only keep the fields.
@+
Copy link to clipboard
Copied
Hi,
No answer!
Let's say the Excel sheet is saved in txt format (Unicode UTF-8) as an attachment in the form, such as my example.
You can run this script from an action wizard or the console window:
var pj=this.getDataObject(this.dataObjects[0].name);
var fichier=this.getDataObjectContents(pj.name);
var donnees=util.stringFromStream(fichier,"utf-8"); // Unicode UTF-8 File Format
var lignes=donnees.split("\r\n");
cellules=new Array();
for (var i=0; i<lignes.length; i++) cellules[i]=lignes[i].split("\t");
cellules.shift();
cellules.sort(function(a, b){return a[0].localeCompare(b[0])});
theWinners=new Array();
for (var i=0; i<cellules.length; i++) {
if (i==0) theWinners.push([cellules[0][0],[cellules[0][1]]]);
else if (cellules[i][0]==theWinners[theWinners.length-1][0]) theWinners[theWinners.length-1][1].push(cellules[i][1]);
else theWinners.push([cellules[i][0],[cellules[i][1]]]);
}
for (var i=0; i<theWinners.length; i++) {
this.getField("city").value=theWinners[i][0];
this.getField("winners").value=theWinners[i][1].toString().replace(/,/g,"\r");
this.saveAs({
cPath: this.path.replace(/.pdf$/i," \("+theWinners[i][0]+").pdf"),
bCopy: true
});
}
this.resetForm();
this.dirty=false;
The script will generate all forms following the city and including all winners!
Does that suit you?
@+
Copy link to clipboard
Copied
Much simpler, I suspect, to use Office automation to take the live data and combine it with a Word template. This can be converted to PDF as required. Most things are harder to do once you already have a PDF.
Copy link to clipboard
Copied
Taking the advice from the replies, you're right.... It his harder to add live text to an already existing PDF. What I've done, is recreated the PDF template, formatting and all, in excel and the use the 'Save as PDF' option for all citites.