Copy link to clipboard
Copied
Hi there,
(1) I would like to use teh autofill feature of InDesign to produce approximately 350 individual certificates, which is reasonably straightforward. Howver, I would like to save each certificate as an individual PDF, rather than save them all into one PDF. Is this possible?
(2) I would also like to use the first name and last name on the certificate as the name of the PDF file, so that each PDF is easily identifiable. Is this possible?
Thanks for your help.
When I have done something similar, I made sure the that names were set up with a unique paragraph style not used on any other type in the docuemnt. I then set them us as bookmarks, and Checked Include Bookmarks when creating the PDF.
Once that is done, you can use Split under Organize Pages, using Split by Top Level Bookmarks, with Use Bookmarks for File Names selected.
I do it this way:
1. make paragraph styles in your certificate file before you run your data merge
2. make a TOC that reads those style
3. have the TOC float outside the art board in the first page, update it before making the .pdf
4. run data merge
5. Make a .pdf for print and include bookmarks
6. from acrobat open the 350 page .pdf
7. From acrobat go to organize pages and split, before you run the split go to the output option and choose to save separate files and named them using the bookma
...Copy link to clipboard
Copied
I've done this with using the Primary Text frame with the margins set to just the name area. When I placed a list of the names, the paragraph style was set to start on a new page. This caused the name list to auto-flow as many certificates as I needed. (I also changed the preferences to auto-delete pages so the next time I used it, unused pages were removed.)
I then made the PDF. I used Acrobat to split them into separate files.
I can upload my file if you wish.
Copy link to clipboard
Copied
Regarding #2, I did this at a previous job using a script and an excel file. Not sure what OS you're on (I was on Mac) but it's a pretty simple script. If you google "rename files from excel list" you'll find a variety of solutions. As Creamer said, use Acrobat to split the PDF into multiple PDFs and then the script can rename them.
Copy link to clipboard
Copied
I'm on macOS 11.5.2
Copy link to clipboard
Copied
When I have done something similar, I made sure the that names were set up with a unique paragraph style not used on any other type in the docuemnt. I then set them us as bookmarks, and Checked Include Bookmarks when creating the PDF.
Once that is done, you can use Split under Organize Pages, using Split by Top Level Bookmarks, with Use Bookmarks for File Names selected.
Copy link to clipboard
Copied
@SJRiegel Clever and elegant.
(I'm going to steal, I mean, borrow that solution in the future!)
Copy link to clipboard
Copied
So InDesign will produce 350 individual certificates using this solution?
I'm unsure how to set up the certificate names as bookmarks?
Copy link to clipboard
Copied
Thanks you. This is a great solution.
Copy link to clipboard
Copied
Hello,
Take a look at the link below to a script I wrote.....
Regards,
Mike
Copy link to clipboard
Copied
I do it this way:
1. make paragraph styles in your certificate file before you run your data merge
2. make a TOC that reads those style
3. have the TOC float outside the art board in the first page, update it before making the .pdf
4. run data merge
5. Make a .pdf for print and include bookmarks
6. from acrobat open the 350 page .pdf
7. From acrobat go to organize pages and split, before you run the split go to the output option and choose to save separate files and named them using the bookmark names.
Hope this helps. I do this every year for a client, run 2500 certificates. For us the certificate number is a serial number, so they want the certificates to be saved all individually plus for the file name to be the serial numbers in the certificate from the data merge.
Copy link to clipboard
Copied
Thanks for this.
Re point 1, Are you suggesting a new paragraph style for every individual certificate?
Copy link to clipboard
Copied
No--just one paragraph style.
Copy link to clipboard
Copied
Only on style is needed. Super easy right?
Copy link to clipboard
Copied
Hello @genkitony,
I should have stated that the script I created will export the individual pdf's you want directly from the InDesign document so there's no need to create bookmarks and split them in Acrobat.
1. Start off by creating a Paragraph style named "PDF_name"
2. Create a text box in the slug area with a portion of the box within the page bounds and assign the Paragraph style "PDF_name"
3. Assign the field from the data source for the pdf naming
4. Create and save the Merged document, run the script to export the pdfs
The below script will export pdfs named by the contents of the text box useing the Paragraph style named "PDF_name from each page.
var doc = app.documents[0];
var myResult = {};
var allStoriesArray = app.documents[0].stories.everyItem().getElements();
for(var n=0; n<allStoriesArray.length; n++){
var currentStory = allStoriesArray[n];
var textContainersLength = currentStory.textContainers.length;
var lastFrameOfStory = currentStory.textContainers[textContainersLength-1];
var objToCheck = lastFrameOfStory;
if(lastFrameOfStory.constructor.name == "TextPath")
objToCheck = lastFrameOfStory.parent
if(currentStory.overflows && objToCheck.itemLayer.visible && objToCheck.parentPage != null)
myResult[objToCheck.parentPage.name] = objToCheck.parentPage.name;
}
var pageList = new Array;
for(var a in myResult)
pageList.push(a);
pageList.sort(function(a,b) {return a-b});
if(pageList.length > 0){
alert("Error!\nDocument contains overset text on page(s): \r" + pageList);
exit();
}
var mLinks = doc.links;
for(var i = 0; i < mLinks.length; i++){
if ((mLinks[i].status == LinkStatus.LINK_MISSING || mLinks[i].status == LinkStatus.LINK_OUT_OF_DATE) && checkIfOnPage(mLinks[i].parent.parent) && mLinks[i].parent.parent.itemLayer.visible == true ){
alert("Error!\nThis document contains links to files that are missing or modified, use the links panel to fix the problem(s) and try again!");
exit();
}
}
function checkIfOnPage(mItem){
var _OldZeroPoint = app.activeDocument.zeroPoint;
app.activeDocument.zeroPoint = [0,0];
var _Width =app.activeDocument.documentPreferences.pageWidth;
var _Height=app.activeDocument.documentPreferences.pageHeight;
var _Bounds = mItem.geometricBounds;
if ((_Bounds[3] < 0) || (_Bounds[1] > _Width) || (_Bounds[0] > _Height) || (_Bounds[2] < 0)){
return false
}else{
return true
}
app.activeDocument.zeroPoint =_OldZeroPoint;
}
function myGetPageNames(){
var myPageNames = new Array;
for(myCounter = 0; myCounter < app.activeDocument.pages.length; myCounter ++){
myPageNames.push(app.activeDocument.pages.item(myCounter).name);
}
return myPageNames;
}
//Function Returns pdf_name for Selected Pages
function getTextFromPageUsingParagraphStyle(myPage){
if (doc.paragraphStyles.itemByName("PDF_name") == null) {
alert ('Error!\nThe Paragraph Style "PDF_name" does not exist or is Labeled Incorrectly.');
exit();
}
app.findTextPreferences = app.changeTextPreferences = null;
app.findTextPreferences.appliedParagraphStyle = "PDF_name";
var myTextframes = myPage.textFrames;
var pdf_name = null;
for (y=0; y < myTextframes.length; y++){
try {
var mySearchResult = myTextframes[y].findText();
if (mySearchResult.length > 0){
pdf_name = mySearchResult[0].contents;
break;
}
}catch (e){
}
}
return pdf_name;
}
//Dialog/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var mySelectedFolder = Folder.selectDialog ("Select a Folder");
if(mySelectedFolder != null){
}else{
exit();
}
var myDialog = app.dialogs.add({name:"DataMerge 1-Page HR Pdf Exporter", canCancel:true});
with (myDialog){
with (dialogColumns.add()){
with (dialogRows.add())
staticTexts.add({staticLabel:"Page Range Options", minWidth:25});
with (borderPanels.add()){
var myradiogroup1 = radiobuttonGroups.add();
with (myradiogroup1){
var myyesradiobutton1 = radiobuttonControls.add({staticLabel:'Export All Pages', checkedState:true});
var mynoradiobutton1 = radiobuttonControls.add({staticLabel:'Export Select Pages'});
staticTexts.add({staticLabel:"", minWidth:75});
}
}
}
}
if (myDialog.show() == true){
var SelectedPages = myradiogroup1.selectedButton;
}else{
}
myDialog.destroy();
//All Pages//////////////////////////////////////////////////////////////////////////////////////////////////
if (SelectedPages == false){
for(var p = 0; p < app.documents[0].pages.length; p++) {
var frames = app.documents[0].pages[p].textFrames;
var pdf_name = null;
for(var i = 0; i < frames.length; i++) {
try {
if(frames[i].paragraphs[0].appliedParagraphStyle.name == 'PDF_name') {
pdf_name = frames[i].paragraphs[0].contents;
break;
}
}catch (e){
}
}
if (pdf_name == null) {
alert ('Error!\nThe Paragraph Style "filename" is not applied to one or more of the pages or is Labeled Incorrectly.');
exit();
}
if(pdf_name != null) {
}
app.pdfExportPreferences.pageRange = app.documents[0].pages[p].name;
var export_preset = app.pdfExportPresets.item("[High Quality Print]");
doc.exportFile(ExportFormat.PDF_TYPE, File(mySelectedFolder +"/"+ pdf_name + ".pdf"), false, export_preset);
}
alert("Done Exporting Pdf's!");
}
//Selected Pages/////////////////////////////////////////////////////////////////////////////////////////////
if (SelectedPages == true){
for(var p = 0; p < app.documents[0].pages.length; p++) {
var frames = app.documents[0].pages[p].textFrames;
var pdf_name = null;
for(var i = 0; i < frames.length; i++) {
try {
if(frames[i].paragraphs[0].appliedParagraphStyle.name == 'PDF_name') {
pdf_name = frames[i].paragraphs[0].contents;
break;
}
}catch (e){
}
}
if (pdf_name == null) {
alert ('Error!\nThe Paragraph Style "PDF_name" is not applied to one or more of the pages or is Labeled Incorrectly.');
exit();
}
if(!pdf_name) continue;
}
var myPageNames = myGetPageNames();
var selectPgs = new Window ("dialog", "Select Page#'s To Export");
var pgGroup = selectPgs.add("group");
pgGroup.orientation = "column";
pgGroup.alignChildren = "center";
pgGroup.add("statictext", undefined, "Export Single Page pdf's");
var pgsList = pgGroup.add("listbox", [-25, 0, 170, 246], myPageNames, {multiselect: true});
var selectedpgsList = [];
for (var i = 0; i < pgsList.items.length; i++){selectedpgsList[-1] = pgsList.items[i];}
pgsList.selection = selectedpgsList;
var btn = selectPgs.add("group");
btn.orientation = "row";
btn.alignment = ["right", "top"];
var okBtn = btn.add ("button", undefined, "OK", {name:"OK"});
var cancelBtn = btn.add ("button", undefined, "Cancel", {name:"Cancel"});
var result = selectPgs.show();
if(result == 1){
}
else if (result== 2){
exit(0);
}
var pagelist = [];
if(pgsList.selection == null){
alert ("Error!\nNo page#'s were selected.")
exit();
}else{
for (var i=0; i<pgsList.selection.length; i++) {
pagelist.push(pgsList.selection[i].text);
}
}
for (i = 0; i < doc.pages.length; i++) {
if (String(pagelist).match("\\b"+doc.pages[i].name+"\\b")){
var pdf_name = getTextFromPageUsingParagraphStyle(doc.pages[i]);
app.pdfExportPreferences.pageRange = doc.pages[i].name;
var export_preset = app.pdfExportPresets.item("[High Quality Print]");
doc.exportFile(ExportFormat.PDF_TYPE, File(mySelectedFolder +"/"+ pdf_name + ".pdf"), false, export_preset);
}
}
alert("Done Exporting Pdf's!");
}
Regards,
Mike
Copy link to clipboard
Copied
I got it to work. Many thanks. Now, how to email 350 seperate PDF certificates via email?
Copy link to clipboard
Copied
You can use a bulk email program like MaxBulk Mailer. There are plenty of others--just have to do some research.
https://www.maxprog.com/site/software/internet-marketing/mass-bulk-emailer-sheet-us.php
Tip: check with your email server company/dept. to see how many you can send at a time (x emails per y minutes) so your email doesn't get shut down as a potential spammer.
Copy link to clipboard
Copied
I've made a script back in 2015 that does exactly what the OP is after. It is called Data Merge to Single Records. There is a free version that does PDF/INDD and a pro version that does a few more formats such as PNG, JPG or EPS. Links to these (and other scripts) are here: https://colecandoo.com/scripts/