How to get the number of the selected page?

  • I need to know the number of the selected page (not the current page, but the page number of the page the user has selected with the mouse).

    I also need to know how I can select pages by code.
    This is for a split function, which shall split a pdf into 2 pieces.

    • Offizieller Beitrag

    Hi,

    You can use the command
    COMPDF_PageSelectionGet = 247

    With a parameter <0 it returns the count of selected pages, otherwise it returns the state of the give page:

    0 = not selected
    1 = selected
    -1= does not exist (page nr too large)

    Also note:

    Code
    COMPDF_PageSelectionGet   = 247; // Checks if a page is selected. Pass zero based page number. Result = 1, if selected
      COMPDF_PageSelectionClear = 248; // Removes previous selection
      COMPDF_PageSelectionAdd   = 249; // Select one additional page. Pass zero based page number. Result = count of selected pages.
      COMPDF_PageSelectionDel   = 250; // Removes Selection from Page. Pass zero based page number. Result = count of selected pages.
      COMPDF_PageSelectionToggle= 258; // Toggles state for a certain page. Pass zero based page number. Result = count of selected pages.
      COMPDF_PageSelectionInvert= 251; // Inverts Selection. Result = count of selected pages.
      COMPDF_PageSelectionSaveRestore  = 259; // Saves the selection markers to a buffer and clears the selection. With Param=1 it restores the buffer


    Regards,

    Julian

  • Thanks, this helped me. I can not successful split the pdf document as I wanted it.