I have a multi page PDF file (let’s assume it has 10 pages). But page numbering does not start with 1, because I printed from DTP application pages 11 to 20. So, my first page in the PDF file is page 11 and so on.
Is it possible to read that value using AppleScript?
A script like this one will give me 1 for first page
tell application “Acrobat 6.0.2 Professional”
get page number of PDF Window 1
end tell
but actually in Acrobat this is page 10.
10 (1 of 15)
I don’t have a copy installed, so I can’t answer, but maybe there’s a first page or page offset property? It sounds like the property you’re getting is the physical rather than logical page.
I checked this out as well and could not find a way to get the page ‘name’ (this is what Quark calls it). The number returned by Acrobat is merely the index of the page…basically how many pages from the front of the document. When you require the same information from Quark (the folio) asking for the page name will return roman numerals if it set to be so, etc. So I’m not totally sure, but it looks like there is no way to get that folio name from Acrobat.
Thank you for your replies!
It looks like we can not do this using AppleScript. My understanding is that Java scripting is more powerfull in Acrobat 6 (compared to AppleScript) so maybe this can be done using Java script…
I just don’t see how you can do this regardless of what language you use. What you are trying to do is akin to asking Acrobat to get the color of the shirt of the guy on the left in the photo on the current page. Maybe I’m wrong, but I think all PDF’s start on page 1, regardless of what page range you saved. I am not aware of any application that allows you to export a PDF that starts on any page other than 1.
But, as is usually the case, there is more than one way to peel a potato.
If your pagination is more than just numerical, say if at the bottom of each page it said “Page:4” - perhaps you could search for that on each page and get the number.
Maybe you could include the page range in your naming convention and follow that. e.g. - your file name “Henderson_Job_11_20.pdf” would let you know that this document contains pages 11 thru 20 of your original DTP doc.
Or, maybe you don’t need to get original page number at all? Is it really necessary - or more importantly - what do you want to use it for? Could there be another means to the end?
If Acrobat is displaing at the bottom of a window 10 (1 of 15) for page 1; 11(2 of 15) for page 2, and you can copy-paste this info, there HAS to be a way to read this!
What is causing my problem: when printing from Indesign, if you want to print pages 10 to 24 of your document and create a PDF file; you will have one file that has ALL 15 pages inside. What i really need is 15 single page PDF files (this is a requirement from the printer). I have a script that will break the multi-page PDF file into single page PDFs, but the numbering starts from 1. Based on that info i can not read from Acrobat, I’d like to rename the single page PDFs using the REAL page number.
To give you an example: let’s assume my Indesign file name is “MyPublication”. The name of the PDF file will be MyPublication.pdf (it makes sense ). After I’m running the AppleScript i will have 15 single page PDFs named: MyPublication_01.pdf, MyPublication_02.pdf and so on. What I’d like to have is MyPublication_10.pdf…MyPublication_24.pdf
It is very easy just to ask the operator for starting page number, but I was hoping that i can fully automate the process…
I don’t have that version of Acrobat and cannot test that for you.
But, I’m glad you posted more about your situation.
Instead of printing page ranges and splitting the pdf up, perhaps you could export individual pages to pdf.
In other words, you can dynamically set up your pdf output options to only export the page you are on - and since you’ll know what page you are on, you can name your pdf as such.
As much as I enjoy writing scripts, I have come to accept that sometimes there are better solutions. In your case, I think you should check out PDFpen by SmileOnMyMac. I had this same problem earlier this year and I think this product will solve your problem. Its only $30 (US) and Applescriptable. I came to the conclusion that my employer was going to pay me way more than $30 to try to home-grow a solution. Hope this helps
Then, instead of exporting page ranges - export each page individually. Now, I don’t know the makeup of your original document, how feasible this is depends heavily on the complexity of your document.
But, this works for me in ID2.0.2 under Panther and is a good example of how to export individual pages. How you decide to communicate which pages to export is totally up to you - you can hardwire them into properties, or enter them in a prompt.
--path to a file I am using for testing
property strFile : (path to the desktop) & "exporttest" as string
--path to a folder I'll output the pdf's to
property strDest : (path to the desktop) & "pdf:" as string
--start export on this page
property intStart : 1
--end on this page
property intEnd : 2
tell application "InDesign 2.0.2"
set thisDoc to open file strFile
--get the name of the document to use in the pdf
set docName to the name of thisDoc
--in this example I set properties for start and end pages for the export
--you could do this any number of ways besides hard coding - like prompting the user
--enable the lines below if you want to prompt for a start and end
--set intStart to text returned of (display dialog "Start on which page?" default answer "")
--set intEnd to text returned of (display dialog "Stop on which page?" default answer "")
repeat with eachPage from intStart to intEnd by 1
--set the page range for the export to the page we are on
set page range of PDF export preferences to name of page eachPage of thisDoc
--build the path to what will be the pdf
set thisPDFPath to strDest & docName & "_" & (eachPage as string) & ".pdf" as string
--export the pdf
export thisDoc format PDF type to file thisPDFPath without showing options
end repeat
end tell
There have been times where I realized it just made more sense to break down and buy something - but, I get the feeling you are totally capable of this and want to do it yourself.