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

Tags: InDesign

Similar Questions

  • Friends of Hy. I want to ask that I am looking to get a pdf split software to split a pdf file into several PDF files with my set of pages specified. As if a document is 22 pages then I will specify the number of pages that must be cut in half to separate

    Friends of Hy. I want to ask that I am looking to get a pdf split software to split a pdf file into several PDF files with my set of pages specified. As if a document is 22 pages then I will specify the number of pages that must be cut in half in separate PDF files. for example I entered that do three pdfs of 1-5, 5-7, 8-10 pages and it will result in me

    first pdf = 1-5 pages

    second pdf = 5-7 pages

    Third pdf = 8 to 10 pages.

    Y at - there no way to do it with adobe acrobat or any other software? I tried many software including adobe with extract and split option, but I did not get the results you are looking for. so please:

    I would like to know if any of you have any knowledge about it. I have

    Thnanks in advance!

    Hi minixain,

    Yes, you can do it using Adobe Acrobat application (Adobe Acrobat free trial downloadversion |) Acrobat Pro DC), please refer to this document for help KB split a PDF | Adobe Acrobat DC tutorials.

    Kind regards

    Nicos

  • 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.

  • Muse to export pages in php but links are always html

    After the update to MuseCC 2015.2 when exporting pages being created to my FTP server have the extension .php (which I think is wrong) and all links in pages are still trying to point to pages .html resulting in a 404 error. I can't seem to change the output of Muse, are the bad links or pages?

    Thanks in advance

    Liquid PHP is the script used for forms. Muse creates pages with forms, so that they are able to run properly, the versions of php. Certainly, it should not affect the structure of the site.

    You have a link to the live site with the problem?

    A solution would be to export the site in HTML format, then transfer it independently using a FTP client.

  • specify the format of the cross-reference in read/write rules?

    How can I specify a cross-reference in the rules format of reading/with import xml document?

    Gary,

    If you want all occurrences of the xref element to use the same format, you can specify the format of an InitialObjectFormat rule in ESD or use a rule r/w in the form:

    element 'figref.

    {

    is part of fm of reference;

    format FM property reference value is "Figure."

    }

    If you want to use different formats and have a particular element to specify that one, you can set an attribute whose value is the name of format with a rule like:

    "xref" element

    {

    is part of fm of reference;

    attribute ' xref-fmt' is the formula of property reference fm;

    }

    In fact, if your DTD defines an attribute called 'format', default FM it uses for this purpose.

    -Lynne

  • How to create a tiff of a page in pdf format?

    Hello

    Acrobat 9 Pro.

    I consult a page that I want to format tiff in a pdf document, how to export just this page to TIFF 600 dpi, 250-page?

    Format tiff image file export has no option to choose just this page, you get all of the 250 which takes forever.

    Envirographics

    My thoughts exactly. I also wrote this code it for you (to the current page):

    var doc = this;

    page var = doc.extractPages (doc.pageNum);

    page.saveAs ({cPath: doc.path.replace (".pdf", "_p" +(doc.pageNum+1) + ".tiff"), cConvID: "com.adobe.acrobat.tiff"});

    page.closeDoc (true);

    You can run it from the console and it will save the TIFF file in the same folder as the original PDF file.

  • [Reports 10g] Page: landscape, portrait, format, units

    Hello
    I can't set the units to centimeters and landscape orientation in mode on the page layout screen.
    I keep seeing a black portrait grid of 8.5 x 11 inches.
    Can I change these settings of the generator of reports or in a file 'reportsweb.cfg '.
    as in forms?

    Thanks a lot for your help.

    JBM.

    Hello
    go to the system setting
    under this ORIENTATION selection, Press f4 set initial value properties 'landscape '.
    return model available select main section press F4
    to properties: width: height 11, 8.5, orientation: landscape
    report width: 132 height ratio: 66

    is the CM unit:
    go to the template page layout: Select format--> layout--> leaders--> units options select centimeters

  • Is there a way to open the exported pages automatically in the preview PDF files?

    New to Mac and I was wondering if this feature is available. I regularly export Pages as PDF documents before sending them to the customers.

    In Windows / Word, PDF files created automatically opens so you can view them.

    I know it takes 5 seconds to manually open them in the preview, but if I missed an option that could automate this step?

    Thanks in advance for any help.

    When you print to PDF, choose the Option "open with Preview.

    Peter

  • HP 4630: I am wanting to scan several pages in PDF format that I I use a HP4630

    I am wanting to scan several pages in PDF format I can do, but I want to print a copy at the same time? Is this possible.  I use a HP4630?

    Hello

    No, they are two different functions.

    Kind regards.

  • I'm trying to burn images in format .jpg on a cd or a dvd in my dvd player. burn files on the disk, but will not work in drive

    I'm trying to burn images in format .jpg on a cd or a dvd in my dvd player.  The files to burn to the disc but won't play in dvd player

    It is possible that your DVD Player cannot read the format. Have you tried Windows DVD Maker? The application must be able to encode the DVD properly in order to perform almost any DVD player worldwide. Thanks, Callum Kerr.

    My software site
    Xbox Live Gamertag: callum151000

  • How to convert .mix files usable format (.jpg)

    How to convert files *.mix usable format (*.jpg) My *.mix files that were created by MS Picture it! and MS Digital Image Pro. Help, please!

    How to convert files *.mix usable format (*.jpg)  Went to Windows 7 & XP new computerfrom due to a failure of the computer.  Fotrunately my pictures have been saved, but the window in course (or other) photo products can not access my files *.mix created by MS Picture! and MS Digital Image Pro.  Help, please!

    Hi Genecec,

    There is no converter of Microsoft or the viewer that will help you to see old photos of your. Although you can use some third party software to convert the .mix .jpg files.

    Note: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    You can follow the link given below and check if the given suggestion is useful.

    http://social.answers.Microsoft.com/forums/en-us/wlmedia/thread/12e62153-35b2-40F0-8da4-ae6450e085b0

    Hope this information is useful.

    Amrita M

    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • I created show and hide features in InDesign I want to export to interactive PDF format. These functions work when seen in Acrobat on the desktop, but not on iPad/Tablet - why?

    I created show and hide features in InDesign I want to export to interactive PDF format. These functions work when seen in Acrobat on the desktop, but not on iPad/Tablet - why?

    Why? Most likely because the PDF Viewer on the Tablet is too stupid to deal with show/hide functionality.

    You could try PDF Expert of Readdle on qpdf Notes Pro on Android and iOS devices.

    Depending on how the show/hide was created during the export of InDesign, it can work in viewers. Otherwise, you will need to open PDF files in Acrobat and edit features show/hide something more digests of PDF device viewers.

    BTW, you will encounter the same issues with the PDF display components in web browsers.

    I hope this can help.

  • I have the first 13 items. I want to export in the .mp4 format. 14 upgrade help me?

    I have the first 13 items. I want to export in the .mp4 format. 14 upgrade help me?

    1997viper wrote:

    I have the first 13 items. I want to export in the .mp4 format. 14 upgrade help me?

    Here is the link to the Premiere Elements forum:

    First Elements

  • Hello I have a subscription to export to Adobe PDF format. I want to stop, but I can´t do this in my settings. Bad today?

    Hello I have a subscription to export to Adobe PDF format. I want to stop, but I can´t do this in my settings. Bad today?

    Please contact Adobe for cancelled do https://helpx.adobe.com/contact.html?step=ZNA_account-payment-orders_stillNeedHelp billing support

    Concerning

    Stéphane

  • What features you receive with subscription to export to the PDF format other than the possibility of converting a pdf to Word file?

    What features you receive with subscription to export to the PDF format other than the possibility of converting a pdf to Word file?

    Hi james5610,

    With Adobe PDF Export you can only convert in PDF https://cloud.acrobat.com/exportpdf.

    Formats of files supported for https://helpx.adobe.com/acrobat-com/kb/supported-file-formats.htmlconversion.

    Kind regards
    Nicos

Maybe you are looking for

  • Qosmio X 770-107-10 Windows upgrade problems

    HelloI have a problem to upgrade my qosmio x 770-107 to windows 10.I have the default software factory with windows 7 home 64 bit.When I try to upgrade to windows 10 I have several problems.first BSOD for atheros drivers. When I update the drivers I

  • Problem updated the BIOS on Satellite A300

    You update the BIOS in the model of laptop A300 psagce after the update, the device to be exposed to something. Please help very necessary

  • Why the BB10 Webworks SDK requires java?

    My resolution for the year 2012 is to NOT install the Java JRE on any computer. It is slow, he inflated, it is a security threat and it is owned by the worse Software House in the world. OpenOffice (I can't stand the Oracle logo in the startup screen

  • Replace with Win 7 32 bit XP Mode using the oem license key?

    We have some old software that requires a 32 bit OS.  There is no way around that it will never support 64 bit, but must use it occasionally. Currently, we run with XP Mode installed Windows 7 Pro 64 bit.  As Microsoft ends support XP on April 8, 201

  • Fonts Windows 7 SP1 Search box problem

    I bought an Acer laptop not long ago, the operating system is Windows 7 Home Premium SP1. I'm Chinese, so I put the location and the type of keyboard and all China. But soon, I realized that there was a problem with the search box. When its not activ