5 Replies Latest reply on Mar 17, 2016 3:06 PM by OzSanta2

    Need to print document WITHOUT margins using javascript, please

    OzSanta2 Level 1

      G'day Javascripters.

       

      I really, really need to print without page margins (edge to edge). I'm trying to use Java as the print setter (using Applescript Objective C), and so far it's been successful, but we're getting a 36 point margin around each page, and we want zero on tiled pages.

       

      I'm try to use a java script I found here... remove white margin with javascript (JavaScript) with no success. According to the documentation, margins for printers don't have a setting. I do NOT want to go back to using the GUI with the print dialog, it's much, much slower.

       

      Can anyone tell me please why this does not work? I've tried all sorts of alterations, but just get a 'Can't understand 'do script'' message. Even though I've found the java documentation, I simply don't know what I'm doing!

       

       

      tell application "Adobe Acrobat"

        activate

        tell page 1 of document 1

        set t to my removePDFMargins

        do script t

        end tell

      end tell

       

      on removePDFMargins()

        set Params to ""

        set Params to Params & "function CropPage()" & return

        set Params to Params & "{" & return

        set Params to Params & "console.clear();" & return

        set Params to Params & "console.show();" & return

       

        set Params to Params & "Media = this.getPageBox(\"" & "Media" & "\");" & return

        set Params to Params & "this.setPageBoxes(\"" & "Media" & "\", 0, 0, Media);" & return

       

        set Params to Params & "Crop = this.getPageBox(\"" & "Crop" & "\");" & return

        set Params to Params & "this.setPageBoxes(\"" & "Crop" & "\", 0, 0, Crop);" & return

       

        set Params to Params & "Trim = this.getPageBox(\"" & "Trim" & "\");" & return

        set Params to Params & "this.setPageBoxes(\"" & "Trim" & "\", 0, 0, Trim);" & return

       

        set Params to Params & "BBox = this.getPageBox(\"" & "BBox" & "\");" & return

        set Params to Params & "this.setPageBoxes(\"" & "Crop" & "\", 0, 0, BBox);" & return

       

        set Params to Params & "Bleed = this.getPageBox(\"" & "Bleed" & "\");" & return

        set Params to Params & "this.setPageBoxes(\"" & "Bleed" & "\", 0, 0, Bleed);" & return

        set Params to Params & "}" & return

        return Params

      end removePDFMargins