Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    kaiserwilhelm is offline Senior Member
    Join Date
    Nov 2007
    Posts
    289

    Default Scripting Acrobat

    I have a very talented Indesign scripter on staff. The scripts he has written for our department save us hours every day. We are getting in more and more pdfs (supposedly run ready) from clients. In the commercial web press world, I must have .187 plate gap.
    Is there a software, or do you think it is possible to have a script / hotfolder where a PDF is dropped and a KEYLINE of .187 is put on the document from all four edges? IE, 8.5 x 11 would have a KEYLINE color (set to overprint) added to the PDF that is .187 from the top, left, right, and bottom?

  2. #2
    Colorblind's Avatar
    Colorblind is offline Senior Member
    Join Date
    Aug 2007
    Location
    Montreal, Qc, Canada
    Posts
    331

    Default

    I don't think that can be done by scripting Acrobat alone. What I would do is import the PDF in InDesign, add your stroke frame all around and re-export as PDF. I've came with the following. Save the code as AppleScript application and drop any PDF on it's icon. It will open the PDF (or multiple PDFs that will process one at a time) to gather page number, PDF width and height, then place the PDF in InDesign, add the overprinting stroke all around and export a new "refried" PDF to a desktop folder named "Refried PDFs". I wasn't sure if you wanted the stroke weight to be added to the document size. Right now, the script will take a 8.5 x 11 PDF and center it into a 8.874 x 11.374. Tested it here and it works. You can also edit the code to attach it to a mac hot folder by using the "Configure Folder Actions" on your mac so as soon as a PDF will be dropped in, it will trigger the script.

    --Script by Colorblind, tested with Acrobat X and InDesign CS5
    on open pdf_list
    set desktop_path_hfs to the path to the desktop as string
    --the next variable sets the weight of the keyline
    set keyline_weight to 0.187
    repeat with mypdf in pdf_list
    tell application "Finder"
    activate
    set dest_pdf_folder to desktop_path_hfs & "Refried PDFs:" as string
    if not (exists dest_pdf_folder) then
    make new folder with properties {name:"Refried PDFs"}
    end if
    set this_pdf_name to the name of mypdf
    tell application "Adobe Acrobat Pro"
    activate
    open file mypdf
    set b to get crop box of page 1 of active doc
    set w1 to item 3 of b as integer
    set w0 to item 1 of b as integer
    set h1 to item 2 of b as integer
    set h0 to item 4 of b as integer
    set PDFheight to (h1 - h0) / 72
    set PDFwidth to (w1 - w0) / 72
    set pagecount to count every page of active doc
    set idh to PDFheight & " i" as string
    set idw to PDFwidth & " i" as string
    close active doc without saving
    end tell


    set idpage to 1
    set pdfpage to 1

    tell application "Adobe InDesign CS5"
    activate
    set mydoc to make document
    tell document preferences of mydoc
    set facing pages to false
    set page width to idw
    set page height to idh
    set pages per document to pagecount

    end tell
    repeat pagecount times
    set page number of PDF place preferences to pdfpage

    -- the "crop PDF" parameter can be changed to the following: crop content/crop art/
    --crop PDF/crop trim/crop bleed/crop media/crop content/crop art/¬
    --crop PDF / crop trim / crop bleed / crop media

    set PDF crop of PDF place preferences to crop PDF

    set mypdfpage to place mypdf on page idpage of mydoc
    set idpage to idpage + 1
    set pdfpage to pdfpage + 1
    end repeat
    end tell
    end tell
    set idpage to 1
    set new_page_width to (PDFwidth + (keyline_weight * 2))
    set new_page_height to (PDFheight + (keyline_weight * 2))
    tell application "Adobe InDesign CS5"
    activate
    set my_final_destination to dest_pdf_folder
    tell document preferences of document 1
    set page width to new_page_width
    set page height to new_page_height
    end tell
    tell document 1
    try
    set stroke_color to make color with properties {color value:{100, 0, 100, 0}, name:"Overprint Stroke"}
    end try
    repeat pagecount times
    tell page idpage
    set RectangleImage to (make new rectangle with properties {geometric bounds:{0, 0, new_page_height, new_page_width}})
    set stroke weight of RectangleImage to (keyline_weight * 72)
    set stroke alignment of RectangleImage to inside alignment
    set overprint stroke of RectangleImage to true
    set stroke color of RectangleImage to "Overprint Stroke"
    set idpage to idpage + 1
    end tell
    end repeat
    -- You can change "High Quality Print" to any other PDF preset
    export format PDF type to my_final_destination & this_pdf_name using "High Quality Print" without showing options

    end tell
    end tell
    end repeat
    end open
    Better train people and risk they leave - than do nothing and risk they stay.

  3. #3
    kaiserwilhelm is offline Senior Member
    Join Date
    Nov 2007
    Posts
    289

    Default

    I appreciate this script. I will give it to my INDD scripter to try. My only concern is "re-fring" the PDF. We work in an APPE format. I wonder what will become of my unflattened PDF??
    Does anyone from Adobe know? I am SURE they will just gasp at the thought of going into INDD.
    However, I might just use this as a way of making sure I have plate gap and then (if I do have plate gap), using the original PDF?

  4. #4
    Stephen Marsh is offline Senior Member
    Join Date
    Apr 2009
    Location
    Sydney, Australia
    Posts
    578

    Default

    Quote Originally Posted by kaiserwilhelm View Post
    I appreciate this script. I will give it to my INDD scripter to try. My only concern is "re-fring" the PDF. We work in an APPE format. I wonder what will become of my unflattened PDF??
    Does anyone from Adobe know? I am SURE they will just gasp at the thought of going into INDD.
    However, I might just use this as a way of making sure I have plate gap and then (if I do have plate gap), using the original PDF?
    Although the export folder is titled "refried", I personally do not consider *exporting* a PDF to be "refrying". I think of refrying as going to *PostScript + redistilling*. Exporting a PDF of a placed PDF from InDesign is not in the same class, even more so if one is using a PDF version format that does not flatten.

    As mentioned toward the end of the script code, one can use any PDF export preset name, so it is possible to make a custom PDF preset setting to for use with this script (no jpeg, no resampling, no flattening etc).


    Stephen Marsh

  5. #5
    Stephen Marsh is offline Senior Member
    Join Date
    Apr 2009
    Location
    Sydney, Australia
    Posts
    578

    Default

    Colorblind, I tried the script with AcroPro9 & InDesign 5.

    The script reports an error of "data is out of range". The PDF is placed on the ID page, however no stroke colour or stroke is applied and no export takes place (the output folder is empty).

    P.S. Is there code to set the stroke attributes to overprint, rather than just the swatch name?

    I like what you have done so far!

    Stephen Marsh

  6. #6
    leonardr's Avatar
    leonardr is offline Senior Member
    Join Date
    Sep 2007
    Posts
    454

    Default

    Quote Originally Posted by kaiserwilhelm View Post
    I appreciate this script. I will give it to my INDD scripter to try. My only concern is "re-fring" the PDF. We work in an APPE format. I wonder what will become of my unflattened PDF??
    Does anyone from Adobe know? I am SURE they will just gasp at the thought of going into INDD.
    However, I might just use this as a way of making sure I have plate gap and then (if I do have plate gap), using the original PDF?
    As Stephen said, placing PDFs into InDesign and re-exporting is _NOT_ refrying.

  7. #7
    Colorblind's Avatar
    Colorblind is offline Senior Member
    Join Date
    Aug 2007
    Location
    Montreal, Qc, Canada
    Posts
    331

    Default

    @ Leonard

    Thanks for the clarification about "refrying".

    @ Stephen

    As I said, I tested the script here and it works but, as they say, programming is 10% coding and 90% debugging. Will try to have a look. As for you stroke attribute question, in the lines:

    set RectangleImage to (make new rectangle with properties {geometric bounds:{0, 0, new_page_height, new_page_width}})
    set stroke weight of RectangleImage to (keyline_weight * 72)
    set stroke alignment of RectangleImage to inside alignment
    set overprint stroke of RectangleImage to true

    The variable RectangleImage is a reference to the rectangle (or frame) that will have the stroke applied to so the line "set overprint stroke of RectangleImage to true" will overprint the stroke.

    I quickly wrote another script that should set all strokes of rectangles, text frames and polygons in any open InDesign document to overprint, (your mac should beep 3 times when it's done) but as I mentioned earlier, writing the code is only 10% of the work :-) so forgive me if it doesn't work perfectly on your machine.
    That being said, thumbs up to Adobe for implementing so well AppleScript into InDesign and Photoshop.

    set volume 5
    tell application "Adobe InDesign CS5"
    activate
    set dc to 1
    set doc_count to (count every document)

    repeat doc_count times
    tell document dc
    tell layout window 1
    set overprint preview to true
    end tell
    --this is to ungroup all groups or else strokes that are in a group wont overprint
    repeat
    set my_groups to get every group
    if the result is {} then exit repeat
    if my_groups is not {} then
    repeat with this_group in my_groups

    ungroup this_group
    end repeat
    end if
    end repeat
    --end of code to ungroup
    set my_rectangles to (every rectangle whose stroke weight is not 0.0)
    set my_frames to (every text frame whose stroke weight is not 0.0)
    set my_polygons to (every polygon whose stroke weight is not 0.0)


    repeat with this_frame in my_frames
    try
    get this_frame
    set overprint stroke of this_frame to true
    end try
    end repeat
    repeat with this_rectangle in my_rectangles
    try
    get this_rectangle
    set overprint stroke of this_rectangle to true
    end try
    end repeat
    repeat with this_polygon in my_polygons
    try
    get this_polygon
    set overprint stroke of this_polygon to true
    end try
    end repeat
    end tell
    set dc to dc + 1
    end repeat
    end tell
    beep 3
    Last edited by Colorblind; 10-18-2011 at 10:32 AM.
    Better train people and risk they leave - than do nothing and risk they stay.

  8. #8
    kaiserwilhelm is offline Senior Member
    Join Date
    Nov 2007
    Posts
    289

    Default

    Hey, I'm just happy to be a senior member now! Guess it comes when you have the only CiPress 500 digital web press in the nation sitting five feed from your Mac!

  9. #9
    kaiserwilhelm is offline Senior Member
    Join Date
    Nov 2007
    Posts
    289

    Default

    Leonard, I am shocked! Pleasantly shocked! I thought for SURE you would say that that is not a proper way to make a pdf.
    Are you giving me the Adobe blessing to place a pdf in (1.7) and export back out (1.7)?? I might just owe you a beer and or Coke if so.

  10. #10
    Stephen Marsh is offline Senior Member
    Join Date
    Apr 2009
    Location
    Sydney, Australia
    Posts
    578

    Default

    Quote Originally Posted by Colorblind View Post
    @ Stephen

    As I said, I tested the script here and it works but, as they say, programming is 10% coding and 90% debugging. Will try to have a look. As for you stroke attribute question, in the lines:

    The variable RectangleImage is a reference to the rectangle (or frame) that will have the stroke applied to so the line "set overprint stroke of RectangleImage to true" will overprint the stroke.
    Thank you Colorblind for pointing out the part of code about overprinting (obvious now that you point it out).

    And thanks for the script, it is appreciated and I do understand the issues with scripting and coding - so I am grateful for what you have done for the community in this script! As the script errors out before making the spot colour, I am guessing that the problem is somewhere there in the code...

    You have done all the heavy lifting, it is not hard to simply add a new layer above the default and to then create the colour and apply the stroked overprinted frame to this new layer on the master page - then export.


    Best,

    Stephen Marsh
    Last edited by Stephen Marsh; 10-18-2011 at 03:59 PM.


Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Sponsors

Esko Sponsored Content