Copy link to clipboard
Copied
I 've been asked to create a document with 10.000 pages. On every page I need to place a unique QR-code that refers to a unique url. I want to generate the QR-codes automaticly (based on a CSV-list or something else?) and would like automaticly add a page for every QR-code (with the data-merge-function in indesign?)
Copy link to clipboard
Copied
You need to create a placeholder - Rectangle on a page - InDesign will do the rest.
Or are you asking for a step-by-step guidance?
https://helpx.adobe.com/uk/indesign/using/data-merge.html
Copy link to clipboard
Copied
Hi @total copys73685545 , You could script the creation of the document and pages, which might be easier than a data merge. This opens a text file on the desktop with each url as a line, and creates the pages and qCodes. You might have a problem creating a 10,000 page doc with a eps on each page—probably depends on your hardware. Something like this might work:
/* a text file on the desktop named URLList.txt with the urls with returns, e.g.
www.adobe.com
www.instagram.com
www.goggle.com */
var qc = readFile(File(Folder.desktop + "/URLList.txt"))
app.scriptPreferences.measurementUnit = MeasurementUnits.INCHES;
var dn = "QCodes";
//tha page’s width and height
var pw = 6;
var ph = 6;
//make a new document
var currdate = new Date
var dp = makeDocPreset("Temp-" + currdate.getTime());
dp.properties = {facingPages:false, pageHeight:pw, pageWidth:ph, top:0, bottom:0, left:0, right:0}
var doc = app.documents.add(true, dp);
doc.name = "QCodes"
dp.remove();
//loop through the url list and add pages with the codes
var np, r;
for (var i = 0; i < qc.length; i++){
np = doc.pages.add()
r = np.rectangles.add({geometricBounds:[0, 0, ph, pw]})
r.createHyperlinkQRCode(qc[i])
};
app.scriptPreferences.measurementUnit = AutoEnum.AUTO_VALUE;
/**
* Makes a new document preset
* @ param preset name name
* @ return the new preset
*/
function makeDocPreset(n){
if (app.documentPresets.itemByName(n).isValid) {
return app.documentPresets.itemByName(n);
} else {
return app.documentPresets.add({name:n});
}
}
/**
* Open a text file
* @ param The text file path
* @ return the text’s paragraphs as an array
*
*/
function readFile(p) {
var f = new File(p);
f.open("r");
var x = f.read();
var r = x.split("\n")
f.close();
return r;
}
Result