Script that current subtract page number two AND export two separate PDF files you have a problem

Hello

OBS: The InDesign CS3 script!

Ronald63 and Laubender helped me with this script:

// Number to decrement:
var nDecrement = 2;

// pageNumberStart for a section is only valid, when continueNumbering is set to false
app.documents[0].sections[0].continueNumbering = false;
var myCurrentNumber = app.documents[0].sections[0].pageNumberStart;

if(myCurrentNumber>nDecrement+1)
{
    app.documents[0].sections[0].pageNumberStart = myCurrentNumber - nDecrement
};

var doc = app.activeDocument; 
var _PDFExportPreset = app.pdfExportPresets.item('MyDocumentProfile');
var _DocName = doc.name.replace(/\.indd/, ""); 
var _EndNumber = parseInt(_DocName.match(/\d{3}$/),10); /* extract end number */
/* test if is a number */
if (isNaN(_EndNumber)){
    alert('End document name is not a number');
    exit();
}

for(i = 0; i < doc.pages.length; i++){ 
    _PageName = doc.pages.item(i).name; 
    app.pdfExportPreferences.pageRange = _PageName;     
    _NewNumber = _EndNumber + i; /* incresase number */
    _NewNumber = ("00"+_NewNumber).slice(-3); /* padding */
    _DocName = _DocName.replace(/\d{3}$/,_NewNumber); /* replace number in doc name */
    _PDFfile = new File('\\\\testserver\\'.concat(_DocName,'.pdf'));
    doc.exportFile(ExportFormat.pdfType, _PDFfile, false, _PDFExportPreset);
}

He has a problem when I have two pages with a container framework that cross the two pages:

Udklip.PNG

When I run the script, I get this result:

Udklip.PNG

An empty page and the frame with the content is on the other page outside the PB.

If I delete this part of the script:

// Number to decrement:
var nDecrement = 2;

// pageNumberStart for a section is only valid, when continueNumbering is set to false
app.documents[0].sections[0].continueNumbering = false;
var myCurrentNumber = app.documents[0].sections[0].pageNumberStart;

if(myCurrentNumber>nDecrement+1)
{
    app.documents[0].sections[0].pageNumberStart = myCurrentNumber - nDecrement
};

Then it works very well

What Miss me?

Hello

Add: located in front of the pages in the document preferences

Try this...

var doc = app.activeDocument;
// Number to decrement:
var nDecrement = 2;
// set facingPages
doc.documentPreferences.facingPages = true;
// pageNumberStart for a section is only valid, when continueNumbering is set to false
doc.sections[0].continueNumbering = false;
var myCurrentNumber = doc.sections[0].pageNumberStart;

if(myCurrentNumber>nDecrement+1){
    doc.sections[0].pageNumberStart = myCurrentNumber - nDecrement;
}

var _PDFExportPreset = app.pdfExportPresets.item('MyDocumentProfile');
var _DocName = doc.name.replace(/\.indd/, "");
var _EndNumber = parseInt(_DocName.match(/\d{3}$/),10); /* extract end number */
/* test if is a number */
if (isNaN(_EndNumber)){
    alert('End document name is not a number');
    exit();
}

for(i = 0; i < doc.pages.length; i++){
    _PageName = doc.pages.item(i).name;
    app.pdfExportPreferences.pageRange = _PageName;
    _NewNumber = _EndNumber + i; /* incresase number */
    _NewNumber = ("00"+_NewNumber).slice(-3); /* padding */
    _DocName = _DocName.replace(/\d{3}$/,_NewNumber); /* replace number in doc name */
    _PDFfile = new File('\\\\testserver\\'.concat(_DocName,'.pdf'));
    doc.exportFile(ExportFormat.pdfType, _PDFfile, false, _PDFExportPreset);
}

Tags: InDesign

Similar Questions

  • Script that export two separate PDF files of paper with two pages AND change the name of the file, the number two of the PDF

    OBS: Script InDesign CS3:

    I have a document with two pages but a file name!

    I need a script which

    1 export the two pages in format PDF separated two - so NOT a single PDF file with two pages but two PDF files

    2. the first PDF file must have the same name as the document - for example .indd13ESW110020216TC0-> ESW110020216TC013.pdf

    3. the second PDF file will be added to the last number - so .indd14ESW110020216TC0-> ESW110020216TC014.pdf

    Is it possible to integrate this script:

    var doc = app.activeDocument;  
    var _PDFfile = new File('\\\\testserver\\' + app.activeDocument.name.replace (/\.indd$/, '.pdf'));  
      
    var _PDFExportPreset = app.pdfExportPresets.item('MyPdfSetting');   
    if (_PDFExportPreset == null){  
       alert('PDF Export Presets not found');  
       exit();  
        }    
        app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;                      
        doc.exportFile(ExportFormat.pdfType, _PDFfile, false,_PDFExportPreset);  
    

    Hello

    Try this...

  • Custome Field took a nullpointexception in the labefiled and 7.1 paint method only you have this problem! Pls help me?

    KIM I create a custom entry field as below:

    public class AddEditField extends HorizontalFieldManager {
        private LabelField labelField;
        private EditField contentField;
        private RichTextField wrapaddField;
        HorizontalFieldManager textMgr;
        HorizontalFieldManager wrapMgr;
        private static final int HPADDING = Display.getWidth() <= 320 ? 6 : 8;
        Font font;
    
        public AddEditField(String label, Font font, int maxSpace) {
            this(label, 0, font, maxSpace);
        }
    
        public AddEditField(String label, long style, Font cfont, int maxSpace) {
            super(NO_HORIZONTAL_SCROLL);
            this.font = cfont;
            textMgr = new HorizontalFieldManager(HORIZONTAL_SCROLL | FIELD_VCENTER);
            wrapMgr = new HorizontalFieldManager(FIELD_VCENTER);
            wrapaddField = new RichTextField(RichTextField.TEXT_ALIGN_LEFT);
            long cstyle = 0;
            if (style == 0) {
                cstyle = EditField.NO_NEWLINE | EditField.FOCUSABLE
                        | EditField.EDITABLE | FIELD_VCENTER;
            } else {
                cstyle = EditField.NO_NEWLINE | EditField.FOCUSABLE
                        | EditField.EDITABLE | style | FIELD_VCENTER;
            }
            contentField = new EditField(cstyle) {
                protected void paint(Graphics graphics) {
    
                    // Font font = getFont().derive(Font.PLAIN, fontSize);
                    graphics.setFont(font);
                    graphics.setColor(0x666666);
                    super.paint(graphics);
                }
    
                protected void onFocus(int direction) {
                    super.onFocus(direction);
                    invalidate();
                }
    
                protected void onUnfocus() {
                    super.onUnfocus();
                    // if (VirtualKeyboard.isSupported()) {
                    // VirtualKeyboard vKeyboard =getVirtualKeyboard();
                    // vKeyboard.setVisibility(VirtualKeyboard.HIDE);
                    // }
    
                }
            };
            labelField = new LabelField(label, FIELD_LEFT | FIELD_VCENTER) {
                protected void paint(Graphics graphics) {
                    graphics.setColor(0x006699);
                    graphics.setFont(font);
                    super.paint(graphics);
                }
            };
            LabelField spaceF = new LabelField() {
    
                protected void layout(int width, int height) {
                    // TODO Auto-generated method stub
                    //super.layout(HPADDING, font.getHeight() + 10);
                    setExtent(HPADDING, font.getHeight() + 10);
                }
            };
            add(spaceF);
            add(labelField);
            final int space = maxSpace - font.getAdvance(labelField.getText());
            LabelField spaceF2 = new LabelField() {
    
                protected void layout(int width, int height) {
                    // TODO Auto-generated method stub
                    // super.layout(space, font.getHeight() + 10);
                    setExtent(space, font.getHeight() + 10);
                }
            };
            add(spaceF2);
            textMgr.add(contentField);
            wrapMgr.add(wrapaddField);
            add(textMgr);
        }
    
        public String getText() {
            return contentField.getText();
        }
    
        public void setText(String text) {
            synchronized (UiApplication.getEventLock()) {
                wrapaddField.setText(text);
                contentField.setText(text);
            }
        }
    
        public void setEditMode(boolean editable) {
            String text = wrapaddField.getText();
            synchronized (UiApplication.getEventLock()) {
                if (editable) {
                    contentField.setText(text);
                    if (wrapMgr.getManager() == this) {
                        delete(wrapMgr);
                    }
                    if (textMgr.getManager() != this) {
                        add(textMgr);
                    }
                } else {
                    if (textMgr.getManager() == this) {
                        delete(textMgr);
                    }
                    if (wrapMgr.getManager() != this) {
                        add(wrapMgr);
                    }
                }
            }
        }
    
    }
    

    Then I create: new AddEditField ("address:", cFont, maxSpace);  and add it to a screen.

    When I try to open this form. It is nullpointexception: the eclipse debugger show the info such as:

    AddEditField$ 4labelfield.paint line 385.

    Please help me to check the code. why it can run in 0 s 7.0 and before, only 7.1 has had this problem?

    Thank you

    Hi Flybrid,

    I checked at the time of your code,

    I am able to run your code by deleting page layout override methods in two fields of the label.

    The problem with the substitution of the method of layout in the spaceF and spaceF2 fields.

    But I can't explain why.

    I think that you can achieve the same thing by replacing getPrefferedWidth() and getPrefferedHeight() above the fields instead of page layout.

    Thank you.

  • I need to know the file current date/time number stamp and the version of "spoolsv.exe" in Vista Home Premium 32-bit with SP2.

    I need to know the file current date/time number stamp and the version of "spoolsv.exe" in Vista Home Premium 32-bit with SP2. My spooler file got corrupted and I need to know what that the stamp of date/time on the latest version of the file: spoolsv.exe. I did a search on my hard drive and found 8 copies of the file with 7 different dates. I need to know which copy in my file C:\windows\system32\. I suspect that the problem was caused by some kind of malware. I think that some of the different versions on my machine of the initial installation of the Vista, SP1 and SP2. 3 copies that would explain. I tried all the suggestions in this forum and several others. I tried sfc/scannow and it simply replaces the corrupted file by another. I understand how works this file and a simple copy will do the trick if I knew that the file to use. I know that I don't want to go back to the first version of 2006.  BTW... my symptoms are all my printers have disappeared, and when I try to 'add a new printer' I get an error message saying that my spooler service does not work. When I opened my services window it shows that indeed, he is arrested, but I will not start because the description column contains only the code garbled machine indicating that the file is corrupted, or it may contain a virus. I had been using F-Prot until this virus got by and now I use AVG. I scanned my machine with several cleaning packages and it is is more infected, but I worry that from this corrupt file grow something. I know that the problem is not with my printers or drivers, because everyone on my home network can print on all of my printers. None of the people I know are on Vista 32 bit. They are all running System 7 or XP. I have XP, except that a few years ago I suffered from the "Syndrome of Pepsi" on my laptop and when I bought a new HP, it came with Vista.

    Version 6.0.6002.18294

    Day 17/08/2010

    Duration 14:11

    Duration may vary in different time zones.

  • I have Photoshop CS6 and Lightroom 5.7. They are currently installed on a PC with Windows 8.1 Professional 32-bit and 4 GB of RAM. I want to move to a PC with Windows 8.1 Professional 64 bit and 32 GB of memory, because I have a problem with the large

    I have Photoshop CS6 and Lightroom 5.7. They are currently installed on a PC with Windows 8.1 Professional 32-bit and 4 GB of RAM. I want to move to a PC with Windows 8.1 Professional 64 bit and 32 GB of memory, because I have a problem with the large RAW from a Canon 5 Ds R. What should I do?

    You install exactly in the same way you did the 1st time... Put your disc in the drive, and enter your serial number when asked

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a link to access a page to download the Adobe programs if you do not have a disk or drive

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

  • I just uploaded a new site to an existing via filezilla domain. It worked great and my site is up, but I have a problem that does not show when he would be seen in the fake browser Adobe Catalyst. I have a logo in the left corner on the my

    I just uploaded a new site to an existing via filezilla domain. It worked great and my site is up, but I have a problem that does not show when he would be seen in the fake browser Adobe Catalyst. I have a logo in the left corner of the page master. In Muse, he shows that he is in the right place, and when I go to preview, is also in the right place. When I went to live with my Web site, it shows that the logo is off, to the left and not at all in the right place. Any ideas on what I can do to move this and stay in the right place. Everything I have on the master page is prominently in the live version.

    Probably, you have a box or empty text box somewhere see this thread for the fix: Bug Muse | Graphics shift randomly, why?

  • Why my internet continue to say that the internet does not not and takes so long to connect, I have a new computer, I have also a pc clean and do not always help. any suggestions

    Why my internet continue to say that the internet does not not and takes so long to connect, I have a new computer, I have also a pc clean and do not always help. any suggestions

    Hello

    Thanks for posting your question in the Microsoft community.

    I understand that when you try to connect to the Internet, he says at the outset that Internet is not responding and then after some time to connect. Let us know if this is incorrect.

    It would help if you could answer these questions.

    a. what version of Windows is installed on the computer?

    b. don't you make changes to the computer before the show?

    I suggest you check out the link and follow the steps.

    Why can't I connect to the Internet?

    http://Windows.Microsoft.com/en-GB/Windows7/why-can-t-I-connect-to-the-Internet

    Let us know if you need more assistance.

  • How to make a record that I downloaded on my computer and to make into smaller files so that I'd be able to send them an existing voice mail? From now on, the file is large to send

    How to make a record that I downloaded on my computer and to make into smaller files so that I'd be able to send them an existing voice mail? From now on, the file is large to send.

    Hi kristieann,

    ·         What version of the operating system is installed on the computer?

    You can search for any third-party application, using your favorite search engine to split the recording file.

    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.

  • When I edit a photo in "develop" and then click back to the library to export the only changes to the photo that carry over is the cropping. I can't export my edited photo. Anyone have this problem? I have the creative cloud package

    When I edit a photo in "develop" and then click back to the library to export the only changes to the photo that carry over is the cropping. I can't export my edited photo. Anyone have this problem? I have the creative cloud package

    Hi stever25146025,

    According to the request, I understand that when you export images from Lightroom it shows only the crops, is not editing.

    It is specific to a single image or all images in the catalog?

    Could you please let me know what file format you choose to export the images and also what version of Lightroom are you using?

    Kind regards

    Tanuj

  • I have a document composed of separate PDF files that reside in a folder and are related to each other through hyperlinks. Each pdf file is set to open with bookmarks displayed, however if I have a link to a PDF file to another and use the button "Previou

    I have a document composed of separate PDF files that reside in a folder and are related to each other through hyperlinks. Each pdf file is configurΘ for dΘmarrer with bookmarks displayed, however if I have a link to one PDF file to another and use the "back" button to return to my starting point bookmarks are replaced by "vignette". Is there anyway to prevent this?

    Hi Mike,.

    While the implementation of the links, if you choose to open the file in a new window then you will not experience this issue, then you can simply switch to the file view and previous bookmark will remain as it is.

    Is that what helps with your query?

    Kind regards
    Rahul

  • He anIs it an Adobe application to save a Web page with links still embedded in the PDF file.

    My question is are at - it an Adobe application for the iPhone that can save a Web page with links still embedded in the PDF file.

    I would save my Web pages as PDF files, and still have the links in these active pages in this PDF file. I can currently do this with my version of Adobe acrobat on my PC.  I would add also this is for personal use and I can't afford monthly fees.

    I would add also this is for personal use and I can't afford monthly fees.

    Any information would be greatly appreciated.


    Them

    Sorry, Adobe has no product available for free.

    However, if you have Acrobat DC on your computer, you can create this a PDF file. If you activate the Mobile link feature, it will be immediately available for all your devices.

  • When I add text to an image that starts as a RAW file, I have no problem. When I try to add text to an image that is only a jpg file, the size of the text is extremely low. Even when I change the the font size to 72 pt, it is always small. How can I fix i

    When I add text to an image that starts as a RAW file, I have no problem. When I try to add text to an image that is only a jpg file, the size of the text is extremely low. Even when I change the the font size to 72 pt, it is always small. How can I fix it?

    You set the font size to a size that is suitable for the size of the document.   Size of the document may vary everywhere.   To resolve this problem in action, I solved in scaling the document to a known size then use a font suitable for a document of this size.  When you resize an image using size with resample Images not only checked a single pixel is change everything that is changed is the DPI image resolution setting.  So if you size a picture 8 "wide you choose a font size is good for wide image 8" the Save action.  To work around the problem of changing the size of the printing I wrote a Script to use in such an action.  The script is used twice, there is a backup and restore script.   The first time that the script is used the script records the resolution DPI images in the metadata documents.  The second time that the script is executed, it retrieves the registered PID parameter deletes the record of metadata from images and set the DPI images that had been saved.    If the use of fonts for the document 8 "will be resized to fit the print original size.

    In a script, you can calculate a correct font size to use.  Actions cannot retrieve information or use logic. They need to use the Plug-ing and Script where logic is needed.  When you make using Photoshop UI you use your eyes and brain.

    Package of shares of crafts UPDATE August 10, 2014 added conditional measures Action Palette tips.
    Contains

    Example of
    Download

  • I have problems with pdf files, sent to me by e-mail, download doc on my canon printer and the creation of pdf file to send.

    Original title: pdf files

    I am running microsoft windows xp home edition 2002. I always have problems with pdf files, sent to me by e-mail, download doc on my canon printer and the creation of pdf file to send. I use microsoft works Task Launcher 2004 edition.

    Is there an easy way to pass so I can handle pdf files?  Can anyone help?

    Thank you Tim

    Hello

    Please provide us with more specific information on the issue. Your post is a bit confusing.

    If you need to open the PDF files, you will need to install a PDF reader.

    If you try to print in PDF format, you must install Adobe Reader.

    Reference: http://www.adobe.com/downloads/

    THIRD WARNING:
    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.

  • I have updated to DC (about a month) and cannot save my PDF files more.  What is the cause of the dialog box "Save as" do not open?

    I have updated to DC (about a month) and cannot save my PDF files more.  What is the cause of the dialog box "Save as" do not open?

    Hi mwebsterdps-sc,.

    Try this: -.

    The default "Save as" dialog Acrobat DC is different from the dialogue box you had in earlier versions of Acrobat, it also allows you to record in the clouds and previous locations that you saved the files. It is possible that when Acrobat tries to connect to the 'cloud', it runs into problems. You can try to disable this feature to see if this brings your backup in the back of the box: open Acrobat Edit menu access-> Preferences, then go to the "General" category and uncheck "show the online storage when you save files:

    I would like to know if it works.

    Kind regards
    Nicos

  • I'm trying to highlight objects and text in a pdf file converted from a cadd drawing but can't do either?

    I'm trying to highlight objects and text in a pdf file converted from a cadd drawing but can't do either?

    It may be that the PDF file is simply a graph. The highlight tool works on the text, not graphics. You may need to use the marker or another graphic tool.

Maybe you are looking for

  • Satellite A100 weird WLAN problem

    Whenever I click on the "view available wireless networks" a bunch of new networks would appear with names made up of corrupt characters and whenever I update a new one seems...Note * it is the only nearby available wireless network access (which I'v

  • Cannot find my hidden partition.

    Ok. I have a NEC VERSA E6510 laptop which is currently under vista. These days, my computer has encountered a problem, so I send my computer to the shop to fix it. They said that I installed the trial version of Windows 7 and I continued using the sa

  • HP Laserjet M606x: Disable the option 'Print' in the built-in Web server

    I am testing a new HP Laserjet M606 device and to disable the option 'Print' which is displayed in the 'Information' tab in the built-in webserver (EWS). I have a firewall turned on, turned off wireless printing, FTP, AirPrint, Web Services, PPI and

  • network error 0 x 80070035 that the network path was not found.

    I have problem of network with Win7 pro. When I click on my network folder links to my LAN I geterror 0 x 80070035 the network path was not found. The network has been set up for 4 months, it includes 3 PC, so far the only problems have been minor, s

  • bad at startup splash screen size

    the building is striking the wrong at startup splashscreen -?