Insert pages from a single document multiple times

I'm trying to create a simple program that I can use to display PDF files that I can use to play at the piano. I perform often, and need to create "play lists" from which I can pull all, or part of, a PDF file containing music and display it.
I have it all working, except for one problem. I may need to "repeat" a section of a piece. I'm building up the play list by calling AcroPDDoc.InsertPages for each item in the play list. If a PDF file appears multiple times in the play list, when I call InsertPages, the call fails.
In this code snippet, pdDoc is the main doc to which I'm adding pages. playList is a generic List of my own PlayList objects, and I need to iterate through all the items in the playList except the first one, which is already loaded.
This code works great unless the fileName I specify has already been opened. The call to AcroPDDoc.Open succeeds just fine, but the call to pdDoc.InsertPages fails if the file has already had pages from it inserted. All other documents work fine. The documentation, of course, doesn't mention this.
        int insertPage = pdDoc.GetNumPages() - 1;
        for (int i = 1; i < playList.Count; i++)
          var newDoc = new AcroPDDoc();
          var item = playList(i);
          int startPage = 0;
          int endPage = 0;
          if (newDoc.Open(item.fileName))
            startPage = Math.Max(0, item.startPage);
            endPage = Math.Max(0, item.endPage);
            var totalPages = newDoc.GetNumPages;
            if (item.endPage < 0 || item.endPage > totalPages)
              endPage = totalPages - 1;
            int numPages = (endPage - startPage) + 1;
            if (pdDoc.InsertPages(insertPage, newDoc, startPage, numPages, 0))
              insertPage += numPages;
So, the questions:
1.) Is it possible to load pages from a single document multiple times?
2.) Is there a better way to do this? (That is, loop through a list of file names, starting and ending page numbers, and add the documents to an existing document.)
Any help appreciated! Thanks -- Ken

Hi Ken,
>The documentation, of course, doesn't mention this.
The documentation does not state explicitly that you can't insert pages again from a PDDoc you open again and never close.
But it mentions that you get references only from an already opened PDDoc.
"...Opens the specified document. If the document is already open, it returns a reference to the already opened PDDoc. You must call PDDocClose() once for every successful open..."
It doesn't state that you can't insert pages from a referenced PDDoc but it seems so.
I would close the PDDoc within your for-loop after inserting pages and release newDoc.
Regards
Norbert

Similar Messages

  • E-mail a Single Page from a PDF document.

    How do you e-mail a single page from a PDF document that has multiple pages? When I go to File > Attach E-mail in Adobe it e-mails the whole document and I do not want that. I just want to e-mail selected pages and not the whole document. How can I do that in Adobe Acrobat?
    I have Adobe Acrobat Standard version 8, Windows XP Professional SP3.

    You need to extract it first as a new PDF. You can do so using Document - Extract pages...

  • Is it possible to have multiple page layout in single document?

    HI all,
    I am having a pdf document which contains 10 pages. I want to make the first three pages in Landscape layout and the remaining 7 pages in Portrait, is it possible?
    Thanks in advance
    Sreejesh K V

    Sreejesh K V wrote:
    HI all,
    I am having a pdf document which contains 10 pages. I want to make the first three pages in Landscape layout and the remaining 7 pages in Portrait, is it possible?
    Thanks in advance
    Sreejesh K V
    Sure. Print the first threee pages to PDF in landscape, the remaining seven in portrait, then combine them in Acrobat either by opening the first and inserting pages from the second or by using File>Create PDF>From multiple files.

  • Best way to insert pages from a document to another

    Hi everybody,
    I need to append/insert pages from a InDesign CS4 document to another one with all the content that may be present in page.
    What is the best way to implement that? I didn't find anything similar to kAddDocToBookCmdBoss.
    The optimum would be to have something like kAddPageToDocCmdBoss for better granularity.
    Thanks a lot in advance to anybody who will express his opinion.
    Luca Severini

    The Pages panel flyout menu has a "Move Pages..." action / dialog.
    It fires off several commands:
    kCreatePageFromPageCmdBoss
    cmd target is the target document
    UIDList is the source kSpreadBoss.
    IID_ILAYOUTCMDDATA document is the target doc again.
    followed by kMoveSpreadCmdBoss and kShufflePagesCmdBoss.
    Dirk

  • Is there a way to combine multiple pages into a single document?

    In the program "Pages," is there a way to combine multiple pages in a single document?

    Jean Louis Gassee, who used to be a senior Apple executive, wrote on Apple's bad approach to the latest iWork suite:
    https://discussions.apple.com/message/25209121#25209121
    Peter

  • Inserting pages before pg 1, document then opens to old page 1 (XI Pro)

    Dear Support Team,
    I am baffled.  I use Adobe Acrobat XI Pro 11.0.2.  Here is the scenario that is driving me crazy:
    I open a multi-page pdf document (titled Report).
    I then view the thumbnails of that document.
    I find another pdf document (titled Charts) and drag it unopened from my desktop and place it before the thumbnail of the first page of my opened document (Reports).
    All seems well, all pages of the Charts pdf were inserted before the first page of the Reports pdf and are showing correctly in thumbnail view.
    However, if I close the pdf and reopen it, it will automatically open to the old first page (what used to be the first page of Reports), let's say page 5.
    So, I have to go to the file properties and change the "open to page 5" and make it say "open to page 1"
    This happens every time I insert a pdf document or even just a pdf page from another document before page 1 in my open document.
    It's like Acrobat keeps making the document open to the old page 1 no matter how many pages I insert before the old page 1.
    I just want to insert pages and have it open to the new page 1 without having to go to the file properties menu every time.
    Can anyone help me?

    Hello,
    Thanks for your time.  My acrobat preferences were already set to disable the restore last view settings, so that didn't work. 
    I've done a bunch of testing since you responded and have discovered that this issue only happens when I insert pages into a pdf document created by our office scanner (Konica Minolta bizhub C452).  When I scan a document, it creates a pdf.  If I then take that pdf and try to insert another document or page before page 1, the document properties immediately change to "open to page 5" or whatever the original page 1 used to be. 
    I'm not sure what's going on here.  I tried copying the scanned pdf to a different location/drive, and still no luck.  This is a bummer because we work with scanned documents so often and frequently need to insert and rearrange pages.  For now, whenever I insert pages before page 1, I promptly go to the document properties and change the "open to page" to page 1.  Very annoying.

  • Acrobat 10 not Scanning all Pages from ADF (Automatic Document Feeder)

    Acrobat 10 does not scan all of the pages from the Automatic Document Feeder from an attached scanner, and only scans some of the pages. The ADF works fine with the built-in Windows 7 Scan and Fax, as well as with HP's software, but it just won't work with Adobe Acrobat for whatever reason. The scanners that we are using are brand new, and the model is: LaserJet Pro 200 color MFP M276mw. The issue has been duplicated on four computers and two scanners, in a Windows 7 x64 Enterprise environment. A video of the exact problem can be found here: http://uncoolcat.com/work/LaserJet_Pro_200_Color_M276.mp4
    Would somebody be able to help us resolve this issue?

    Hi Varinder,
    Thank you for the suggestion! We wound up figuring out a way to make their "full feature" software (which does include the TWAIN drivers) install mostly silently, and install only if they've connected the device locally to their computer, as noted in the other post that was submitted a few minutes ago. I really appreciate all of the help that you’ve given us!
    In order to duplicate the WIA driver issue, use only the “HP LaserJet Pro 200 Color M276 PCL6 Print Driver (no installer)” (LJ-Pro-200-color-MFP-M276-driver-only-13170.exe) driver package. This driver only package doesn’t appear to have any of the files you mentioned in your previous post in the Scan_App folder for the TWAIN functionality (but those files are available in the “full feature” setup). We copied the entire “driver-only” folder to our plug and play driver folder, and the drivers automatically install. Once they get installed, there isn’t a TWAIN option anywhere to be found in any scanning application, just the WIA driver as far as I can tell. Adobe Acrobat 10 when using the ADF then skips some pages when scanning.
    However, now that you’ve found the install files for the TWAIN driver for the scanner, this should be a non-issue for people as they can just install those and use TWAIN instead, so thank you!
    Also, I find it rather amusing that you were able to help us with what appears to be an HP issue far better and faster than HP did or could. We spoke with seven people at HP, and not a single one of them pointed us in any useful direction or provide us with any useful information on the matter; had we followed any of their advice we would have lost countless hours (one person suggested taking the scanners apart and thoroughly cleaning the rollers, even though it was clearly stated they work fine from a hardware perspective with the full feature software installed and that they are brand new). So anyway, thank you. If you require anything else from us, let me know.

  • Lion Preview can't delete or insert pages to a PDF document

    I have the following problem: I open a PDF file in preview. I delete some pages as I used to in snow leopard. Then I save it. The document's page count changes to the correct number in the window title bar. However, if I open the saved version after closing the current window I see that nothing is saved at all! The same thing happens when I try to insert pages to a PDF document. Looks like everything is fine, but when I close and reopen the document no changes are saved. The weird thing is file is modified, i.e. preview saves something but not my changes. It just re-saves the original document.

    NUMACER's answer worked for me as well guys ! Didn't need to save a version, it just keeps it like that. I tried saving a version which saved on the same file instead of creating a new one (i know that since I saw the "Last modified" thing being updated at the same time) !
    Thanks Numacer

  • How do I copy a page from one pdf  document to another?

    I am a newbe!

    That was easy.Thank you.
         Re: How do I copy a page from one pdf document to another?
    created by George Johnson in Creating, Editing & Exporting PDFs - View the full discussion
    If you open both documents, you can drag a page from the Pages panel (on the left of the window) of one document and drop it into the Pages panel of another.
    You can also extract one or more pages from a document to create a new document, and then insert the pages from this new document into another. In Acrobat 11 you 'd do this by doing:
    Tools > Pages > Extract
    and then:
    Tools > Pages > Insert from File
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/6163925#6163925
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/6163925#6163925
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/6163925#6163925. In the Actions box on the right, click the Stop Email Notifications link .
    Start a new discussion in Creating, Editing & Exporting PDFs at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0 .

  • How do I insert pages from one PDF into the current PDF in Acrobat X?

    I just upgraded from Acrobat 8 to Acrobat X.
    How do I insert pages from one PDF into the current PDF in Acrobat X pro?  I was able to do this from the Edit menu in Acrobat 8 pro.  Appreciate instructions.  Thanks.

    Hi chemadberk,
    In my Acrobat 8 Pro, Insert Pages is under the Document menu but anyway...
    In Acrobat X, click on the Tools pane(upper right side) then navigate to Pages- the Insert Pages commands are located there.
    Hope this helps,
    Dimitri
    [signature deleted by host]

  • Preview Insert Page from scanner How to Change Settings

    I often look to add pages to existing scanned PDF documents using Preview's Insert Page from Scanner Function in Mavericks.  Selecting this automatically opens a scan dialog.  When i use the flatbed to scan, it seems to always scan in black and white vs. greyscale or color.  I can't find anyway to change these settings.  When i scan from the document feeder, it automatically scans in color.  I think there has to be a default settings for this somewhere ,but I can't find it.  Anyone know where the settings may be?

    Thanks for the reminder to update my product info!  It's been a while since I posted.  My scanner is a Canon MX892.   The window you show, I see when I use Image Capture or Import From Scanner, but there is no pop-up or any menu to change any settings when I use Insert Page From Scanner.  I use this function to add on pages to an original PDF, which is the easiest way I have found to do that.  Here is the screen I get - no ability to change any settings other than Flatbed vs. Doc Feeder.

  • How can one print a particular page or pages from a Word Document using ActiveX or any other technique?

    I've been trying to print  a few pages from a Word document.
    Currently I am able to print the entire document using some ActiveX techniques.
    There seems to be facilities for selecting the particular pages, however so far I cannot get them to work.
    I have tried the From/To and the Pages in the PrintOut invoke node.
    And as you will see I have also tried the Range node.
    Anyone have some ideas on how to do this?
    Please see the attached vi.
    Thanks,
    Chris
    Attachments:
    ActiveX Print.vi ‏15 KB

    Please stick to your original post.
    Please have some patience.

  • How Can I extract pages from a PDF document into a separate document by clicking a link?

    Hi,
    I have created a large PDF document with several pages, I have a link symbol on the contents page of the document that relates to several services on different pages within the document. Currently they are identified by having the same link symbol on every page that relates to that particular service. I was wondering if there was any way in which I can create a interactive pdf, when I click the initial symbol link on the contents, it collates all the relevant linked service pages into a single document or guides the viewer to all the pages without having to create a separate pdf document for each service?
    Many thanks
    Yunus

    Simple answer - no. PDF files cannot reassemble themselves into new documents, nor can you hide pages.

  • How can I remove a page from a PDF document and save it as a new PDF document?

    How can I remove a page from a PDF document and save it as a new PDF document?

    Tools - Pages - Extract and tick the option to delete the extracted page from the original file.

  • The option to extract pages from a PDF document as described does not appear for me.

    Im currently running Acrobat Pro XL and the option to extract pages from a PDF document as described in the below tutorial does not appear for me.  Please help!
    Extracting pages from a PDF
    https://acrobatusers.com/tutorials/extracting-pages

    Typically if the extract feature is not present then the application is not Acrobat Pro.
    Be well...

Maybe you are looking for

  • PO and PR attachment

    Hi All, Do we have any tables which let us know whether a particular PO or PR number has any attachment with it? If yes please let me know the name of the table. Our scenario requires if a PO or PR have any attachmnet we need to show the attachment w

  • Z-index/depth to layers

    I am recently working on a website with drop down menus. When I add another layer to the page, the drop down menus are below the new layer therefore hiding them to the user. I tried using the z-index numbers but they don't seem to be working. Any hel

  • HT5395 "Could not sing in to iMessage: the server encounter an error processing registration.  Please try again later. any clue?

    Hi! Long story sort: I did a backup from my Iphone on my computer in iTunes. Since that, the iMessage on my computer is offline I try to sign in with my AppleID but I can't The message is: Could not sign in to Imessage.  The server encounter an error

  • Java commands problem

    I have installed java. But when I run in a dos shell commands Java, jar etc, it does not recognize them. I want to execute these commands from any directory; Today, I must use C:\j2sdk1.4.2_13\bin to work properly. Thanks,

  • ¿en que tienda se repara pantalla en el df?

    BUENAS TARDES QUISEA PREGUNTARLES POR FAVOR ¿EN QUE TIENDA EN EL DF Y AREA METROPOLITANA ME PUDIERAN ARREGLAR LA PANTALLA FRONTAL Y LA CAMARA YA QUE SE CAYO Y SE ESTRELLO CASI TODA LA PANTALLA DEL LADO DERECHO? Y SI ¿ES ARREGLABLE? ATTE. EL SR. SANTI