Extract PDF pages with it's actual page numbers...

Hi scripting gurus,
We have more than 40 of PDF documents each document contain multiple pages. Using Acrobat Professional 7.0 and 8.0 with MAC platform. We have the script to extract the pages and to suffix running numbers with the document name, please find the script below. For example CH01.pdf document total number of pages is 10, but the actual page number starts with 11. So We have to extract each pages as individual documents and the page number will followed by document name with "_" separation, (Eg: CH01_11.pdf). I have tried so many ways to include the page numbers with the document name but i can't.
/*Split pdf pages with pNum suffixed*/
var rename = /.*\/|\.pdf$/ig;
var startName = this.path.replace(rename,"");
for (var i = 1, j = 0; j < numPages; i += 1, j += 1) {
extractPages ({
nStart : j,
nEnd : j == numPages - 1 ? j : j + 0,
cPath : "/Macintosh HD/Users/Beaconpmg/Desktop/ExtractFolder/"+startName+"_"+i+".pdf"
So please can anyone look into this and help for me.
Thanks in advance.
Regards
Thiyagu

try67
First of all, replace numPages with this.numPages
Also, this doesn't make any sense:
nEnd : i == numPages - 1
I have tried what you have said above, but it is not working. Its showing the same error (missing ; before statement)in 4th line of the script.
Please find the complete code below;
// see if we need to define a global offset first file
if(global.fPageOffset == undefined) {
var global.fPageOffset = 10; // start at 10
/*Split pdf pages with pNum suffixed*/
var rename = /.*\/|\.pdf$/ig;
var startName = this.path.replace(rename,"");
for (var i = 0; i < this.numPages; i++) { this.extractPages ({ nStart : i, nEnd : i == this.numPages - 1 , cPath : "/Macintosh HD/Users/Beaconpmg/Desktop/ExtractFolder/" + startName + "_" + (i + global.PageOffset) + ".pdf" }); }
// add finished file's number of pages to global page offest
global.fPageOffest += this.numPages;
Regards
Thiyagu

Similar Messages

  • Merging PDF / Page Numbers / Acrobat SDK V9  & LiveCycle

    Hello everyone,
    I use Adobe LiveCycle to create forms, Visual Studio 2005 and the Acrobat SDK for the application I'm programming to fill in these forms. The application fills in the forms and merges them with no issues.
    The problem I have is that these pages have page numbers in the upper right. I use the Page N of M object on these forms in LiveCycle. PDF page numbers are filled in correctly when filling in the forms, but when I merge PDFs, the pages keep their original page numbers. I've looked at the Windows - Interapplication Communications even using templates to no avail.
    How can I merge these pdf's and have my program renumber these pages correctly and how can insert pages anywhere I want in the merge document?
    Below is the code I use to merge the PDF's. It was posted in a forum.
    Sub MergePDF(ByVal ThePath As String, ByVal outFileName As String)
    On Error GoTo serror
    Dim dPDDocMerge As New Acrobat.AcroPDDoc
    Dim dPDDoc As New Acrobat.AcroPDDoc
    Dim strFiles() As String
    Dim numPage As Integer
    Dim TotalPage As Integer
    Dim objThisFile As IO.FileInfo 'get FileInfo object for file string
    strFiles = System.IO.Directory.GetFiles(ThePath) ' Read in the file names
    Dim b As Boolean ' mostly for testing purposes... could use it for error 'checking to make sure that a file is really added before deleleting it...
    For i As Integer = 0 To strFiles.Length - 1 ' run through all the files in 'the directory
    objThisFile = New IO.FileInfo(strFiles(i)) ' Get the extension
    If objThisFile.Extension = ".pdf" Then ' Only add in PDFs
    If dPDDocMerge.GetFileName = "" Then ' check if it's the first file
    dPDDocMerge = New Acrobat.AcroPDDoc
    b = dPDDocMerge.Open(strFiles(i)) ' open first file
    TotalPage = dPDDocMerge.GetNumPages
    Else
    dPDDoc = New Acrobat.AcroPDDoc
    b = dPDDoc.Open(strFiles(i)) ' open other files
    numPage = dPDDocMerge.GetNumPages ' get the page count
    TotalPage += numPage
    b = dPDDocMerge.InsertPages(numPage - 1, dPDDoc, 0, dPDDoc.GetNumPages, _ False) ' Insert
    End If
    End If
    Next
    'b = dPDDocMerge.Save(1, ThePath & "\" & outFileName) ' save file
    b = dPDDocMerge.Save(1, ThePath & "\" & "\MyTest.PDF") ' save file
    b = dPDDocMerge.Close()
    Exit Sub
    serror:
    MsgBox(ErrorToString)
    End Sub
    Thanks for any code or advice.

    You can't merge LiveCycle forms this way :(. LC forms are NOT standard PDF files and can't be processed in the same way.

  • RoboHELP to PDF Page numbering issue

    HI,
    I am experiencing a problem related to page numbers in the pdf generated through the RoboHELP source files. Hereby I am giving some images of the initial pages of the PDF, in which I have clearly explained the issue. I have removed the content and images related to our project. Please let me know, how I can overcome this issue.
    NOTE: The page numbering issue was not there earlier.  I have imported two frame maker files. Then I was not able to generate a PDF. That particular FM file had a table. Read in the Adobe forum that some type of tables may affect the generation of PDF. Hence, I have deleted the FM files. Since then I am facing the page numbering issue.
    Here are the images with my explanation of the issue:
    The following is an image of the pdf. This is actually the fourth page of the pdf, but it is numbered as xiv.
    The next pae is numbered as xv. Again the numbering reverted back to xiv as shown in the following iamge.
    Immeditely after the TOC, the 1st page is numbered as 115.
    Again every 1st page of a chapter is starting as page number 115
    The 2nd page of every chapter is numbered as 126.
    The 3rd page of every chapter is numbered as 125.
    The fourth page again numbered as 126 followed by 125, which is continuing till end of the chapter.
    Please let me know how this issue can be solved.

    I am not sure what is causing this but can suggest a workaround. Instead of publishing direct to PDF, create a Word document only. That may have page numbering issues but there you should be able to correct them. Then publish your PDF from Word.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Reader 11 pdf page numbers printing too high

    After I upgraded to Adobe Reader 11, I have started having issues with page numbers on my pdf forms printing too high on the page. Instead of printing at the bottom of the page, they jump up to wherever the text on the page stops. For instance, if the text stops half way down the page, the page number prints one line beneath that text, so it's in the middle of the page instead of the bottom corner. The file looks fine on the screen, and if I print it in Reader 10 on another computer, it prints at the bottom of the page where it belongs. I've compared settings between my computer, and the computer where the file prints correctly, and I can't find any settings that are different. Has anyone else had this problem? And if so, suggestions for a solution?

    looking again, it prints badly in Chrome, Safari, pdf, preview but NOT Firefox.
    And, I was wrong about Gmail. it prints wrong from gmail, too.

  • Word to PDF - Page Numbering Problems

    When I use the combine files tool in Acrobat 8 for PDFing word documents instead of the page numbering being 1/3, 2/3, 3/3, it comes out as 1/1, 2/2, 3/3. I've tried looking at all the settings and cant find a logical reason for this. It also happens when I print to PDF while in Word.
    Has anyone else experienced this same problem?

    Here are a couple links that should help.
    http://www.mvps.org/word/FAQs/AppErrors/PageXofY.htm and
    http://www.mvps.org/word/FAQs/Numbering/PageNumbering.htm
    Regards,
    Dave

  • Inserting & Extracting PDF Pages

    How do I insert or extract pages in Acrobat 9 if I created the form using LiveCycle Designer ES?
    I can't remove the documents restrictions. Please help, I have clue, thanks

    Hi,
    When you create a form in LC Designer, it the XFA form so that Acrobat/Reader can open and interact with the form. However this XFA form is completely different from a form developed in Acrobat (AcroForm) or any other standard/flat PDF.
    When you open an XFA form in Acrobat you cannot do some of the standard Acrobat functions. This isn't a hidden restriction that you can turn off - it is juat the way it is.
    So in Acrobat you cannot insert pages into the XFA form, using the Document / Insert pages menu. However you can develop a button on your form in LC designer, to insert a page at runtime.
    In relation to exporting a page from your XFA form, you can use the File / Export menu to export to an image file (eg JPEG). In addition you can print the form to PDF using Acrobat.
    In summary:
    Extract - either export to JPEG and deal with the image files OR print form to PDF.
    Good luck,
    Niall 

  • Acrobat 8.1 - PDF page numbers different to MS-Word

    Hello
    I have a 120 page MS Word (ver 2003) document. When I convert it to a PDF using Acrobat 8.1, I get a document which is 114 pages. According to Tech Support doc 329296 ("Text reflows into more or fewer pages when you convert a file to PDF") I need to make the PDF writer the default printer.
    Although this solves the issue, I use another printer as my default. Is it not possible to get the PDF output to match the Word file without having to substitute default printers?
    Thanks.
    Farrukh Hyder

    There is no Writer anymore, it went away after AA5. However, WORD would do something similar with Writer also. WORD is the issue here, not Acrobat. WORD ALWAYS reflows the document to best match the selected printer. Frame Maker and other layout programs do not do this reflow and that is why Mike recommended Publisher.
    I understand there is an option in WORD to have it not do the reflow (though that may give a less that desired output). Unfortunately I can not find it in WORD 2007, so I might be wrong.
    This feature is characteristic of most work processors. To avoid it, companies developed layout programs such as FM and Pub.
    To set up your document, go to the print menu and select the Adobe PDF printer. Then go back through your document and adjust the pages and such. That should give you a PDF result that is consistent with what you see.

  • Page numbers in PDF?

    I cannot figure out how to identify the page numbers of a PDF document when I view it in Safari 5.0.3. The original paper document has its own numbering system, but the PDF page-numbers are completely different. When I go to print individual pages of the PDF document, I don't know what page numbers to put into the printer window.
    I asked the publisher of the PDF document for advice. This is what it advised:
    "This is an issue with printing PDFs (Portable Document Files) in general, and does not pertain exclusively to printing PDFs in FDsys. When printing a PDF document in your web browser, the web browser is printing the pages of the electronic file (the PDF) not the page numbers that appear on the original publication (from which the PDF is derived). The page numbers of a PDF document do not always match the page numbers appearing on the publication itself. For example, in the example you cited (http://www.gpo.gov:80/fdsys/pkg/USCODE-2009-title26/pdf/USCODE-2009-title26-subt itleA.pdf), the page number on the publication is page 347. However, if you click anywhere in that page, you will see that the PDF reader you are using indicates the corresponding page in the PDF file in the toolbar at the top of the page (next to the up/down arrow icons). The page number indicated in the toolbar refers to the page numbers in the PDF file, and it is these page numbers that your browser is referring to during the printing process."
    None of those instructions work in Safari. How do I find the page numbers for a PDF document in Safari?

    Hi Richard
    the best bet is to open it in Preview using the relevant button that appears when you hover at the bottom of a pdf in safari. Although the page numbers that appear on each page still won't necessarily match, you can at least make preview show the 'pdf' numbers in the toolbar, which will match those you choose when printing.
    a plugin like adobe's or http://schubert-it.com/pluginpdf/ may show page numbers within Safari, but that doesn't mean they'll match those which appear on the pages, in the example link you gave, and others.

  • What is correct way to make a PDF reader, read the page numbering? (for accesibility in indesign 5.5

    What I have to do to make the reader read pdfs page numbering is in the page layout in InDesign CS5.5?
    I read that unlinking the numbering of the page layout and then including it in panel articles with the other elements. Is it true?
    Is this the way?
    thanks

    But page numbers do defenitively not belong to the text structure, neither do running headers and footers. As far as I understand these items are disturbing when reading pages.
    I am not blind and neither peronally I don't know any. But I suppose there are other means as reading marks for them as page numbers.

  • Is it possible to extract a PDF file into separate ones but using a specific file name that comes from the PDF page?

    Hello,
    I am unsure if this is possible but its worth asking.
    I have a PDF document that contains 56 pages.
    Each page has an 'Agreement Number' at the top left.
    I have managed to successfully extract the pages into separate documents (56 documents) but they are all named the same but page 1, page 2, page 3 etc..
    What i am trying to do is use these 'agreement numbers' in the extraction process so when they save i have 56 different files but they show the agreement number in the file name.
    i have looked into changing the actual page numbers on the page thumbnails to see if you can do it that was to no avail.
    any help would be much appreciated, or tell me i cant do it, at least i know ill be defeated.
    PS i have around 6 or 7 PDF files with 50+ pages so its a long boring task if i need to go and rename all these.
    Cheers
    Jez

    It would be possible in theory to do it with a folder-level script, provided the string you need is in exactly the same structural position on each page. You would use the doc.getPageNthWord() function to collect the string you want, then the doc.extractPages() function to save each page to a file.
    See the Acrobat SDK documentation for help with scripting. http://bit.ly/AXISDKH

  • How to determine the page count of the front document (pdf-Preview) with applescript?

    Hello, I'm a beinnger apple scripter, and I have 2 questions. First, im trying to find the code to generate a page count for the front document of preview. I tried something like this:
    choose file with prompt "Count the number of pages in this PDF file:" without invisibles
    do shell script "/usr/bin/mdls -name kMDItemNumberOfPages " & quoted form of POSIX path of result & " | /usr/bin/grep -o '[0-9]\\+$'"
    But I dont want to have to choose a file with the prompt, and Im not sure how to get the path or POSIX path of an open pdf that is the front document in prievew to then use that directory to select the file to run the shell script on. This is one step in a much larger sequence of automator/apple script commands for large print jobs.
    The large scale view is:
    1. seleting a group .musx Finale 2014 files and creating pdfs of all the documents
         -Achieved with Automator stuff: [Get selected finder items] [open finder items with Finale 2014] [run applescript to convert to pdf all the open files] (which I have working but without a proper repeat condition)
    2. sorting those those exports into even/odd groups
    3. making the even pages 2 up with a create booklet plugin
    3. combinging even/odd group pdfs in their respective folders
    4. sending the 2 up evens to 1 printer, and the singes to another printer.
    but at this stage in the code/automator this is what i'll need to be doing:
    1. Several pdf documents will be open and I need to determine the page count of the front document.
    2. With that result I need to determine if the pagecount is even or odd.
    3. If its even, I need to save as pdf in a file folder /desktop/PDF Export/Doubles
         - if its odd, I need to save as pdf pages from 1 to (pageCount -1) to /desktop/PDF Export/Doubles, and pages (pageCount) to (pageCount) to desktop/PDF Export/Singles. (example: A 5 page pdf will send pages 1-4 to folder "Doubles", and pages from 5 to 5 to Singles, A 1 page pdf will only send a copy to the folder "Singles." A 2 page pdf will send both pages to "doubles"
    4. once the even/odd pages have had pdfs made in the either or both of the folders, Im going to close the document and repeat for all other open pdfs.
    Which also brings me to my 2nd repeat condition question: how can I repeat (print, save as pdf, close) commands for open files and end the script once all files are closed? This can help me both at this stage, as well the coding stage before in creating the pdfs from open Finale/sibelius .sib/.musx files
    would it be something like this?:
    If front document exists
    try
    tell application "preview"
    <bla bla>
    end try
    end tell
    At stage 1 of the large scale i've gotten the files to export pdfs and close multiple files, but if i say "repeat 4 times" and i have 3 files it can do those commands but it gets stuck trying to repeat the code one more time. I need the repeat amount x to be the # of items in selection from the the original finder window.
    Thanks for the help!

    The following AppleScript will get the POSIX path and filename of the current PDF file. It will just return the integer value for page count. Note: The path retrieved is the actual path to the PDF file, unless it is on the Desktop. In the latter case, the path will be ~/Library/Containers/com.apple.Preview/Data/Desktop/filename.pdf.
    The script assumes that the following folders exist, otherwise you will need a try block to test for their presence.
    The AppleScript dictionary for Preview does not provide a page dictionary entry, that would make a repeat loop and page range possible for saving individual page ranges.
    set pdfDoubles to POSIX path of ((path to desktop) & "PDF Export" & Doubles)
    set pdfSingles to POSIX path of ((path to desktop) & "PDF Export" & Singles)
    tell application "Preview"
      -- gets quoted POSIX path and filename
              set pdfFile to (get path of front document)
              set pdfName to (get name of front document)
      log pdfName
              set cmdArg to "/usr/bin/mdls -name kMDItemNumberOfPages " & pdfFile ¬
                        & " | egrep -o \"(\\d+)\""
              set pageCnt to do shell script cmdArg
      display dialog pageCnt
              if pageCnt mod 2 is 0 then
      -- even
      -- save pdfName in pdfDoubles
              else
      -- save pdfName in pdfDoubles
      -- save individual pages in pdfSingles
              end if
    end tell

  • Cannot attach a pdf after extracting a page in Acrobat X Pro

    I have a user that wants to extract one page from a multi page pdf and then e-mail it.  He performs these steps - >
    Tools - Extract - Share - The file is not showing up in the Select Any Type of File box and the Attach to Email bubble is filled in.
    He aslo has Adobe Reader XI installed and is using Windows XP.
    Any ideas?

    Hopefully Adobe Reader is not being used to attempt this as it cannot do it.
    Now if Acrobat XI Pro is used the "click" path is Tools | Pages | Extract which will present the "Extract Pages" dialog.
    Note that there is no "share" associated with this.
    The "Extract Pages" dialog affords the user the ability to select the "from" and "to" pages, the ability to tick "Delete Pages After Extracting" and the ability to tick "Extract Pages As Separate Files".
    A similar dialog / end-user choices for Acrobat X Pro, the flavors of Acrobat 9 Pro and 8 Pro.
    It appears that some other process is in play. Could you identify it please.
    Be well...

  • How to extract specific pages from a PDF

    Hello. I'm using Windows XP Pro on a custom PC with Adobe Acrobat 8.0. I work for a small magazine (abqarts.com) that publishes its online version in PDF format which is created by our production dept. I need to extract specific pages from the magazien as PDFs to send to a client. Tried to look up how in the Help file but I think the termonology is defeating me.
    I can load the magazine's PDF into Acrobat, but can't manage to save, print or export two pages and the cover as individual PDF files. I'd sure appreciate some help.
    Thanks,
    Peggy

    Graffiti, thanks for your quick response! When you say "open the pages view" that's the drop-down View menu, right? Then I select Page Display but don't know which one to chose after that. Single, two-up etc.
    And Control>click on a page selects an image on that page--not the entire page, which is what I want.
    That said, I'm way happy you pointed out Document>Extract Pages. That works great for me, one page at a time. Maybe I don't need the other things clarified because I can use this one, but I'd like to get working all the tips you provided.
    Gratefully,
    Peggy

  • PDF Page Extraction issue

    Hi all,
    i have  single pdf file with many pages, on that i cannot able to extract some pdf pages on the file, we receiving error
    "There was as problem reading this document (15)"
    Please help me how to find the error without using acrobat. If any error code is present in the pdf file data to get.
    Please help me to solve the issue.
    Regards,
    JayaKrishnan

    Thanks for your reply on helping this issue
    Please tell the option in acrobat to validate the document on this exact error.
    And also help me to find the error without opening the pdf file through acrobat.
    Thanks Regards,
    JayaKrishnan

  • Large pdf(40MB) with 600 pages color quality is poor if i print more than 1 or 2 pages at a time.

    I have a 40MB PDF file with over 600 pages of color images. If i print each page one at a time, there is no issue whatsoever with the quality, but if i print say 5 pages, the 4th and 5th page and any subsequent page will look like rubbish. In general, just not the same color quality as before. The Konica Minolta printer doesn't seem to be at fault here because like i mentioned, this problem does not occur if i print individual sheets, just if i print more than 5 or so.
    Printing individual sheets in this instance, however, is not a real solution because in all the job will have many thousand pages. What do i do? Any one here experience a similar problem?

    You were able to catch me whilst my Konica Minolta tech was here.
    This is my take on his diagnosis,
    The c353 while capable of quality output is not exactly a robust production level machine.
    Without the aid of a RIP, all the processing needs to happen either in memory or it may have a hdd. Does the machine have a hard drive?
    In either case, you are running out of memory.
    Changing the printers properties on spooling may aid in completing the job.
    He mentioned sending the job as raster. Print as Image from Acrobat's Advanced tab would do that, but I think you would cripple your computer doing such. Try it; be prepared to go out to lunch or something while it churns away.
    hth

Maybe you are looking for

  • How can I set this text in a JformattedTextField ?

    Hi, I have a JFormattedTextField with this mask "#####-###" When I'm typing It works very fine, but when I call the setText( "12345") It doesn't work, it clears the field. If I call setText( "12345-123" ) It work very fine. when I don't have all the

  • Asynchronous XI- RFC and RFC- XI scenario - strange problem

    Hello XI-Xperts, I've come to really strange problem, which I would like to share with you and possibly get an explanation. I have an asynchronous scenario with ending XI->RFC. The RFC function in R/3 has got an optional parameter called SENDER, whic

  • How to parse an PL/SQL type to XML format in ORACLE8

    I've got a PL/SQL type ( table/records/...) and I want to set it to XML format : I've got TYPE return_row IS record ( value_1 NUMBER(2), value_2 VARCHAR2(30)); TYPE return_test IS TABLE OF return_row INDEX BY BINARY_INTEGER; VARCHAR2 XMLformat; And I

  • Macbook as a present

    Hi I'm looking at buying my other half a macbook for her birthday. She works in Advertising and I know she uses a mac at work daily. I on the other hand no nothing about macs and want to know if buying a macbook over a macbook pro would be a false ec

  • Develop Mode - colors gone from tools

    (lightroom 4) So I just updated my mac and now my lightroom controls have changed.  The tone/tint sliders and also the vibrance/saturation/hue sliders are missing the color.  Any idea what I can do change it back?  I have uninstalled and reinstalled.