Copy the selection into a new document

Here's a breakdown of what I am wanting to do... any guidance would be appreciated!

1. the user will select the elements (blocks of text, items, transparent path)

2. the user will execute a script that will do the following...

1. open a new document (8.5 "x 11") with RGB color

2. anything with a color fill should get gray 100% fill applied

3. anything with an outline of color should get 100% of applied gray race

4. then save a .ai file and a PDF in the following format...

#target illustrator


var doc = app.activeDocument;
var fileName = doc.name;
var jobName = (fileName).substr(0, 11);
aiFile = "D:\\Jobs\\"+jobName+"\\AI\\Cover Page.ai"  
pdfFile = "D:\\Jobs\\"+jobName+"\\PDF\\Cover Page.pdf"  


var newaiFile = new File(aiFile);  
doc.saveAs (newaiFile);  
  
var pdfOpts = new PDFSaveOptions();      
pdfOpts.pDFXStandard=PDFXStandard.PDFXNONE;  
pdfOpts.compatibility = PDFCompatibility.ACROBAT5;      
pdfOpts.preserveEditability = false;  
var newpdfFile = new File(pdfFile);      
doc.saveAs(newpdfFile, pdfOpts);






OK, so I got it away square to where the art jury moves selected items. Someone else wrote the code to move the jury art to the selected items, and I modified to fit my needs. So that being said, a big thank you to pixxxel schubser to get the code for the part (found here... ( https://forums.adobe.com/thread/1336506 )

Here is the code for anyone to see/modify/use!

#target illustrator

var newDocSet = new DocumentPreset;
newDocSet.title = "Cover"
newDocSet.width = (8.5 * 72);
newDocSet.height = (11 * 72);
newDocSet.units = RulerUnits.Inches;
newDocSet.colorMode = DocumentColorSpace.RGB;

var doc = app.activeDocument;
var selectedItems = doc.selection;

if (selectedItems.length > 0) {
    var newDoc = app.documents.addDocument(DocumentColorSpace.RGB, newDocSet);
    for (var i = 0; i < selectedItems.length; i++) {
        var newArt = selectedItems[i].duplicate(newDoc, ElementPlacement.INSIDE);
    }
} else {
    alert("nothing selected");
}

// to move the new document artboard over to the selected items
var doc = app.activeDocument;
var selectedItems = doc.selection;

    var abIdx = doc.artboards.getActiveArtboardIndex();
    var actAbBds = doc.artboards[abIdx].artboardRect;  

    var vBounds = selectedItems[0].visibleBounds;
    vBounds_Li = vBounds[0];
    vBounds_Ob = vBounds[1];
    vBounds_Re = vBounds[2];
    vBounds_Un = vBounds[3];  

if (selectedItems.length >1 ) {
    for (i=1; i vBdsI[0] ) {vBounds_Li = vBdsI[0]};
        if( vBounds_Ob < vBdsI[1] ) {vBounds_Ob = vBdsI[1]};
        if( vBounds_Re < vBdsI[2] ) {vBounds_Re = vBdsI[2]};
        if( vBounds_Un > vBdsI[3] ) {vBounds_Un = vBdsI[3]};
        }  

    doc.artboards[abIdx].artboardRect = [vBounds_Li +((vBounds_Re - vBounds_Li)/2-(actAbBds[2]-actAbBds[0])/2), vBounds_Ob -((vBounds_Ob - vBounds_Un)/2+(actAbBds[3]-actAbBds[1])/2), vBounds_Li +((vBounds_Re - vBounds_Li)/2-(actAbBds[2]-actAbBds[0])/2)+(actAbBds[2]-actAbBds[0]), vBounds_Ob -((vBounds_Ob - vBounds_Un)/2+(actAbBds[3]-actAbBds[1])/2)+(actAbBds[3]-actAbBds[1])];
    } 

// save .ai and .pdf file to correct locations, then close the file
var allDocs = app.documents;

for(var i = 0; i < allDocs.length; i++){
var fileName = allDocs[1].name;
var jobName = (fileName).substr(0, 11);
aiFile = "D:\\Job Number\\"+jobName+"\\AI\\Cover.ai"
pdfFile = "D:\\Job Number\\"+jobName+"\\PDF\\Cover.pdf"  

var newaiFile = new File(aiFile);
var doc = app.activeDocument;
doc.saveAs (newaiFile);
saveAI();

var pdfOpts = new PDFSaveOptions();
pdfOpts.pDFXStandard=PDFXStandard.PDFXNONE;
pdfOpts.compatibility = PDFCompatibility.ACROBAT5;
pdfOpts.preserveEditability = false;
var newpdfFile = new File(pdfFile);
doc.saveAs(newpdfFile, pdfOpts);
}

function saveAI( path, name, id ) {
  var saveOpts = new PDFSaveOptions();
  saveOpts.compatibility = PDFCompatibility.ACROBAT6;
}
doc.close(SaveOptions.SAVECHANGES);

Tags: Illustrator

Similar Questions

  • Copy to merge to a new document

    I have problems of creating a script for copymerge the current selection into a new document. I need a way to get the dimensions of the current selection to create a new document of the same size to stick in, but I can't find a way to do this.

    Any help would be appreciated.

    I wonder if that's what you want?

    He firstly a selection.

    function main(){
    var doc = activeDocument;
    var mainDoc = doc;
    try{
    SB = doc.selection.bounds;
    }catch(e){
        alert("No selection has been made");
        return;
        }
    executeAction(charIDToTypeID( "CpTL" ), undefined, DialogModes.NO );
    dupLayers();
    app.activeDocument.trim(TrimType.TRANSPARENT,true,true,true,true);
    activeDocument=doc;
    doc.activeLayer.remove();
    }
    main();
    function dupLayers() {
        var desc143 = new ActionDescriptor();
            var ref73 = new ActionReference();
            ref73.putClass( charIDToTypeID('Dcmn') );
        desc143.putReference( charIDToTypeID('null'), ref73 );
        desc143.putString( charIDToTypeID('Nm  '), activeDocument.activeLayer.name );
            var ref74 = new ActionReference();
            ref74.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
        desc143.putReference( charIDToTypeID('Usng'), ref74 );
        executeAction( charIDToTypeID('Mk  '), desc143, DialogModes.NO );
    };
    
  • can moving layers between files, be done apart from copy and paste into a new layer?

    moving layers between files

    can it be done apart from copy and paste into a new layer?

    If you want to copy (not move) a layer to another file, click and drag the layer in the layers Panel on the other image.

    'Move' means remove the layer from the source file.

  • Acrobat 9 Pro: cannot copy the selected text unless I have a highlighting of the text

    I highlighted the text in a document. When I go to copy this text, it selects the whole sentence. I right click, the menu starts with "set status. There is no option "copy". No control-C is successful. When I paste then, he pastes a previously selected text, not the text I'm trying to copy in Acrobat. The only way I found to copy the selected text to the United Nations is a development and then copy it. Are there other solutions?

    Thank you!

    Play with the Shift key... you will get it.

  • Getting the name of a new document returns an empty string.

    When I try to get the name of a new document name an empty string is returned.

    Why this is happening? Is it possible to get the "Untitled1.fm" I see in the application Adobe FM 2015?

    It's the FDK API call that I use:

    F_ApiGetString(FV_SessionId, docId, FP_Name);
    

    Try FP_Label instead of FP_Name.

  • When I make a selection using the lasso and try to copy the selection, nothing is copied.  Why?

    I have PhotoShop CS6 for Mac, version 13.0.6.  When I make a selection using the lasso (or any other selection tool) and select 'Copy' and try to move the selection copied, nothing is copied.  What is going on?  I can't find an answer in my search for Abobe PS or the Web site, in general.

    If you still use the selection tools when you try to move the contents of a selection, it will simply move the selection. If you want to move the content, use the tool move (but be aware that the default action is to cut; use Opt (Alt on Windows) to copy the selection by dragging).

  • Copy the file into BPEL

    I want to copy a file to both folders and then delete the original file in a BPEL process. The file is large (100 MB), so I don't want to read the contents of the file. In addition, the process is started by another process, so I'll have to do the synchronous copy or read/write.
    Is this possible in BPEL 11 g?

    I also faced the same problem.
    You can use Sync Read to copy the file into the file system. Check the details here:

    http://docs.Oracle.com/CD/E21764_01/integration.1111/e10231/adptr_file.htm#CHDEEDGC

    You need to replace the options in the file JCA that these options are not available in the wizard. Test and let us know if it works.

  • When you copy work of a single document in Illustrator and then paste into a new document, some of the graphics change position outside the creation?

    This problem appeared in the last two months. My clients submit illustrations for the printing of labels and I copy their art on their original document and paste it into one of my models. Several times now, when I paste their art on the art Board in the new document, some of the graphics will be seen like they have changed and thumb or down and to the left. However, when you view the document in 'outline' mode, all of the graphics are actually properly positioned.

    Here's the kicker, in preview mode, if you directly select one of these wrong previewing objects and move, then immediately cancel this action and return to the "normal" display mode, all of a sudden it will preview correctly and the problem is solved. Its more than a boring bug than anything, but he throws a monkey wrench into my workflow from time to time.

    Preview bug seems to affect only segments of track line or forms with traits applied to them. It didn't happen with text or objects with fills only and it didn't happen with placed graphics.

    There is no relationship between this preview bug and the 'effects' applied to the objects. They are essentially just objects that can be displayed out of position until you move and then cancel this action.

    This started happening when I upgraded to Illustrator CC 2015.

    Also, I disabled because that literally turned my Mac Pro in a Ford Pinto so that isn't the cause GPU.

    All this experience?

    Keith,

    The issue should be resolved with the new patch/update, 19.1, that should solve known issues unresolved with 19.0.1.

    If she does not appear, disconnect and then reconnect the creative cloud application. After that, the 19.1 update must be visible in the creative application of Cloud.

    Default you can keep moving or scaling of the work affected (a little) and then Ctrl / Cmd + Z to undo, to get it in place.

    Or you can turn paste remembers layers in the layers panel, if you can live with the side effects.

    Returning to the CC 2014 will also rid you, of course.

  • Having a color changing the question when you copy and paste things into a new document

    Hello, I had a question about copying and pasting in photoshop (something I thought I'd be able to handle).  See the screenshots below:

    First with the move selected tool, I went to command + click on the dark blue model below to highlight and select its layer.  Then, in the following screenshot with the marquee tool, I was trying to copy a square piece of 100 x 100 px of the model.

    Screen Shot 2014-12-03 at 4.31.04 PM.png

    After hitting the command + c to copy, and then I opened a new document with the following and click settings on ok:

    Screen Shot 2014-12-03 at 4.36.11 PM.png

    I knocked and then command + v to paste what I had copied the new document that I created.  However, the part gets confused me is that the color of the background pattern that I copied and pasted is now a different color, as shown below:

    Screen Shot 2014-12-03 at 4.27.38 PM.png

    The glued color is obviously much darker than the original.  Anyone know what is happening here?  Very confused.

    Some how you have copied a composite instead of the layer + styles.

    Try this instead, select the layer as you did

    Create a new document as you did

    Use the move tool and drag the document on the tab of the new document with the mouse still down, drag your document down to the new document.

    Because your new document is set to 100 x 100 is what adapts the layer, so you should be good to go.

    If you still have a question of color or something has not transferred correctly let us know.

  • I want to copy the selected pages of a PDF file in a new PDF file

    I have the trial version free adobe DC

    I have the following instructions:

    Open the PDF that you want to extract and combine files

    Click CREATE

    Choose - to combine files into a single PDF

    In the upper left corner, click on: Add files, and choose Add open files

    You get a sound box with all open PDF files, choose the one you want to work with, click it and then click Add files

    You are on the main box to combine files.  IN the upper right corner to choose - only PDF file

    On the background, click Select the Pages

    Now click on Pages:, and then in the box empty, type the pages you want extracted.  Example: 5-21, 48-58, 76, 77

    Click on 'Ok '.

    Now, on the bottom right, click on - "combine files".

    You will get a binder with the selected pages.

    However, I don't see a box to type in the pages I need.

    Have I not the right version of Adobe?

    Extract pages:

    Tools > organize Pages > excerpt

  • Complete beginner! How to cut and paste a logo of AI into a new document in illustrator?

    Hello

    I am very new to illustrator and trying to use it for work so my apologies if this question is inept. I have a file with 2 logos inside illustrator and I want to copy / paste them into a pdf file that I am trying to change. Can someone give me a guide step by step to fix this problem? It would be much appreciated.

    File > open the PDF file.

    File > open logo

    Select it with the Selection tool

    Edition > copy

    Change other document

    Edition > paste.

    You can take a look at the documentation.

    Illustrator help | Illustrator help

  • When I copied the images in a new folder and want to see them they do not appear in this order!

    I save all my pictures in Windows Photo Gallery. I create a new folder on the desktop for example and copy photos, then I klick to the first image to start the search, click on the arrow to view the next photo, but they come in mixed order and not in the same order, I copied the. I tried to rename the when they are copied, but who can help doesn´t. What's wrong?

    I save all my pictures in Windows Photo Gallery. I create a new folder on the desktop for example and copy photos, then I klick to the first image to start the search, click on the arrow to view the next photo, but they come in mixed order and not in the same order, I copied the. I tried to rename the when they are copied, but who can help doesn´t. What's wrong?

    ===============================================
    Photos will be AutoSort first alphabetically then digitally.

    To maintain a certain order during the copy in a new folder or
    for a CD... try renaming the files when they are in the order
    you prefer as follows:

    Organize files the way you want and go to... Edition / select all.

    Right-click the photo 'first' the selected (highlighted)
    Group and from the menu choose... Name change.

    For the first name... Enter a descriptive word for the group,
    a space, and the first number

    Summer vacation (10001) .jpg

    (Yes... Use parentheses and start the number with a 1)
    (If you want to add a descriptive title to batch... Leave a
    space after the last letter and before the first parenthesis)

    Press on... Enter and Windows renames the remaining photos...

    Summer vacation (10002) .jpg
    Summer vacation (10003) .jpg
    Summer vacation (10004) .jpg

    Good luck...

  • Copy the selection to a string

    Is there anyway to enter the selected text in a flowComposer and copy of a string for use in another control?
    I spent in through all the api textlayout to the selectionmanager and editmanager and cant seem to find a way to do so, or to convert a TextScrap into a string... any clues anyone?

    Is not too hard to do, but it is perhaps not completely obvious. You were directed in the right direction with the selection/EditManager. I think that the easiest would probably call createTextScrap() on selection/edit Manager, giving you a TextScrap object that has a public "textFlow" property that contains only the text box selected. Then you can move only the text stream to the exporter who will convert the flow of text in a simple string.

    To get your string, you should do something like (didn't test this, but I think it should be close):
    var scrap: TextScrap = editManager.createTextScrap ();
    var selectedText:String = TextFilter.export (scrap.textFlow, TextFilter.PLAIN_TEXT_FORMAT, ConversionType.STRING_TYPE) as String;

    It seems that it would be a good idea to incorporate a practical method of the SelectionManager class that performs this task for you, but I don't think that there is something like that right now.

    I hope this helps!
    -Brent

  • copy the address book to new computer

    Hi all. I have a Mac Pro 1.1 running OS X 10.6.8 and a Mac Pro 3.1 10.9.5 running. I'm upgrading to an iphone 4 to a 6 s more. I have serious duplication of notes, contacts, and calendar for the last 5 years issues. My iphone 4 has hundreds of dups of the contacts and notes that would not remove for nothing. So I went through all the notes and contacts and all the destruction, updates, etc. in the old mac pro (which can't go beyond the current OS X), and cannot load the latest version of itunes to connect iphone more than 6 s. So, I'm in a bit of a bind to get the new phone in place. My thought is put in place the new phone on the newer computer as a new installation, so not to risk the old corrupt Info more back ups on the old computer becomes a problem. But since I can't (even if I wanted to) connect the new phone to itunes of the older for synchronization computer, I would like to copy the address book complete, all notes, and calendars of the old mac pro, place items to the appropriate locations on the 3.1 mac pro thus having immediate access to all of my calendars, contacts and notes in order to sync/upload their new phone with ios fresh install it. I have some info in contacts, notes and calendar for the new mac pro communities, but don't mind deleting all the old mac pro news. So, I'm looking most of convemient and precisely to transfer such info from old mac pro to new mac pro to have available for my new phone.

    Sorry for the long question, but I try to be as complete as possible in order to get the best help possible specific to my question.

    Thanks in advance.

    You can share messages, calendars and Contacts under Snow Leopard. If you have stage 2 verification enabled on your Apple ID, you need generate a password for specific application to Mail, iCal, and address book. Apple ID - manage

    ICloud - book and iCal Snow Leopard

    ICloud Snow Leopard - iCal

    ICloud Snow Leopard - set up email with Mac OS X 10.6 or iOS 4

  • How to bypass the Inspector with a new document?

    In the Pages 5.6.1 How can I open a new document, a model, without opening the Inspector? I find no way to disable or stop the Inspector.

    I searched these support pages and google, & get dry on this. Anyone...?

    Note: I don't want to do this in older versions of Pages. And using fullscreen mode is not a good workaround solution; I need to see my Finder Windows, while I open new Pages documents.

    Thanks in advance for your suggestions!

    You mean the Model Viewer, not the Inspector.

    You can always save a template somewhere on your desk and opens by double clicking it or offer in the Pages of preferences as the default template.

    Peter

Maybe you are looking for