Skip to main content
Participant
September 15, 2010
Question

Copy contents of 2 layers to new document with javascript

  • September 15, 2010
  • 1 reply
  • 525 views

Hi guys !

Basically i have created a new cutfile generator for a Zund cutting machine we have here at work i have got it to the point where i can create a Registration mark layer and Cut layer now i would like to save this as a layered PDF as this is how the cutter software prefers it. What i would like to know is how with Javascript can I copy the contents of "Regmark" layer and "Cut" layer to a dynamically created new document ? Any thoughts on this will be greatly appreciated thanks so much !

Regards,

Bass

This topic has been closed for replies.

1 reply

Jongware
Community Expert
Community Expert
September 15, 2010

(First thoughts)

* Save As under the new name

* Delete all but these two layers

This might be the best way, because otherwise:

1. You'd have to create a new document, with all properties of the other one (size, orientation, styles, ...)

2. You'd have to loop over these two layers and duplicate all items one by one -- 'duplicate' for a layer cannot be used cross-document.

MRDV81Author
Participant
September 15, 2010

Thanks you so much for your swift response would it be at all possible to show some syntax for the first option otherwise i have been able to copy one layer successfully over although i lose focus of the "activeDocument" and i can nolonger return to it even if i have a variable to it and i cannot find anywhere in any documentation something that will allow me to return focus to a specific window ! any help once again is greatly appreciated i thank all for their time !

Regards,

Bass