Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

How to save a single Indesign page from a multipage ID document

Return to Member Forum

  • Author
    Posts
    • #14404130
      Markus
      Member

      I’m trying to save just a single page as an Indesign doc from a multiple page doc. It’s for a client and they don’t need all the pages. I have saved as the do and deleted the pages not needed before, but is there any easier way?

      Markus Dohner

    • #14404136
      Dhafir Photo
      Participant

      May be Mohammad Hasanin’s script “Delete Pages v1.0” will help you, by delete all the pages of document except what you want to keep
      https://hasaninscripts.gumroad.com/l/ftrak?layout=profile

    • #14404137
      Mike Rankin
      Keymaster

      Here is a feature request you can vote for: https://indesign.uservoice.com/forums/601021-adobe-indesign-feature-requests/suggestions/41900812-extract-save-individual-pages-in-an-indesign-docum

      It would seem like an easy one to implement just by adding a New Document option to the Move Pages feature.

    • #14404142
      Marc Dunker
      Member

      I agree with Mike on the Move Pages feature.

      Open the file, then create a new blank document, select the page(s) you want to move from the pages panel by right-clicking > move pages.

      In the move pages dialogue, you can choose to keep or delete the page from the original document.

      Then just save the new document.

      Note: For me, move pages can be very finicky. It sometimes just doesn’t work… at least on a Windows machine. I have to restart the computer or InDesign sometimes.

    • #14404159
      Lukáš Záleský
      Participant

      try it:

      // ExtendScript for Adobe InDesign
      // This script prompts for a range of pages to keep and saves a new document with those pages.

      #target indesign

      // Function to show input dialog and get page ranges
      function getPageRanges() {
      var dialog = app.dialogs.add({name: "Select Pages to Keep"});
      with (dialog.dialogColumns.add()) {
      staticTexts.add({staticLabel: "Enter page numbers or ranges (e.g., 1,3-5,7):"});
      var inputField = textEditboxes.add({editContents: "", minWidth: 400}); // Adjusted width to be 2x wider
      }
      if (dialog.show() == true) {
      var pageRanges = inputField.editContents;
      dialog.destroy();
      return pageRanges;
      } else {
      dialog.destroy();
      return null;
      }
      }

      // Function to parse page ranges and return an array of page numbers
      function parsePageRanges(pageRanges) {
      var pagesToKeep = [];
      var ranges = pageRanges.split(",");
      for (var i = 0; i < ranges.length; i++) {
      if (ranges[i].indexOf("-") > -1) {
      var range = ranges[i].split("-");
      var start = parseInt(range[0]);
      var end = parseInt(range[1]);
      for (var j = start; j <= end; j++) {
      pagesToKeep.push(j);
      }
      } else {
      pagesToKeep.push(parseInt(ranges[i]));
      }
      }
      return pagesToKeep;
      }

      // Main function
      function main() {
      if (app.documents.length === 0) {
      alert("No document open.");
      return;
      }

      var doc = app.activeDocument;
      var pageRanges = getPageRanges();
      if (!pageRanges) {
      return;
      }

      var pagesToKeep = parsePageRanges(pageRanges);
      var newDoc = app.documents.add();
      newDoc.properties = doc.properties;

      // Copy pages to new document
      for (var i = 0; i < pagesToKeep.length; i++) {
      var pageIndex = pagesToKeep[i] - 1;
      if (pageIndex >= 0 && pageIndex < doc.pages.length) {
      doc.pages[pageIndex].duplicate(LocationOptions.AT_END, newDoc.pages[-1]);
      }
      }

      // Remove blank page that is created by default
      newDoc.pages[0].remove();

      // Save the new document
      var originalFilePath = doc.fullName.absoluteURI;
      var newFilePath = originalFilePath.replace(/\.indd$/, "_pages.indd");
      newDoc.save(new File(newFilePath));

      alert("New document saved as: " + newFilePath);
      newDoc.close();
      }

      main();

Viewing 4 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads