0 Replies Latest reply on Sep 24, 2010 3:47 AM by indesign2000

    Export text between bookmarks with Javascript

    indesign2000

      I'm trying to export to pdf the text between 2 bookmarks. The code i have so far:

       

           var fullName = app.activeDocument.fullName;
          var doc = app.activeDocument;
         
          var bb = doc.bookmarks.firstItem();
          var be = bb.bookmarks.firstItem();
         
          bb.showBookmark();
          var fr = app.selection[0];
         
          be.showBookmark();
          var to = app.selection[0];
         
          bb.showBookmark();
         
          app.select(app.selection[0].parent.insertionPoints.itemByRange (fr.index, to.index));
          app.copy(); 
          app.select(null);
         
          var ndoc = app.documents.add(true);
          app.activeDocument = ndoc;
          app.paste();


          ndoc.exportFile(ExportFormat.pdfType, File(fullName + "-block1.pdf"),false);

          ndoc.close(SaveOptions.NO);

       

       

      The problem is the resulting PDF shows the text in a small rectangle in the center of the page. Not all the text is shown, it is clipped.

      I guess i have to move / resize the area after app.paste() but i don't know how to do with Javascript.