Copy link to clipboard
Copied
Hi all,
is there any way i can rename every page to a text field on the pages.
On every page i have an article-number and i need to export every page to a seperate pdf files (thanks adobe for that last update!) where that number is in the pdf-filename.
I can do that manually but the amount of pages is getting rather big. so is there a way i can automate this within indesign?
any scripts?
thanks
Updated one.
...var c = 0; var myStyle = "test";
while(c < app.activeDocument.pages.length){
var found = findMyTextStyle(myStyle, app.activeDocument.pages
); if(found==null){
found = "1";
}
try{
var sec = app.activeDocument.sections.add(app.activeDocument.pages
); }
catch(e){
var sec = app.activeDocument.pages
.appliedSection; }
sec.continueNumbering = false;
sec.pageNumberStart = parseInt(found);
c++;
}
function findMyTextStyle(myStyle
Copy link to clipboard
Copied
Could you please explain more exactly what you want to achieve?
It would be best if you add snapshot.
Copy link to clipboard
Copied
I have to make Cards wich contains a productnumber and a lot of different information on a product.
I want to change the pagenumber in the "pages"-screen to that article number so that when i export to seperated pdf's i can put the article number in the filename.
*note that these numbers dont follow each other.
Copy link to clipboard
Copied
If you want to change every page number, you can achieve this using number & section start section option defining each and every page individually.
You can choose each and every page number to fulfill your need.
Copy link to clipboard
Copied
If still have doubts add snapshot
Copy link to clipboard
Copied
true, but i have a lot of cards. so doing this manually is a lot of work, but this is what i try to automate.
Copy link to clipboard
Copied
Hi Bart,
I think what you're trying to achieve is clear. It needs a script, and I don't recall a free one that does this. So I recommend: (a) doing some Google-work to make sure it doesn't already exist; (b) Asking on the InDesign Scripting forum if you're interested in getting help with scripting this yourself, or (c) I'd be interested in working on this because it ties in with something else I'm doing. If interested, get in touch for a quote: admin [at] id-extras.com.
HTH,
Ariel
Copy link to clipboard
Copied
Tá´€W wrote
Hi Bart,
I think what you're trying to achieve is clear. It needs a script, and I don't recall a free one that does this. …
Exactly.
FWIW: Adding sections, section naming or re-naming, even page naming will not help with the new InDesign feature for exporting every page as individual PDF file. Page names are not honored by the new export options.
A script doing this would pick up information on a page directly from a dedicated text frame ( just one out of more possible implementations ) and export exactly that page using the info for naming the files.
Regards,
Uwe
Copy link to clipboard
Copied
You can try this below code,
var c = 0;
while(c < app.activeDocument.pages.length){
var sec = app.activeDocument.sections.add(app.activeDocument.pages
); sec.continueNumbering = false;
sec.pageNumberStart = 1;
c++;
}
Copy link to clipboard
Copied
Ok this makes every page start as a new section, but instead of making it all "1" it needs to be variable. It should be the number that's in a specific field or style on every page.
Feels like we're getting close
Copy link to clipboard
Copied
https://forums.adobe.com/people/Bart+Bossuyt+-+die+Keure wrote
…
Feels like we're getting close
Unfortunately, not so much.
As I explained, InDesign's new export option for individual pages to PDF is not supporting page names.
Regards,
Uwe
Copy link to clipboard
Copied
Actually Uwe, it is. ^p is actually doing what it should, so if i manually give the page that articlenumber then it will use that number in the filename. that works just fine, it's the manually renaming the page to section using the variable number that should be automated.
Copy link to clipboard
Copied
You can use an array and store all the page number that is needed in ascending order,
and call it with index at number's place.
Copy link to clipboard
Copied
problem is that the client doesn't use a particular order for the numbers (no idea why, but that's the way it is).
Copy link to clipboard
Copied
No body can code for client's brain , only you can....
Copy link to clipboard
Copied
https://forums.adobe.com/people/Bart+Bossuyt+-+die+Keure wrote
Actually Uwe, it is. ^p is actually doing what it should, …
Oops. Just checked that. You are right!
Thanks,
Uwe
Copy link to clipboard
Copied
Hi Yada, is there a why you can change the script to do a lookup on the page to find a specific textstyle?
So instead of sec.pageNumberStart = 1; you lookup the style and change the "1" to the content that's marked with that style?
Copy link to clipboard
Copied
Yes, you can do that,
Try this,
var c = 0;
var myStyle = "test";
while(c < app.activeDocument.pages.length){
var found = findMyTextStyle(myStyle, app.activeDocument.pages
); //If found then do//
//else you can choose something else to do//
//you can find character style instead of paragraph style//
if(found==null){
found = "1";
}
var sec = app.activeDocument.sections.add(app.activeDocument.pages
); sec.continueNumbering = false;
sec.pageNumberStart = parseInt(found);
c++;
}
function findMyTextStyle(myStyle, myPage){
var myStyleFound = null;
app.findTextPreferences=app.changeTextPreferences=NothingEnum.nothing;
try{
// You can use paragraph Style Or character style, depending on your need------------------------
app.findTextPreferences.appliedParagraphStyle = myStyle;
//~ app.findTextPreferences.appliedParagraphStyle = myStyle;
var myFoundStyle = app.activeDocument.findText();
app.findTextPreferences=app.changeTextPreferences= NothingEnum.nothing;
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
for(i = 0; i <myFoundStyle.length; i++){
if(myFoundStyle.insertionPoints[0].paragraphs[0].parentTextFrames[0].parentPage.name.toString() == myPage.name.toString()){
//You can do something here//
//Or store your page number start here//
//And return using variable//
myStyleFound = myFoundStyle.contents.toString();
}
}
}
catch(e){}
return myStyleFound;
}
Copy link to clipboard
Copied
Try this code, and if there are any error resolve it while starting number, you are almost there.
Copy link to clipboard
Copied
Updated one.
var c = 0; var myStyle = "test";
while(c < app.activeDocument.pages.length){
var found = findMyTextStyle(myStyle, app.activeDocument.pages
); if(found==null){
found = "1";
}
try{
var sec = app.activeDocument.sections.add(app.activeDocument.pages
); }
catch(e){
var sec = app.activeDocument.pages
.appliedSection; }
sec.continueNumbering = false;
sec.pageNumberStart = parseInt(found);
c++;
}
function findMyTextStyle(myStyle, myPage){
var myStyleFound = null;
app.findTextPreferences=app.changeTextPreferences=NothingEnum.nothing;
try{
app.findTextPreferences.appliedCharacterStyle = myStyle;
var myFoundStyle = app.activeDocument.findText();
app.findTextPreferences=app.changeTextPreferences= NothingEnum.nothing;
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
for(i = 0; i <myFoundStyle.length; i++){
if(myFoundStyle.insertionPoints[0].paragraphs[0].parentTextFrames[0].parentPage.name.toString() == myPage.name.toString()){
myStyleFound = myFoundStyle.contents.toString();
}
}
}
catch(e){}
return myStyleFound;
}
Copy link to clipboard
Copied
Perhaps this may help:
Copy link to clipboard
Copied
Is there a way i can use a textstyle to mark the numbers? and then the pagenummer changes according to that specific Textstyle is some way?
i'm just thinking out loud here
Copy link to clipboard
Copied
Hmm! …
If I understand well, what you mean is to export each page to pdf naming it with a specific "article-number" placed on each page!
Right?
Best,
Michel, for FRIdNGE
Copy link to clipboard
Copied
That is my take as well Michel, which is why I offered exactly that solution in my post #10.
Copy link to clipboard
Copied
Hi Stephen,
Interesting article! … And thanks for the other articles I'll take time to read next WE!
Personally, I'm more direct and, say, maybe less prosaic! …
Based on Grep, the script exports to pdf each page with a found! Of course, the name of the pdf file will be, for this page:
ID-123456-789.pdf
Best,
Michel [not for-free script]