20 Replies Latest reply on Jan 19, 2015 8:26 AM by blanko 23

    Copy PDF to clipboard script / shortcut

    blanko 23

      InDesign has the option to set "Copy PDF to Clipboard" on or off in Clipboard Handling preferences.

       

      For copy-pasting in InDesign, I prefer to keep this option turned off, otherwise many artwork easily takes up to 10 seconds or more to render a PDF that I don't need (big / complex artwork can even take a minute, or make InDesign crash).

      For pasting in external applications like Illustrator or Photoshop, PDF is required so I temporarily turn it on.

       

      I use both equally and I find myself turning the option on and off multiple times a day.

       

      I'm wondering, should it be possible to assign a keyboard shortcut specifically to copy a PDF to the clipboard, without the need to turn this option on through the preferences panel?

      For example:

      CMD + C = copy normally

      CTRL + CMD + C = copy PDF

       

      I'm not really into scripting, but I can imagine it's "easy" to assign a shortcut to a script that turns on the option, copies the artowrk, and restores the option again.

        • 1. Re: Copy PDF to clipboard script / shortcut
          Willi Adelberger Most Valuable Participant

          Don't copy and paste into InDesign as it is one of the main sources for corrupted files. Save your artwork as PDF/X-4 and import it to InDesign vial FIle > Place…

          • 2. Re: Copy PDF to clipboard script / shortcut
            Peter Spier Most Valuable Participant (Moderator)

            Willi,

             

            I think you misunderstand the the request. Blanko 23 wants to know if there is a shortcut to toggle the ID prefs for clipboard handling as far as whether a PDF will be rendered when a copy command is issues inside ID.

             

            The default state is to copy PDF to clipboard, and I can't say I've ever seen the delay described above.

            • 4. Re: Copy PDF to clipboard script / shortcut
              blanko 23 Level 1

              Willi, I'm actually talking about copying from Indesign.

              One example is to copy artwork from a print document to Photoshop, to use the image on a website.

              • 6. Re: Copy PDF to clipboard script / shortcut
                Willi Adelberger Most Valuable Participant

                I underestand it. If you want to bring artwork from InDesign to Photoshop, don't use copy paste neither. Export as PDF/X-4 and place as smart object or as linked SO.

                • 7. Re: Copy PDF to clipboard script / shortcut
                  Peter Spier Most Valuable Participant (Moderator)

                  The OP clearly has reasons for wanting to toggle the preference setting, and I don't think it's for us to tell him he shouldn't do it since we have no idea at all of what his workflow is, nor is that relevant to the question.

                   

                  The original problem stated is that leaving Copy PDF to Clipboard slows down production, so he needs it off when doing copy/paste internally (and I think that may be symptomatic of some other problem), but he wants to turn it back on when he needs to paste into some other application. This is a preference choice, and it's a perfectly reasonable request to create a toggle for it.

                   

                  I'm not a scripter, so I can't write the script, but I'm fairly confident it's a one-liner and that's all he's looking for.

                  • 8. Re: Copy PDF to clipboard script / shortcut
                    Eugene Tyson Adobe Community Professional & MVP

                    I have never denied that the op needs a toggle for it. A closer look at their workflow might be a reason for them experiencing slow down.

                     

                    I'm not a scripter either so I haven't offered any advice in that area.

                     

                    The only thing I can do is offer advice on workflow and examine how their workflow may be causing some slowness with the app. And in my experience copying and pasting from InDesign to Illustrator or Photoshop or vice versa can cause slowness.

                     

                    This is a forum - sometimes you ask a question looking for a particular answer. Sometimes there is no answer to the question.

                     

                    If it needs to be scripted they can ask in the scripting forum InDesign Scripting

                    • 9. Re: Copy PDF to clipboard script / shortcut
                      Peter Spier Most Valuable Participant (Moderator)

                      He's not complaining about slowness copy/pasting to other apps, as far as I can tell. He's complaining about it when working inside ID with the default setting.

                       

                      Take a look at your own prefs. Did you turn off copy PDF to clipboard? I never have.

                       

                      I think this points to a problem on his system which may or may not be solvable, but since the default is to copy PDF, the engineers obviously thought it was a good idea to do so.

                      • 10. Re: Copy PDF to clipboard script / shortcut
                        Eugene Tyson Adobe Community Professional & MVP

                        I don't think the engineers make their decisions on whether it's a good idea or not. It's usually that they have 2 settings and they pick one for the sake of it in a 50/50 toss up.

                         

                        There is more at play here other than the setting being checked, as I can't see it being a major player in any slowness within InDesign. The only issue would be if they copy something from InDesign and it's copying a PDF as per the preference.

                         

                        If the PDF is then a complex vector dense it could cause issues - maybe?

                         

                        But - I have never had an issue in this area so I am just guessing.

                         

                        However, the InDesign to Photoshop methods are clear enough - it's not really a good idea to copy and paste from InDesign to Photoshop or vice versa - so working that out of the workflow makes sense.

                        • 11. Re: Copy PDF to clipboard script / shortcut
                          rob day Adobe Community Professional & MVP

                          It is a simple script, this is AppleScript. Set the true false properties as needed

                           

                          tell application "Adobe InDesign CC 2014"

                              set properties of clipboard preferences to {copy PDF to clipboard:false, preserve pdf clipboard at quit:false, prefer PDF when pasting:false, prefer styled text when pasting:false}

                          end tell

                          • 12. Re: Copy PDF to clipboard script / shortcut
                            rob day Adobe Community Professional & MVP

                            don't use copy paste neither. Export as PDF/X-4 and place as smart object or as linked SO.

                             

                            Is cutting and pasting a problem with Windows? Because on OSX I can't see any reason to add the export step. If I set my clipboard prefs to PDF, the pasted object comes into Photoshop as a smart object. If there's an advantage to exporting a PDF/X-4 first I can't see it.

                            • 13. Re: Copy PDF to clipboard script / shortcut
                              Peter Spier Most Valuable Participant (Moderator)

                              Rob,

                               

                              I realize I misspoke about what the script really should be doing (and maybe it should be two scripts). The OP didn't really ask for a toggle (though that's eminently useful), but rather a set of shortcuts to use to copy as PDF or not as PDF.

                              • 14. Re: Copy PDF to clipboard script / shortcut
                                rob day Adobe Community Professional & MVP

                                Right, here are two scripts that include the copy, one for off and one for on. I wonder if the problem could be addressed via the Display Performance preference by lowering the resolution of vector graphics?

                                 

                                --turns off PDF clipboard and copies

                                tell application "Adobe InDesign CC 2014"

                                    set oldclip to copy PDF to clipboard of clipboard preferences

                                    set copy PDF to clipboard of clipboard preferences to false

                                    try

                                        copy

                                    on error

                                        display dialog "No Selection"

                                        set copy PDF to clipboard of clipboard preferences to oldclip

                                    end try

                                end tell

                                 

                                --turns on PDF clipboard and copies

                                tell application "Adobe InDesign CC 2014"

                                    set oldclip to copy PDF to clipboard of clipboard preferences

                                    set copy PDF to clipboard of clipboard preferences to true

                                    try

                                        copy

                                    on error

                                        display dialog "No Selection"

                                        set copy PDF to clipboard of clipboard preferences to oldclip

                                    end try

                                end tell

                                • 15. Re: Copy PDF to clipboard script / shortcut
                                  Peter Spier Most Valuable Participant (Moderator)

                                  Thanks.

                                   

                                  I think if the problem is related to display performance there's a hardware issue (i.e. the hardware just isn't adequate to the task). I bet you've never changed the setting, either, and like me you don't see a performance hit. I suspect it's either hardware, a plugin, or some background utility examining the clipboard.

                                  • 16. Re: Copy PDF to clipboard script / shortcut
                                    blanko 23 Level 1

                                    Ah, another workflow discussion…

                                    I'm quiet a "workflow freak" myself, but even then copy/pasting to external apps is still a part of our crossmedia designing process.

                                     

                                    I think the slowness of the PDF rendering is mostly caused by our slow network, when pulling (very) high res photos. Plus the computer in our office isn't exactly new either… although still usable. But that's something I can't change very soon.

                                     

                                    Rob, those scripts are exactly what i'm looking for! Except… the PDF one doesn't work :).

                                    The script runs fine (I added a display dialog at the end of the script to make sure it does) but the "copy" command in the script seems to copy to clipboard without PDF, no matter to what preference the clipboard handling is set.

                                    As a test I ran the following shortened script with "Copy PDF to clipboard" checked (manually). Still no PDF on the clipboard. Any ideas?

                                     

                                    tell application "Adobe InDesign CC 2014"

                                         try

                                              copy

                                         on error

                                              display dialog "No Selection"

                                         end try

                                         display dialog "Success"

                                    end tell

                                     

                                    Really appreciate the help!

                                    • 17. Re: Copy PDF to clipboard script / shortcut
                                      rob day Adobe Community Professional & MVP

                                      I'm checking the clipboard by pasting into Photoshop after running the script—with PDF on I get a smart object with it off I get nothing—and it's working here. How are you checking the format?

                                       

                                      You have your Success dialog in the wrong spot. It will always display because it's not inside the try block. If you want a confirmation dialog everything has to be inside like this:

                                       

                                       

                                      tell application "Adobe InDesign CC 2014"

                                          try

                                              set oldclip to copy PDF to clipboard of clipboard preferences

                                              set copy PDF to clipboard of clipboard preferences to true

                                              copy

                                              display dialog "Success"

                                          on error

                                              display dialog "No Selection"

                                              set copy PDF to clipboard of clipboard preferences to oldclip

                                          end try

                                      end tell

                                      • 18. Re: Copy PDF to clipboard script / shortcut
                                        blanko 23 Level 1

                                        Thanks for the updated script!

                                         

                                        I just ran a test again: Copy PDF does work now (must have done something wrong the last time), but the "copy PDF to clipboard" setting remains selected now after running the script.

                                        Any ideas?

                                        • 19. Re: Copy PDF to clipboard script / shortcut
                                          rob day Adobe Community Professional & MVP

                                          The script saves whatever preference setting you have before it is run and then restores it after the copy.

                                           

                                          This would uncheck it after the copy:

                                           

                                          tell application "Adobe InDesign CC 2014"

                                              try

                                                  set copy PDF to clipboard of clipboard preferences to true

                                                  copy

                                              on error

                                                  display dialog "No Selection"

                                              end try

                                               set copy PDF to clipboard of clipboard preferences to false

                                          end tell

                                          • 20. Re: Copy PDF to clipboard script / shortcut
                                            blanko 23 Level 1

                                            It's a mystery, either 'copy' command or restoring the preference to the oldclip doesn't work.

                                            I will try it on another computer to test if it's a local problem.

                                            Anyway, your script seems to do exactly what I was asking. Thanks again!