Changing pagelabels
Changing pagelabels
I have a PDF containing 56 pages. I need to change the page labels for the pages 1-9 into 01, 02, 03 etc.
I have made this simple action that (is supposed to) select the page range 1-9 and add the change the page labels by adding 0 as a prefix.
But I can't get this to work. The selection of pages seems to have no effect. If I only do the "Change page labels" it works fine but obviously add a 0 to all page labels.
I have also tried to choose "Select pages with a page label in the list:" and add the numbers 1-9 to the list, but it makes no difference.
Am I missing something, or is this a bug?
PS: The reason for changing the pagelabels is that in Switch I need to split the PDF into single pages and add the page number as a suffix. If I use [Index] the suffix on all pages is two digets, but if I use [Label] the first nine pages are only one digit
I have made this simple action that (is supposed to) select the page range 1-9 and add the change the page labels by adding 0 as a prefix.
But I can't get this to work. The selection of pages seems to have no effect. If I only do the "Change page labels" it works fine but obviously add a 0 to all page labels.
I have also tried to choose "Select pages with a page label in the list:" and add the numbers 1-9 to the list, but it makes no difference.
Am I missing something, or is this a bug?
PS: The reason for changing the pagelabels is that in Switch I need to split the PDF into single pages and add the page number as a suffix. If I use [Index] the suffix on all pages is two digets, but if I use [Label] the first nine pages are only one digit
- JimmyHartington
- Advanced member
- Posts: 316
- Joined: Tue Mar 22, 2011 7:38 am
Re: Changing pagelabels
Could you do a regex rename on the filename in Switch?
Something like:
Search for: _(\d).pdf
Replace with: _0\1.pdf
Something like:
Search for: _(\d).pdf
Replace with: _0\1.pdf
Re: Changing pagelabels
I tried that but the problem is that the file names contains several underscores followed by numbers and you can’t use regex look back in Switch.
Re: Changing pagelabels
I do not understand the problem. If you use [Index] the suffix on all pages is two digits, but it seems to me that that is what you want. What is the reason for wanting to use [Label]?
The reason why your Action List does not work is that you are selecting pages based on their labels, but I am 100% certain that the pages of your input file do not have labels so the pages do not get selected and nothing happens. You should use "Select pages" instead.
The reason why your Action List does not work is that you are selecting pages based on their labels, but I am 100% certain that the pages of your input file do not have labels so the pages do not get selected and nothing happens. You should use "Select pages" instead.
- JimmyHartington
- Advanced member
- Posts: 316
- Joined: Tue Mar 22, 2011 7:38 am
Re: Changing pagelabels
But if the search includes the extension, then we find only the end of the filename, where there is an underscore, a digit and then .pdf.
Re: Changing pagelabels
@Jimmy. Almost The search part seems to work fine, but using the replace part in "Search and replace" in the Rename element in Switch, seems to just remove the part of the filename?
@Freddy. The reason for using [Label] rather than [Index] is that at a certain time in the process, the PDF doesn't contain all pages. So the PDF for a 56 page magazine may only have 30 of the pages, but they all have the correct page label and the single PDF's need to be named with that page label as a suffix.- JimmyHartington
- Advanced member
- Posts: 316
- Joined: Tue Mar 22, 2011 7:38 am
Re: Changing pagelabels
I made an error. Different programs targets the search groups different. Sometimes $1 is the convention, but in Switch I found out it is \1.
So search for: _(\d)\.pdf
Replace with: _0\1.pdf
as regex.
Last edited by JimmyHartington on Thu Mar 30, 2023 10:32 am, edited 1 time in total.
Re: Changing pagelabels
That works perfect, Jimmy! Thank you (and we all make mistakes from time to time )
Re: Changing pagelabels
Well, I got the problem solved with a workaround in Switch but that brings me back to the initial problem with the PitStop action, which seems to be a PDF issue.
If I create a simple two page document in InDesign and export that to at PDF having page 1 and 2, the action will not do anything. If I create a similar document in InDesign but with the pages 9 and 10, the action works just fine (labels become 09 and 10).
If I open the PDF with page 1 and 2 in Acrobat, duplicate page 1, make a section start at page 2 but starting with the number 1 (I now have a 3-page PDF with two pages labeled 1 and one page labeled 2) then the action will work fine and relabel all three pages to 01, 01 and 02.
In other words it seems like a PDF only has page label information if a section has been defined?
If I create a simple two page document in InDesign and export that to at PDF having page 1 and 2, the action will not do anything. If I create a similar document in InDesign but with the pages 9 and 10, the action works just fine (labels become 09 and 10).
If I open the PDF with page 1 and 2 in Acrobat, duplicate page 1, make a section start at page 2 but starting with the number 1 (I now have a 3-page PDF with two pages labeled 1 and one page labeled 2) then the action will work fine and relabel all three pages to 01, 01 and 02.
In other words it seems like a PDF only has page label information if a section has been defined?
- JimmyHartington
- Advanced member
- Posts: 316
- Joined: Tue Mar 22, 2011 7:38 am
Re: Changing pagelabels
Can you send me your test-files? The pdftk utility can dump the data from a pdf. Perhaps I can see something with it.
Re: Changing pagelabels
A PDF only has page label information if the producer of the PDF adds page label information. What Indesign is doing is to apply the following (understandable) logic: if the document contains consecutive pages from 1 to some number there is no need to add page labels to the PDF because the page labels would be the same as the index numbers. However, if you create an Indesign document starting with page 9 (page i, page A-1, ...) then the logic is: the page numbers are different from the index, let us add those page numbers as labels in the PDF. So, it is not necessarily related to the use of a section, it is enough that the page "names" are different from their indices.Terkelsen wrote: ↑Wed Mar 29, 2023 3:11 pm If I create a simple two page document in InDesign and export that to at PDF having page 1 and 2, the action will not do anything. If I create a similar document in InDesign but with the pages 9 and 10, the action works just fine (labels become 09 and 10).
...
In other words it seems like a PDF only has page label information if a section has been defined?
Other producers (Quark, Word, Canva, ...) may handle this differently (I have not checked). Do they support the use of page labels natively? If not, they will probably not add page labels, although theoretically they could. If so, it should be considered a bug if they did not define page labels.
By the way, you have not reacted to my question why you want to use the page labels because using the index in the output name will give you what you want if I understood your initial problem statement correctly.
Last edited by freddyp on Thu Mar 30, 2023 9:17 am, edited 1 time in total.
Reason: Forgot something
Reason: Forgot something
- JimmyHartington
- Advanced member
- Posts: 316
- Joined: Tue Mar 22, 2011 7:38 am
Re: Changing pagelabels
This seems correct.
I used pdftk to dump all data of a file without and with page labels.
Code: Select all
pdftk test-file.pdf dump_data
@erik So if you need to sort in Switch maybe you could use pdftk to get this information.
Re: Changing pagelabels
@Jimmy. Thank you. Thats proves what Freddy just wrote.
@Freddy. Thank you for the explanation. That however, leaves me with another question How is the Split PDF element in Switch then able to ad the page label as a suffix to the file name using [Label], even when the PDF doesn't contain page labels
...and I did actually answer your question in an earlier post:
@Freddy. Thank you for the explanation. That however, leaves me with another question How is the Split PDF element in Switch then able to ad the page label as a suffix to the file name using [Label], even when the PDF doesn't contain page labels
...and I did actually answer your question in an earlier post:
@Freddy. The reason for using [Label] rather than [Index] is that at a certain time in the process, the PDF doesn't contain all pages. So the PDF for a 56 page magazine may only have 30 of the pages, but they all have the correct page label and the single PDF's need to be named with that page label as a suffix.
Re: Changing pagelabels
Sorry, I missed that. That indeed explains the need to use [Label]. It is also logical that page labels do not get leading zeroes because a page label is a string: "First page", "Second page", ..., "Last page" are valid page labels and you can see that adding leading zeroes there does not really make sense....and I did actually answer your question in an earlier post:
When there are no page labels then the page label defaults to the index number of the page.