Export all pages in JPG format

Hi friends

I use to write scripts for Photoshop, Bridge and Illustrator. But it s my firt time to write scripts for Adobe InDesign (and my first on this forum too). I m used to with the reference document JavaScript to this software 3, so I m getting direct assistance via the "Viewer object model" within the scope of the Script Toolkit for writing with InDesign.

I want to export all pages in my document using JPG in the file format. Set the properties of an instance of JPEGExportPreference and I would like to use this configuration to export all pages. I'm just using the app.activeDocument.exportFile () method?

Because I have not found a place to declare the method to read my JPG preference. It s also a range of error pages was not defined. Could you analyze my code and see what I m lack?

Thank you very much:

myDoc var = app.activeDocument;

fName var = myDoc.name.slice (0, myDoc.name.lastIndexOf ('.)) »)) ;


var older = new file (myDoc.filePath + ' / ' + fName + '(exported)');

If (! oFolder.exists) {}

oFolder.create ();

};

var fOutput = new queue (older + ' / ' + fName + ".jpg");

var opJPG = new JPEGExportPreference();

opJPG.antiAlias = true;

opJPG.embedColorProfile = true;

opJPG.exportResolution = 300;

opJPG.jpegColorSpace = JpegColorSpaceEnum.RGB;

opJPG.jpegExportRange = ExportRangeOrAllPages.EXPORT_ALL;

opJPG.jpegQuality = JPEGOptionsQuality.HIGH;

opJPG.jpegRenderingStyle = JPEGOptionsFormat.BASELINE_ENCODING;

opJPG.simulateOverprint = true;

opJPG.useDocumentBleeds = false;

myDoc.exportFile (ExportFormat.JPG, fOutput, false);

Gustavo, otherwise than in Illustrator (don't know about PS and bridge), in InDesign scripts you cannot 'create' new objects using this notation:

var opJPG = new JPEGExportPreference();

Try one with... statement rather directly modify the existing object:

with (app.jpegExportPreferences)
{
  antiAlias = true;
  embedColorProfile = true;
  .. etc.
}

(I know, there are a lot of articles that claim "with statement considered harmful", but for this particular case I don't see why, because it's just a shortcut for writing)

app.jpegExportPreferences.antiAlias = true;
app.jpegExportPreferences.embedColorProfile = true;
.. app.jpegExportPreferences.etc.

.. and so on.)

Tags: InDesign

Similar Questions

  • Doubt on the export of pages in JPG format at high resolution with Indesign

    Hello

    I use to work two software, your skill of QuarkXpress and Indesign. If I had to choose one, I prefer Indesign, it is very nice and I love it, but I have to work with the software.

    Well, I have a doubt about the use of Indesign method to export a page in JPG, high-resolution, because QuarkXpress do the same job, but in a different way, so my doubt is about the quality of the files produced.

    It is a very technical issue, if someone with experience in the professional press and print or an Adobe expert could answer, I would be grateful.

    InDesign, producing a poor quality file or QuarkXpress that producing a poor quality file?

    My question is as follows:

    I opened a document in Indesign, and I decide to export it. To simplify things, we have a unique page DIN A4 document.

    So I tell Indesign to export the pageand I want a JPG, high-resolution 300 DPI file.

    Indesign do his job very well, and produce the file exported. This is a JPG file, there are 300 dpi.

    If I open the document in Photoshopand I'm going to... Image of ... Image size...

    I see the Indesign document indicates the exact measurements of a DIN A4 210 x 297 mm and the resolution of the file, I have 300 DPI.

    Therefore seems to be that indesign has done a great job.

    Very well.

    Now, I explain what is happening with QuarkXpress.

    I do the same thing, I have a document to a single page, DIN A4 and I export it as JPG format at high resolution of 300 dpi.

    Well, now QuarkXpress, create the file and I open the file in Photoshop.

    Surprise.

    The file has larger than DIN A4 and a lower resolution dimensions!

    Exactly, QuarkXpress produce a jpg of the following dimensions: 874,89 x 1237,9 mm and a resolution of 72 dpi

    When I see 72 dpi, I think that the document is in low resolution. However, I have a larger document?

    I open the QuarkXpress file in Photoshop, then I uncheck resampling, in this way Photoshop will never change the image. Now, I change the value of resolution of 72 dpi, 300 dpi, which is the value I want.

    And what happens? What happens is that I get a document with measurements of a DIN A4 and also at 300 DPI.

    ???

    So basically QuarkXpress does the same work in Indesign, but in a different way.

    The file QuarkXpress are 2.29 MB more or less. The Indesign file are 3.84 MB more or less.

    So why these differences?

    Which method is the best and why Indesign produce a different file to QuarkXpresss?

    See you soon

    As far as I know, the ppi is not the required metadata for the images.

    So Im guessing that Quark exports jpg ppi worthless.

    But Photoshop is to assign a value of ppi when it opens an image without specified ppi value.

    This value is be 72, but it could be anything, because the pixel dimensions do not change.

  • Export all pages with 100% quality jpg

    Hello

    When I try to export all pages in my document as 100% quality JPG with the 'Export Assistant', some pages are still exported as GIF.

    I see that there is a combo box of compression in the property inspector, but when I select "JPG - quality" I still don't get a quality of 100% (I get jpg blur around the text, for example).

    Can someone help me? Is there a quick way to export all pages with a 100%? I've yet to find a button that says, for example, 'apply 100% quality for all pages '.

    Thank you!

    If you use Fireworks CS5, you can select all pages, then the optimization goto Control Panel and set the settings jpeg 100%.

    Optimization settings applies to all pages, and then you should be good to export all pages.

    .. Dorin

  • If export all Pages HTML or CSS, what file name to enter?

    When I want to export all pages in my png file to HTML or CSS, what filename must enter - the file name for the first page or the name of the file on the master page?  Is how important it?  Why ask that question if it exports a separate file for each page?

    OK, I had some time to test this. It doesn't matter what you name the file that all pages will be exported as the name. I will not name test of mine and he has not shown, is just page names. I used the html and images option and unchecked current page only.

  • Can I export a single page in jpg format from the module of LR book?

    I only see the option to export the entire book as individual jpg.  If I make a single change to a single page, to get the revised page as jpg seems to me export the entire book again. Is there an easier way to get the update page jpg file?

    Alan

    Hi Alan,

    No, you cannot export a single page of the book Module.

    However, you can try the following suggestion if you have a book with a smaller number of pages:

    Duplicate the book in the Collections Panel (right click > book duplicate) > then choose the book duplicate > edit the required page and delete all the pages except that you want to export > choose export to JPEG.

    Kind regards

    Claes

  • How to export a page to image format

    Hello
    Maybe this question was already answered somewhere else but I can't.
    I want to know if it is possible to export a .jpeg (.png, or whatever image format avaiable) a Web site layout I did Muse in its full length (not just the part visible on top).

    Since it's a relatively 'long' page, take a screenshot of each part and then the Assembly still in Photoshop is not the most comfortable of tricks for this shoot.


    Thank you
    Fabio

    You can preview the page in the browser and use any plugin browser screenshot full page to capture it as an image.

    https://chrome.Google.com/WebStore/detail/awesome-screenshot-captur/alelhddbbhepgpmgidjdcj akblofbmce? hl = en

    Thank you

    Vinayak

  • Export of pages in word format

    I am using a Pages document that I saved as a model because it has the logo of the company and images etc, and then I add the required text and save as a document.  Once I did I then need to export to a word document.

    The works of export, but the text is not saved on the same page... and appears on the second page, as if the words slipped out of the model page

    Please y at - there a way around this.

    Thank you very much

    Penny

    I used Pages 5.6.2, found an existing template in Pages that had graphics.

    Registered as a doc Pages.

    Then exported in file .docx for Word 2016.

    Opened in Word 2016 and saved as a new model.

    It seems close.

    See the pix.

    Note the extra page in Word, but you can fix that with margins. The full text is here. 433 words in both documents.  The graphics as well.  You need to play with the text box.  Search for page breaks in Word (see where they use the invisible command show) and see if this helps you locate a possible problem area.

  • Error message when exporting my pages in HTML format

    I get this error message on my pages as HTML export: could not generate code to activate one or several web fonts on the page "Home - Common Bond Church". {Error 500}Error Message.png

    I uninstalled Muse then re-installed and it worked. Thnx!

  • Having problems to export the slideshow in jpg format

    The overlay text file I added name to the same file name to all slides as opposed to their individual file names.

    I can confirm what you see in LR CC. The filename text inside LR slideshow seems okay, but the exported JPEG slides all have the image of the last file name. What version of LR do you use?

    LR5.7.1 does not have this problem and behave as expected. When using file name or file name Original with text Templates Editor the last image file name is what appears on all slides in JPEG.

    It has been reported. Please add your vote of + 1 to the below problem report:

    eg-slideshow-from-slideshow-with-text-overlay-containing-numbering http://feedback.Photoshop.com/photoshop_family/topics/Wrong-Numbering-When-using-Export-JP

  • Need help as soon as POSSIBLE! Unable to print all pages in PDF format!

    I am trying to print to PDF a 44 page document for client proofing in Indesign CS4. The selection of the print range I always click 'All' and 'Spreads '.

    Week unannounced last he printed only on page 16, with the above parameters. I have all the sections or page numbers or anything that would cause it to not print certain pages.

    There is no errors when it generates the PDF, in fact, it goes through the whole print dialog box very well; except the PDF "finished" appears in place early on with only 16 pages, while the printing dialog box is still ongoing. I have to go back later and print range "17-44" so that it can print the rest and even then, it will only print on page 41 and I'll have to go again and print "42-44", so I find myself with 3 documents. "

    He does it with several documents. It seems to be random, too, like today, I was able to print another document in its entirety because I couldn't earlier.

    What on earth could happen? I have changed all settings as the problem appeared. Thanks for your help.

    I think that if there is a problem in the driver, it would be obvious. You might want to try trashing preferences before you do anything more drastic. See replace your preferences

    There are scripts to impose, but print booklet is the built-in choices.  That said, unless your printer specifiacally told you to make pasta spread, or if you yourself are the printer, DO NOT. It is the printer to impose your file to fit its equipment and you'll just make more work for everyone, or even make your job cannot print, if you try to do his work for him.

  • Limited resolution export to TIFF or JPG format

    Hello

    I can't export image 4500x2500mm with 300 or even 150 dpi. You will have to do with only 96 dpi.

    I use Acrobat X Pro.

    What is the limit and why are there limits?

    This combination is way too large to manage, especially a 32-bit application such as Acrobat. 4500mm at 300 DPI is 53150 pixels wide (which gives a picture of megapixel 1496).

  • Cannot export a page in a document of six pages in pdf format

    I have a document 6 pages created in an earlier version of In Design I have updated and now want to export single pages in pdf format. However, under file / export, after stating the name of the file and clicking on the Save BUTTON in the window export to Adobe PDF, I can "Select all" or "Beach" on the PAGES but gout options against the "Range" are only "all pages" or "A4 V.

    Usually, this is where I would choose the number of the page I want to choose, but I can't do it-only given two options.

    How can I change the drop-down menu for a box of simple manual entry?

    Jacqui

    PS Please understand that I am a user in Design V3 and before that Pagemaker 6.5, so I am a novice in the CC of design. This document has no pages masters, nor a model - but are they necessary? Someone suggested that I need to check my master pages and assign a new model to the pages...

    You should be able to click on A4V and enter your page range.

  • Export pages to jpg with custom file names

    Hello world

    I found - and slightly modified - this script that exports each InDesign page in jpg format, naming it with the relative page number.

    I need to assign the value of a text that I have placed on each page, which is decorated with a paragraph called "filename" style file name

    It would also be good to have user-friendly web file names, replacing spaces with dashes and turn them into tiny.

    Thanks in advance for your help.

    if (app.documents.length != 0) {
         var myDoc = app.activeDocument;
        MakeJPEGfile();
    }
    else{  
         alert("Please open a document and try again.");  
    } 
    
    function MakeJPEGfile() { 
         for(var myCounter = 0; myCounter < myDoc.pages.length; myCounter++) {
             
              if (myDoc.pages.item(myCounter).appliedSection.name != "") {
                   myDoc.pages.item(myCounter).appliedSection.name = "";
              }
              var myPageName = myDoc.pages.item(myCounter).name;
              app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high; // low medium high maximum
              app.jpegExportPreferences.exportResolution = 72;
              app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;
              app.jpegExportPreferences.pageString = myPageName;
    
              var myFilePath = "~/Desktop/" + myPageName + ".jpg";
              var myFile = new File(myFilePath);
              myDoc.exportFile(ExportFormat.jpg, myFile, false);
         }
    }
    

    This code is the same as above, but with a few modifications and a new fuction

    if (app.documents.length != 0) {
         var myDoc = app.activeDocument;
        MakeJPEGfile();
    }
    else{
         alert("Please open a document and try again.");
    } 
    
    function MakeJPEGfile() {
         for(var myCounter = 0; myCounter < myDoc.pages.length; myCounter++) {
    
              if (myDoc.pages.item(myCounter).appliedSection.name != "") {
                   myDoc.pages.item(myCounter).appliedSection.name = "";
              }
              var myPageName = myDoc.pages.item(myCounter).name;
              var myJpegPrefix = "";
              var isStyleExist = true;
    
              //Checking the existing of the paragraph style (filename)
              try {
                  myDoc.paragraphStyles.item("filename");
              }
              catch (myError) {
                  isStyleExist = false;
              }
    
              if (isStyleExist)
                myJpegPrefix = getParagraphContent(myDoc.paragraphStyles.item("filename"), myDoc.pages.item(myCounter)) + myPageName;
              app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high; // low medium high maximum
              app.jpegExportPreferences.exportResolution = 72;
              app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;
              app.jpegExportPreferences.pageString = myPageName;
    
              var myFilePath = "~/Desktop/" + myJpegPrefix + ".jpg";
              var myFile = new File(myFilePath);
              myDoc.exportFile(ExportFormat.jpg, myFile, false);
         }
    }
    
    // The new function, but needs to add checking the file name rules.
    
    function getParagraphContent (paragraphStyle, currentPage) {
        var paragraphContent = "";
        for (var c = 0; c < currentPage.textFrames.length; c++) {
            for (var i = 0; i < currentPage.textFrames.item(c).paragraphs.length; i++){
                if (currentPage.textFrames.item(c).paragraphs.item(i).appliedParagraphStyle == paragraphStyle) {
                    paragraphContent = currentPage.textFrames.item(c).paragraphs.item(i).contents;
                    return paragraphContent;
                }
            }
        }
        return paragraphContent;
    }
    

    Lack of check file naming rules.

  • Poor quality of export of raw to jpg image

    I have recently switched from Aperture to Lightroom and am generally impressed.  However, I noticed a few problems in the export of images in JPG format especially noticeable when it comes to portraits on dark gray background.  You can see a few important and noticeable "scaling" in the background.  , I work on a MacBook Pro.  I know that it is a function of the algorithms Lightroom uses to compress the image and generate the JPG file

    I played a bit with file setting quality and image resizing in the export module and can reduce the effect, but it is always present.  I tried to work with the same image on the PC of my mother, using his 5 Lightroom and can not get the same effect.  The attached picture was not resized, but the quality is reduced to 50.  If I work quality at 100, the effect is reduced but still present.

    In conclusion, to export I get a crispy JPG image in Aperture and Lightroom 5 on a PC, but get serious distortion when exporting to jpg in Lightroom CC on my Mac

    Someone else has experienced this problem and / or know how to fix this problem?

    DSC_7824 copy.jpg

    Mac image has been heavily modified with the white balance different, grinding lower, higher noise, lower saturation, Spot Removal tool and probably other settings. The image of PC seems to the "default parameters of development, which are quite different from the image of Mac processed. Since the unprecedented image of PC has not the development parameters, you used the image of banding Mac are causing the problem. This is why I suggested showing the original edited Mac image as a DNG on Dropbox export file, allowing us to see the picture with your LR settings.

  • Export pages specified in format jpg to set resolution

    Hello inDesign community-

    I have a script that allows me to export the specified pages in a quick dialog as jpg with a specific resolution (500px wide).

    It's great to take pictures, but she uses the dimensions of the page in the active document to define the formula for resolution.

    This works unless there are pages of different sizes, how you get different size jpg.

    How you can use the dimensions of each page that is exported individually.

    I suppose there's a way to get a jpegExportPreferences.pageString table that can then be completed.

    Thanks in advance

    the pages to export

    var pagesToExport

    jpg final demensions

    var myLargeWidth = 500;

    var myLargeHeight = 500;

    Create a variable for the current active document

    var app.activeDocument = docRef;

    Delete ententions of the way to the end of the file

    myFilename = docRef.name.replace (/ \.) [ ^\.] +$/, '');

    Set the variable to save the file in the same directory as the current document

    myFolder = docRef.filePath;

    a document measurments points and redefined sovereign source

    docRef.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;

    docRef.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;

    docRef.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;

    docRef.zeroPoint = [0,0];

    defines the unit of measure (number or string) readonly array limits Page, in the format [x 1, x 2, y2, y1].

    find the width of the page

    var myCurrentWidth = app.activeWindow.activePage.bounds [3] - app.activeWindow.activePage.bounds [1];

    find the height of the page

    var myCurrentHeight = app.activeWindow.activePage.bounds [2] - app.activeWindow.activePage.bounds [0];

    function exportJPG() {}

    export jpg

    If (myLargeWidth > 0) {}

    Calculate the percentage of scale

    var myResizePercentage = myLargeWidth/myCurrentWidth;

    var myExportRes = myResizePercentage * 72;

    exportResolution is accurate to 1 decimal, so round

    }

    else {}

    Calculate the percentage of scale

    var myResizePercentage = myLargeHeight/myCurrentHeight;

    var myExportRes = myResizePercentage * 72;

    }

    percentage of caluclated serve resolution

    app.jpegExportPreferences.exportResolution = myExportRes;

    Export jpg in MyAccount Add .jpg at the end.

    docRef.exportFile (ExportFormat.JPG, File(myFolder+"/"+myFilename+"-500px.jpg"));

    back to inches

    docRef.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.inches;

    docRef.viewPreferences.verticalMeasurementUnits = MeasurementUnits.inches;

    }

    var myName = myInput ();

    rest of the script

    myInput () function

    {

    var myWindow is new window ('dialogue', 'Pages to export to JPG');.

    var myCommentGroup = myWindow.add ('group');

    myCommentGroup.add ('statictext', undefined, 'export to jpg files', {multiline: true});

    myCommentGroup.maximumSize.width = 200;

    var myInputGroup = myWindow.add ('group');

    myInputGroup.add ('statictext', undefined, ' Pages: (1-3, 8, 10) ');

    var myText = myInputGroup.add ('edittext', not defined, '1');

    myText.characters = 20;

    myText.active = true;

    var myButtonGroup = myWindow.add ('group');

    myButtonGroup.alignment = 'right ';

    myButtonGroup.add ('button', undefined, 'OK');

    myButtonGroup.add ('button', undefined, 'Cancel');

    If (myWindow.show () == 1)

    return myText.text myText.text = pagesToExport;

    on the other

    exit ();

    }

    preferences to export jpg

    app.jpegExportPreferences.exportingSpread = false;

    app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.HIGH;

    app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.EXPORT_RANGE;

    app.jpegExportPreferences.pageString = pagesToExport;

    app.jpegExportPreferences.embedColorProfile = false;

    app.jpegExportPreferences.jpegColorSpace = JpegColorSpaceEnum.RGB;

    app.jpegExportPreferences.antiAlias = true;

    exportJPG();

    perform a function

    Hello

    1. you must insert function exportJPG() myCurrentWidth & calculation of height and run it for each page.

    2. This function suppose to be tested in each selected page and the different exportPreferences;

    3. If you need to split a string pageToExport in table variable collection separate pages.

    Like this:

    // which pages to export
    var pagesToExport;
    // final jpg demensions
    var myLargeWidth = 500;
    var myLargeHeight = 500;
    
    // create a variable for current active document
    var docRef = app.activeDocument;
    
    // remove ententions from end of file path
    myFilename = docRef.name.replace(/\.[^\.]+$/, '');
    
    // set variable to save file in same directory as active document
    myFolder = docRef.filePath;
    
    // set document measurments to points and reset ruler orgin
    docRef.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
    docRef.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
    docRef.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
    docRef.zeroPoint = [0,0];
    
    function exportJPG(cPage) {
    // export large jpg
    //bounds    Array of Measurement Unit (Number or String)    readonly    The bounds of the Page, in the format [y1, x1, y2, x2].
    // find width of page
    var myCurrentWidth = cPage.bounds[3]-cPage.bounds[1];
    // find height of page
    var myCurrentHeight = cPage.bounds[2]-cPage.bounds[0];
    if (myLargeWidth > 0) {
    // Calculate the scale percentage
    var myResizePercentage = myLargeWidth/myCurrentWidth;
    var myExportRes = myResizePercentage * 72;
    // exportResolution is only accurate to 1 decimal place, so round
    }
    else {
    // Calculate the scale percentage
    var myResizePercentage = myLargeHeight/myCurrentHeight;
    var myExportRes = myResizePercentage * 72;
    }
    // use caluclated percentage as resolution
    app.jpegExportPreferences.exportResolution = myExportRes;
    app.jpegExportPreferences.pageString = cPage.name;
    // export jpg in myfolder add .jpg to end.
    docRef.exportFile(ExportFormat.JPG, File(myFolder+"/"+myFilename + "_" + cPage.name + "-500px.jpg"));
    }
    // SUI Dialog
    myInput ();
    // jpg export preferences
    app.jpegExportPreferences.exportingSpread= false;
    app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.HIGH;
    app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.EXPORT_RANGE;
    app.jpegExportPreferences.embedColorProfile = false;
    app.jpegExportPreferences.jpegColorSpace= JpegColorSpaceEnum.RGB;
    app.jpegExportPreferences.antiAlias = true;
    
    // run function (loop through chosen pages)
    var b, c, d, stop;
    b = pagesToExport.split(",");
    while (c = b.shift() ) {
      d = c.split("-");
      stop = parseInt(d[0]);
      while (stop <= parseInt(d[d.length-1]) ) {
           exportJPG(docRef.pages.item(stop-1));
           stop++;
           }
      }
    // reset back to inches
    docRef.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.inches;
    docRef.viewPreferences.verticalMeasurementUnits = MeasurementUnits.inches;
    // rest of the script
    function myInput ()
    {
      var myWindow = new Window ("dialog", "Pages to export as JPG");
      var myCommentGroup = myWindow.add ("group");
      myCommentGroup.add ("statictext", undefined, "export some jpgs", {multiline:true});
      //myCommentGroup.maximumSize.width = 200;
      var myInputGroup = myWindow.add ("group");
      myInputGroup.add ("statictext", undefined, "Pages: (1-3,8,10)");
      var myText = myInputGroup.add ("edittext", undefined, "1");
      myText.characters = 20;
      myText.active = true;
      var myButtonGroup = myWindow.add ("group");
      myButtonGroup.alignment = "right";
      myButtonGroup.add ("button", undefined, "OK");
      myButtonGroup.add ("button", undefined, "Cancel");
      if (myWindow.show () == 1)
      return pagesToExport = myText.text;
      else
      exit ();
    }
    

    Note that different page sizes can lead to proportions different width/height.

    In this case jpg is always different. (in height)

    Jarek

Maybe you are looking for