Copy link to clipboard
Copied
Can You write a script for PLACING LINKS of multipage PDF?
For "imposing" linked PDF files in AI (like Quite, Signa, Preps...)
Copy link to clipboard
Copied
Look up the great Multi-Page PDF script written by the legendary Carlos Canto. I use it sometimes so I do not have to write it, why re-invent the wheel right?
Copy link to clipboard
Copied
This script OPEN pdf.
I need PLACE ONLY LINKED pdf (no problem with fonts etc.) for imposing and output to imagesetter
Copy link to clipboard
Copied
Oh, then, excellent, you inspired me to learn something new. Indeed, the seemingly inaccessible task of choosing a PDF's page link can be accomplished with setting preferences. It works by setting a preference first, then creating a new placed file with script - when it appears, the correct page will show!
#target illustrator
function test(){
var doc = app.activeDocument;
var myPDF = File.openDialog("Choose PDF file", "*.pdf");
if(!myPDF){return;}
app.preferences.setIntegerPreference("plugin/PDFImport/PageNumber", 2);
var newPlaced = doc.placedItems.add();
newPlaced.file = myPDF;
};
test();
Copy link to clipboard
Copied
"It works by setting a preference first..."
How can I do this? (Other words for dummies)
Copy link to clipboard
Copied
This line here makes the page of the next placed PDF be page # 2:
app.preferences.setIntegerPreference("plugin/PDFImport/PageNumber", 2);
If you hang around these forums for 5 years and stay up till 2 am most days doing this stuff, believe me, you will get there, do not give up. Be crazy!
Copy link to clipboard
Copied
It opened the first page only.
Copy link to clipboard
Copied
What am I doing wrong?
Copy link to clipboard
Copied
Another script open specified number of pages.
but all of them are FIRST (not "i")
var doc = activeDocument,
f = File.openDialog ('pdf', '*.pdf'),
p = prompt ('minimum 1 page', 5, 'specified')
i = 0;
for (; ++i <= p;) {
app.preferences.setIntegerPreference('plugin/PDFImport/PageNumber', i);
doc.placedItems.add().file = f;
}
Copy link to clipboard
Copied
How to use this function (select a page in Place PDF)
Copy link to clipboard
Copied
Which version are you using? Maybe in a different version the preferences command was moved around.
In CC 2015.3, this following script worked to accomplish your desired goal.
To find the preferences string 'plugin/PDFImport/PageNumber', I opened the file located here:
C:\Users\<<me>>\AppData\Roaming\Adobe\Adobe Illustrator 20 Settings\en_US\x64\Adobe Illustrator Prefs
#target illustrator
function test(){
var doc = app.activeDocument;
var myPDF = File.openDialog("Choose PDF file", "*.pdf");
if(!myPDF){return;}
for(var i=0; i < 5; i++){
app.preferences.setIntegerPreference("plugin/PDFImport/PageNumber", i + 1);
var newPlaced = doc.placedItems.add();
newPlaced.file = myPDF;
newPlaced.left = i * 630;
};
};
test();
Copy link to clipboard
Copied
AI CS5.
In my AIPfefs:
PDFImport {
/PageNumber 1
/CropTo 4
/DlgPosY 204
/DlgPosX 494
}
Copy link to clipboard
Copied
If this part is not inside a
/plugin {
}
then your string would probably be just "PDFImport/PageNumber"
Copy link to clipboard
Copied
Maybe, the function "doc.placedItems.add()" must have an argument?
Copy link to clipboard
Copied
OR
It may be function like "PageToOpen" (Specifies which page are used when PLACING a multipage document)?
Copy link to clipboard
Copied
I do not think so, because your code worked for me on Win7 CC2015.3
I do have CS5 at home on Windows, maybe I can test on it soon.
Copy link to clipboard
Copied
Hi guys, check this thread about increasing the pageToOpen
How to "Place as linked file" (not "import") a multipage PDF file on a single Artboard ?
Copy link to clipboard
Copied
pdfOptions.pageToOpen++;
This function returns error
Find more inspiration, events, and resources on the new Adobe Community
Explore Now