Can you delete the last page of a document with a script?

Hello, I have been building a script over the last week to help me remove formatting and reapply some of that formatting on a large number of files. I am still learning alot about how to build scripts and what the commmands are but I am almost doen with everything I need to put in it. One of the last things that I want to add is to delete the last page from the Indesign file whether it has content or not. Is this possible? Can anyone point me in the right direction? Thanks

Something like this:
if (app.activeDocument.pages.length > 1)
     app.activeDocument.pages[-1].remove();
First check if document contains more than one page, and if does, remove last page.
Hope that helps.
Marijan (tomaxxi)
http://tomaxxi.com

Similar Messages

  • How can I delete the first page in a document?  It is blank and pagination is grayed out.

    A PDF form is opened in LiveCycle 8.2 and there is a blank page in the beginning of it, then the form data for the document I need.
    I have tried numerous ways to delete this page, with no luck.  I have read through these forums and google searched, nothing is helping.
    Can anyone assist me?
    Is this something I can email the PDF to someone and they can take a look at it?
    Thanks,
    Jason

    The parent subform must be set to Flowed. Make sure each page (subform) is set to Pagination>Following Previous.
    http://www.fieldeffecttechnologies.com/AdobeForums/HideFirstPageOnPrint.pdf
    Kyle

  • How can i delete the new feature "get in contact with your favourite persons"?? When u press the "home" button twice, theres a list on top of the ipad with the last persons youve been in contact with. How do i delete that, or some of them ;-)

    How can i delete the new feature "get in contact with your favourite persons"?? When u press the "home" button twice, theres a list on top of the ipad with the last persons youve been in contact with. How do i delete that, or some of them ;-) Sorry for the danish  

    You can turn that feature off in Settings>Mail, contacts, calendars>Contacts>Show in App Switcher>Recents>Off.

  • How can I have a standard text block appear on the last page of my documents?

    How can I have a standard text block appear on the last page of my documents without having to type it in all the time? I have a terms statement with a line for a customer’s signature which I want on the last page of my invoices and right now I have to type it in each time or cut and paste it from a previous invoice. I already have a Master Page that includes the customer information and my company information at the top of each page and I am using data merge to fill each page with the items ordered and their pictures etc. I would just like to have this standard terms block automatically show up on the last page after the last item in the data merge.
    Thank you all in advance for your help.

    Thank you Peter. This works. I have the text block now at the bottom of a second master page which I apply to the last page. For aesthetics I can modify the position of the text block in the new master page to bring it up from the bottom under the last item ordered when there is less than 4 items on the page. (my data merge fits up to 4 items with their images on a page).  If the last page is full I’ll insert a final page using the second master and also bring it up to the top of the page.

  • When reading an EBook, how can I mark the last page I have read?

    When reading a PDF EBook, how can I mark the last page I have read?

    Hi Pickles 77,
    Sorry to hear you are having issues with your iTunes Store purchase.   The following information should help you with this:
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase
    To report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase, follow these steps:
    Find the email receipt for your purchase.
    Click Report a Problem under the app that is having the issue.
    When prompted, enter the Apple ID and password you used to purchase the item, then click Report a Problem.
    Click Report a Problem next to the item you are having an issue with.
    From the Choose Problem dropdown menu, choose the appropriate issue.
    Follow the onscreen instructions and—if prompted—type a description of the problem into the text field.
    Click Submit to have your issue reviewed.
    Hope this helps ....
    - Judy

  • Can you delete the game center app

    Can you delete the game center app off the iphone

    No, BUT you can hide it in a folder. Unlike Newsstand *cough*

  • I just noticed Private browing option, has this been downloaded or automatically added? I dont want my kids up to no good, as how can i check what they're looking at? Can you delete the private browser?

    Can you delete the private brower option

    That has been a feature in Firefox since Firefox 3.5 was released in June, 2009, it's not '''new'''.
    Sorry, that feature can't be "removed" without breaking a security part of Firefox, and the developers didn't provide a "switch" to allow parents to turn it off. What's even worse it that there is a Bug filed to disable Private Browsing when the Parental Control's that are built into Windows Vista and Windows 7 are turned on. Nothing has been done to fix that Bug in almost 2 years since that Bug was originally filed. <br />
    https://bugzilla.mozilla.org/show_bug.cgi?id=471658 <br />
    Hell, there hasn't even been a comment posted in that Bug in almost 7 months. I have done everything I can do as a support helper to make the developers aware of how important this Bug is for parents, based upon parental feedback here - that has been accepted as ''' "Thanks .... So it's on average 2 requests for this per week." '''
    In all honesty though, even if that Bug is fixed a child can just delete their browsing history in any browser quite easily; sure you'll see that it has been deleted, but you still won't know where they have been. You really need to install some Parental Controls on that PC that tracks the web sites that are being visited outside of a web browser, and can only be accessed with a password.
    I don't have any recommendations for that type of software, as I haven't needed it myself. Never had any children, and if I did even my grand-children would probably be old enough not to need monitoring like that.

  • How can you delete the mail account on iCloud once you've added one.. If it were wrong...

    How can you delete the mail account on iCloud once you've added one.. If it were wrong...

    I have the same problem, someone pleeeaase help.

  • Add a field to the last page of a document file only

    Hello,
    I currently have a script which will add signature and text fields to the first page of a document.
    The script is required to specify the "last page" of the document and not the page number, as each file will vary with the number of pages.
    The script is in run in batch processing on multiple files which are not open (usually 50 at a time).
    If anyone can please advise how to modify the script I will be most grateful.
    // Create Date field dynamically for employee signature field
    var f = this.addField("Todaydate", "text", 0,
    [60, 54, 135, 75]);
    f.userName = "Today's Date";
    f.value = "Automatic Update";
    f.readonly = true;
    f.fillColor = color.ltGray;
    // Create signature field dynamically for employee
    var f = this.addField("mySignature", "signature", 0,
    [120, 85, 330, 105]);
    f.setAction("OnFocus", "var f = this.getField('Todaydate'); f.value = util.printd('d/mm/yyyy', new Date());");

    Thank you very much for your help, I really appreciate your quick response.
    The script has been modified as you suggested and the fields are now added to the last page of each document and is working perfectly.
    I have included the modified script as follows for reference:
    // Create Date field dynamically for employee signature field, add fields to the last page of every file
    // Determine the last page of this document
    var page = this.numPages - 1;
    var f = this.addField("Todaydate", "text", page,
    [60, 54, 135, 75]);
    f.userName = "Today's Date";
    f.value = "Automatic Update";
    f.readonly = true;
    f.fillColor = color.ltGray;
    // Create signature field dynamically for employee
    var f = this.addField("mySignature", "signature", page,
    [120, 85, 330, 105]);
    f.setAction("OnFocus", "var f = this.getField('Todaydate'); f.value = util.printd('d/mm/yyyy', new Date());");

  • Can you operate the mac book pro 15 inch with out the battery?  I read somewhere in a post that it lowers the power to about 1 gig.  I asked apple and they said it is not true because you can use it with or without both together without affecting op pw

    can you operate the mac book pro 15 inch with out the battery?  I read somewhere in a post that it lowers the power to about 1 gig with out the battery.  I asked apple and they said it is not true because you can use the comp with the power adapter and battery together or either by itself and it will not effect the 2.16 gig.  Thank you.

    If you remove the battery the CPU power will be cut by 50% (whatever they told you) so that there's no lack of power or overheating issues. It's best to always keep the battery in.

  • How can I delete the last row of a Matrix

    Hi All,
    Does anyone know whether deleting the last row of a matrix controlled by a UDO child table gives problems? I have the strange effect that I cannot delete the very last existing row in the matrix, i.e. after updating the delete the last to-be deleted row comes back into my matrix !!
    I give you a snippet of my code (function getSelectedRow gives the selected row in the matrix):
    ==
    if (evnt.ItemUID.Equals(ViewConstants.Items.DELETEBUTTON))
      if (evnt.EventType == BoEventTypes.et_ITEM_PRESSED)
        if (evnt.BeforeAction)
          form = BusinessOne.Application.Forms.Item(formUID);
          mtx = (Matrix)form.Items.Item(ViewConstants.Items.MATRIX).Specific;
         int numRow = getSelectedRow(mtx);
         if (numRow != -1)
                                            mtx.DeleteRow(numRow);
                                            form.Mode = BoFormMode.fm_UPDATE_MODE;
                                       Item btn = (Item)form.Items.Item(ViewConstants.Items.ADDBUTTON);
                                       btn.Enabled = true;
    ==
    Cheers,
    Marcel Peek
    Alpha One
    Message was edited by: Marcel Peek
    Message was edited by: Marcel Peek

    Yes, there is a problem to delete the last row.
    It is fixed in version 2005.

  • Can I print the last page of a PDF document using command line?

    Hi
    I am in a situation in which I constantly have to deal with multiple PDF documents and I need to print the last page in each of these, and ONLY the last page. The total number of pages will vary for each file, so the page number for the last page will also vary.
    I would really prefer to not do this manually, by opening up each file in the visible Adobe Reader window and then print.
    Question:
    Is there a way with Adobe Reader (maybe with the help of some other Adobe product) to print only the last page of a PDF document using some kind of command line without opening up the PDF file in the visible Adobe Reader window?
    I'm using Windows.
    Thanks in advance,
    Regards,
    Emil

    Thank you for taking the time to reply.
    I tried both ways and neither works.  It gives me a prompt box that I have to click "next" for every page but after going thru all pages, nothing is sent to the printer.
    Also, all directions I've read indicate it will print to the default printer.  If my default printer is on a network, will that cause problems....
    and...
    should I be getting a prompt box on every page?  I thought all this would happen behind the scenes and not force me to interact with every page.
    dc

  • Can not delete the  last record ,  frm-40202 field must be entered

    hi ,
    i have built a form which contain master and details blocks
    the problem is
    when i look for a record by executing query on on transaction serial and try to delete this record from the master block it gives me new serial for the transaction and when i try to save it, it says
    >frm-40202 field must be entered
    where this field is required and i cant save it
    although in another form when i delete from the master it gives me the previous record and it works properly
    the question is :
    why it gives a new serial when i delete the record ??if any one has any ideas pls help me
    thank u
    ------- the master block has a trigger when-create-record
    Declare>v_dummy number;
    Begin
    Select nvl(max(ERNT_NO),0) + 1 >Into v_dummy
    From LM_RENT_EXPNMST >Where cmp_no = :LM_RENT_EXPNMST.cmp_no
    And brn_no = :LM_RENT_EXPNMST.brn_no>and fiscal_yr = :LM_RENT_EXPNMST.fiscal_yr;
    >:LM_RENT_EXPNMST.ERNT_NO := v_dummy;
    END;
    IF :PARAMETER.RNT_NO IS NOT NULL THEN
         :LM_RENT_EXPNMST.RNT_NO:=:PARAMETER.RNT_NO;
              :LM_RENT_EXPNMST.RNT_YR:=:PARAMETER.RNT_YR;
         :LM_RENT_EXPNMST.CUST_DESC:=:PARAMETER.RNT_ADESC;
    END IF;

    Hi ayadsufyan,
    As it looks Andreas assumption of internal status change was correct. So taking into account this fact I would assume you are doing some data manipulation on the row you are unable to delete.
    What I would suggest to do is to put the following code in your KEY-DELREC trigger :
    clear_message;
    message(:system.record_status);pause;Now when you delete the record you should get the INSERT status of the record. If so it definitely means you are doing some manipulation on the record you are trying to delete. From this point on you will have to pinpoint the offending code.
    Best regards.
    Edited by: GregorM on May 11, 2013 10:41 AM

  • Creating the last page in e-pubs with footnotes is this twisted maneuver?

    CC. Exporting e-book 2.01. Footnotes at the end of the section.
    Inserted at the end of the book a new page with some info but this one was placed before the list of footnotes, not at the end.
    It shows that the e-pub considers the footnotes the last part of the book.
    In this case I inserted the required text as part of the last footnote separated with a hard return.
    Now the e-pub engine thinks that this text is indeed the last footnote and places it at the end.
    This procedure is very demanding.
    I think is a better method to do it.
    Thanks.

    From your post it seems that you wish your footnote to appear at the end of the EPUB.
    Ooja, well, not at all. I have a text, not a footnote, that should appear at the end of the epub.
    The export option to put [all] footnotes at the end of the document involves that ID will define the last page as that with the last footnote?
    Observing this I had to insert my additional text below the last footnote.
    Think this is a little strange...
    My doubt is: it this the only procedure to insert a plain text at the end of the e-pub?
    Or may you suggest something less trespassing that inserting text inside a footnote?
    Thanks.

  • How can I delete the area which I have selected with Pen Tool?

    Hi,
    I have selected the particular area of my background image, which is just complicated. Now, I would like to delete the selection so that I will copy something else in that blank area. How can I delete the selected area?
    Thanks.

    Hobotor wrote:
      Uhm you mean "rightclick---> make selection---> delete "?
    Hi,
    But I can't see such option. Please look below the snapshot:
    I want to remove the existing image (Girl's Image) and insert some other image. Please help.
    Thanks.

Maybe you are looking for

  • Deleting Completed Print Jobs in Mac OS X 10.8 ?

    How can the job list of completed print jobs be deleted ? The job list fills up with lots of completed and canceled (a 10.7./10.8 bug) jobs and many jobs are added multiple times after a time in the list untill closed and reopened again. This makes i

  • Too long row

    I display text in sql report. Text has 1000 characters. I would display this text in more rows(not recors).I tried set up report/edit TEXT/Tabular Form Element/element width : 20 (for example), but it is not function. It is too long row(column TEXT)

  • How to copy this wsld

    H i Experts ,                        mine is a Idoc to Webservice scenerio. I have 2 fields from R3 taht is going to go to web service. I cannot do 2 things.    The below mentioned part.. I dont know how do i store it in desktop,, and hw much should

  • Error when building lightdm-unity-greeter

    Hi, I built Unity from git last night, and today I've failed to make lightdm-unity-greeter with this error: make[2]: Entering directory `/home/isolet/Unity-for-Arch-Extra/lightdm-unity-greeter/src/unity-greeter-13.10.2/src' VALAC unity_greeter_vala.s

  • I sold my ipad 2 and didn't take out my apple id. how can i log off the ipad with out having it in hand?

    I sold my ipad 2 and didn't take out my apple id. how can i log off the ipad with out having it in hand?