Add Enhanced Metafile (emf) to Illustrator Document

User,
I've done Visual Basic (VB6 and VB.NET) automation with PowerPoint and now would like to work with Illustrator and Photoshop (currently I'm working with Illustrator 10 not CS and VB6 not VB.NET). The PowerPoint interface has similarities, yet it has many differences. The basic idea is to load a number of enhanced metafiles (EMF) into Illustrator. The user specifies the number of rows and cols, then they are opened, move onto the current document then translated and scaled into place. I removed much of the positioning calculations but left the main working code.
Several problems I've run into are list in the comments, but I'll itemize them here.
1) The EMF file must be 'open'ed into a new document, rather than imported or 'add'ed to a desired document. Therefore, I have to move it to the desired document and close the temporary document created by the 'open'
2) The application remains hidden, even after the 'activate'. I can only active a document, not the application object.
3) It is odd, but when I create an executable and run it, the executable finishes before the copy and paste is actually done in Illustrator. This will cause a PARAM error when the next copy and paste is run before the first one is complete. Some type of Synchronization is needed.
' Start Illustrator
Dim aiApp As New Illustrator.Application
Dim docRef As Illustrator.Document
Dim ext As String
Dim target_height As Integer
Dim target_width As Integer
' Add a new document if needed
If (aiApp.Documents.Count = 0) Then
Set docRef = aiApp.Documents.Add
Else
Set docRef = aiApp.ActiveDocument
End If
' This doesn't work as documented,
' the application remains hidden
If (Not aiApp.Visible) Then docRef.Activate
' ... calculation of positions removed
' open EMF file into GroupItem
Dim tmp_doc As Illustrator.Document
Dim new_grp As Illustrator.GroupItem
' start a new doc if this one is too full
If (docRef.GroupItems.Count >= cols * rows) Then
Set docRef = aiApp.Documents.Add
End If
' open the emf into a temporary document
' this is the only way I could import the emf
' I'd like to import it directly to the desired location
Set tmp_doc = aiApp.Open(file)
' I had two different options here, either copy and paste
' or use one of the move commands like moveafter
If (tmp_doc.GroupItems.Count > 0) Then
' grab the emf info, copy it, then close the temporary doc
Set new_grp = tmp_doc.GroupItems.item(tmp_doc.GroupItems.Count)
new_grp.Copy
' close the temporary document
aiApp.ActiveDocument.Close (aiDoNotSaveChanges)
' paste the new group item to the active document
docRef.Paste
Dim gi As Illustrator.GroupItem
Set gi = docRef.Selection(0)
gi.Position = Array(wpos, hpos + orig_height)
' gi.Left = wpos
' gi.Top = hpos + orig_height
' I've also played with the .MoveAfter method, rather than copy
' and paste.
Else
Debug.Print "No group items"
End If
' scale to desired aspect ratio
' probably could use a transformation here
If (ratio_height < ratio_width) Then ratio_aspect = ratio_height
gi.Width = gi.Width * ratio_aspect
gi.Height = gi.Height * ratio_aspect

By the way, I do not use the CreateFromFile command:
aiApp.ActiveDocument.GroupItems.CreateFromFile (file)
because the EMF file is added to the document, however I then receive an "internal error" - PARM and an error code.

Similar Messages

  • [Ai-CS4] How to add an  art board to existing document ?

    hi all,
    can anybody suggest me how to add a new artboard to existing document? I didn't find any ArtBoard Palette in CS4. But in CS5 it is given.
    thanks,
    D.A

    The Artboard panel is new to AiCS5. In CS4, a new artboard can be added by doing either of the two:
    1. Pick the Artboard Tool and click-drag it in the canvas area of the Illustrator document.
    2. Pick the Artboard Tool, click on the 'New Artboard' button in the Control Panel. Then select the desired size from the list of Artboard Presets in the Control Panel and then click in the desired area of the canvas to add a new Artboard.
    Hope this helps.
    Neeraj

  • Place an SVG into an illustrator document through Javascript(Extendscript)

    Hi,
    I'm trying to place an svg in illustrator using extendscript. Here's basically what I'm doing
    var doc = app.documents.add(); var p = doc.placedItems.add(); p.file = new File(svgfilepath);
    This fails with the error
    File is in a format that cannot be placed
    I am able to place the same file manually using File > Place. Am I missing some thing? Need help!
    [SO Link]

    Hi, try the following:
    // Reference: https://forums.adobe.com/thread/1722322
    // Assumes you have an open Illustrator document
    // and an SVG file on your desktop named: testSVG.svg
    // Basic Example:
    // Tested and worked in Illustrator CS5 / OS X
    var doc = app.activeDocument;
    var svgFile = File(Folder.desktop + '/testSVG.svg');
    doc.groupItems.createFromFile(svgFile);
    Tell Jongware at "SO" hello, and that he is right about the Illustrator JS Team. ;-) Also for future reference, we have an Illustrator Scripting forum here.

  • Can you export images which have been pasted into an Illustrator document as separate files?

    I have a multi-page Illustrator document (over 50 artboards) which contains lots of images that are all saved within the document (not linked in from seperate files) and all the images need to be exported as separate image files (similar to when you package a file in Indesign). The problem is the files are not linked, they are all saved within the document.
    Want to avoid having to copy + paste every image into a new document in Photoshop and save individually as this will take forever.

    Save the document as a PDF and Open in Photoshop. Select only the Images in the Open dialog and proceed from there.

  • Illustrator document thumbnail previews not showing in finder window

    I am trying to find a way to view Illustrator document thumbnails (CS,CS2,CS3 and CS4) in Finder windows. Other documents such as .tiffs, jpgs, etc and Word and .pdfs show but not Illustrator.
    I used +show view options+ in the Finder, turning on and off show icon, show icon preview and show preview in column. The options seem to affect all other files but not Illustrator. All I get is the application icon but not the document thumbnail. Interestingly, I discovered if I manually delete the .ai extension the documents thumbnail appears, so I tried to turn off the +Show all file extensions+ in the Finder's Preferences. It changed other files but not Illustrator. Does anyone know how to accomplish this on a global basis without manually changing each files extension? It would allow me to the use of Quick Look on these files also. I did speak to Adobe and they thought it was an OS issue.

    This is a 'known' issue. Try SneakPeek Pro

  • How do I add an overall border to my document?

    Hello.
    Just wondering how to solve this one that has perplexed me for awhile.  I know that there's a solution, but cannot seem to locate it when I need to.
    Here's my question as I put it to the Pages Help Feedback people:
    I have a document I have created in Pages.  It is all done, and includes text boxes full of text, and several inserted several pieces of artwork, imported pdf's.  I could not figure out how to add a border around all of the document, so I went to Pages help, where I punched in "Adding Borders", and up came the title "To add borders and rules to your document".  This looks straightforward enough, I thought.
    Not so fast.  Here are the first two instructions: "1. Select the text to which you want to add borders and rules." I selected all the various text boxes.  "2. Click Inspector in the toolbar, click the Text button, and then click More." Did that too.  When I chose a border, it placed a border around only one of the text boxes.  Now I am stymied.  I want to put a border around the whole document, but there are no other solutions here, even after I have read for clues on the entire help page.
    I will not get a response from them, so I am turning to you.  I do have some idea that it might have to do with a document vs a poster, and I believe I set up my project to be a poster, if that can be useful here.  
    Thank you in advance for any help.
    Cea

    It says "Select the text to which you want to add borders and rules." That is the text in the text layer in a word processing document, not text boxes.
    Do you have a word processing document or a page layout one. Tells you to the right of the document name.
    You could use a shape object with a Border but without Fill. It shouldn't have any wrap and then Send objects to  background after you have resized it and duplicated if you need it for the next page.

  • How do I add XML content to existing FrameMaker Document

    Hello,
    I have an XML document that contains features of one item and I want to add data from it to FM document that shows those features. These features have been added to FM previously by copy-paste technology which isn't obviosly the fastest way and I have understood adding them automatically is possible.
    I can read XML well and I can produce XSLT files to make another XML files, problem is that I'm a little beginner with FM and help files didn't show any good examples of this (or at least I didn't find). I tried to do some read/write rules, because it seemed to be the way how FM handles these things but they didn't work.
    So shortly: XML file (data) + FM file (tables and such) = FM file which have XML data in its tables
    I would appreciate any help, like pointing to right help files or such, thanks in advance.

    The two main references you need are:
    Developing Structured Applications with FrameMaker, Guide
    Developing Structured Applications with FrameMaker, Reference
    They used to ship with FrameMaker, but you can download them from the Adobe site. Check the Support section. I do not believe they are available for FrameMaker 10 yet, but they are for version 9. No matter your FramMaker version, almost any set will do.
    Basically, you need an XSLT that will translate the XML structure into the structure you use in your FrameMaker files. You need a set of read/write rules (see the references above). FrameMaker uses read/write rules to specify how certain FrameMaker objects are to be translated from the XML. Such objects include tables, variables, and markers.
    Then you need to create a structured application that specifies where the XSLT, the read/write rules, and your structured template are located on you system.Again, see the references.
    Once all of the above is in place, you open the XML file from within FrameMaker. FrameMaker will ask you what structured application to use, which you pick from the dropdown list. It will then open the XML file, apply the XSLT transformation, and copy the result into your structured blank template. That process will likely list several errors, which you may or may not be able to ignore depending upon the resulting FrameMaker document. In my case, these are usually errors about missing graphics, which I already know are missing.
    The result is ONE FrameMaker file. You can then copy and paste the information where ever you need it in your other documents. I am not sure whether you can import an XML file into an existing Framemaker document, much like a text inset. Maybe others will know.
    Good luck,
    Van

  • How do i add a second page to a document in Pages 5.2.2

    How do I add a second page to a document in Pages 5.2?

    Hello jeddi17,
    You can insert a page break with the Insert (menu) > Page Break.
    Note if your typing overflows the first page, then a new page is automatically created.
    Pages for Mac 5.0: Change the flow of text
    http://support.apple.com/kb/PH15334
    Force text to the next line or page
    A line break, also called a soft return, starts a new line without starting a new paragraph. A page break moves the next line of text to the top of the next page.
    Click where you want the break to occur.
    Do one of the following:
    For a line break: Press Shift-Return. 
    For a page break: Click Insert in the toolbar, then choose Page Break.                                
    Take care,
    Nubz

  • How do I add a background color to a document in Pages?

    How do I add a background color to a document in Pages?  I have made an invitation, with a photo in it, the text is in color, and I want to make the background pink instead of white.  thanks

    whoops sorry figured it out thanks!

  • How do I add an electronic signature to a document?

    Hello and thanks in advance for your help.  How do I add an electronic signature to a document?

    Sergio
    Glad you stepped in and elucidated my inadequate explanation.
    Step by Step explanations of the problem will get Step by Step instructions, but its been a week and the O.P. hasn't elaborated on what they actually want.
    You may consider it a horrible answer, what was your opinion of the question?
    Peter
    PS I looked hard but couldn't find a reference to Preview in my post.

  • I have Microsoft Word for my MacBook Pro.  How do I add a pdf to a word document, I have Microsoft Word for my MacBook Pro.  How do I add a pdf to a word document

    I have Microsoft Word for my MacBook Pro.  How do I add a pdf to a word document, I have Microsoft Word for my MacBook Pro.  How do I add a pdf to a word document

    What do you want to do specifically.  They are two different document formats - one is PDF, the other DOC or DOCX.  In what way do you wish to "add" ad PDF to a word document. You can embed a mini version within a document (copy it and paste it from within the x.doc) but that's a pretty hokey looking solution.
    Oh, its mostly irrelevant if its office 2004,8 or 11 - they all do this more or less the same way.
    G

  • Please, help... I need to convert an Illustrator document into .pdf

    Does anybody can help me? I have a document in Adobe Illustrator Artwork 12.0 but don't have the program to open it (and don't know which one I need)
    If I send the document, could you please convert it into .pdf or word. It's a letterhead for the church I work at.
    Thank you very much.

    E-mail the Illustrator document to me at the following address:
    harron {at mark} kurakichi {dot} com
    If you can, put the .ai document in a .zip archive before e-mailing.

  • Splitting an Illustrator document on several pdf-Files including cutting marks

    Hello, I am new to the CC version and I wondered if it is possible to automatically split a bigger Illustrator document to smaller (printable) pdf files.
    Right now i am having this kind of workflow:
    Drawing on a big sheet - e.g. A1
    Inserting "frames" size 18 x 26 cm in en extra layer
    inserting "Glue here" marks with numbers, which then are supposed to be glued together when printed
    cutting all lines on frame edges (This is still an issue for me in Illustrator CC - it worked with CS5 much better - there it was automatically snapping to the intersection point - got anybody also help for that??? )
    copying each single frame and its content onto a new A4 document
    exporting as png
    inserting the pages into word, creating a pdf file
    as you see - this process ist pretty long and time consuming, and no - I CAN'T just get it with my printer, because I wand that exact cutter marks in my pdf document.
    Is there any way I could possibly automate that process - at least to some extent?
    greetings
    Sophie

    so how do I do that?
    I mean i just have one canvas i drew on, not a multipage ai file

  • Can I use ExtendScript to store info about an Illustrator document externally and recover it later?

    What I want to do is this:
    1. Iterate through all the layers in a document (recursively) and discover each layer's NAME, VISIBLE, and LOCKED properties.
    2. Create an object that contains those properties.
    3. Push the object onto a second array.
    4. Store that second array somewhere, preferably in a file (text?) in the same directory as the AI document.
    5. Load that file at a later date as an object array.
    6. Use the object array to iterate through the illustrator document to conform the current state of that document to the stored states in the array.
    Ideally I would like to be able to store a number of separate states in the same document and refer to them somehow.
    As you may have guessed by now, this is my attempt to make a LayerComps feature for Illustrator that I could use to turn visibilities on and off and then export the result, moving on from one state to the next until all the states I am interested in would be exported. I would settle for being able to do it one at a time.
    I can already do steps 1-3 (shown in blue).
    var doc = app.activeDocument;
    var docName = doc.name;
    var layerStates = [];
    var layerCount = doc.layers.length;
    var count = 0;
    function addLayers(layerArray) {
            for (var i=0; i<layerArray.length; i++) {
                // create an object representing a layer state
                var o = {};
                o.name = layerArray[i].name;
                o.visible = layerArray[i].visible;
                o.locked = layerArray[i].locked;
                layerStates[count] = o;
                count++;
                // if this layer has layers of its own, iterate through those
                if (layerArray[i].layers.length > 0) {
                        addLayers(layerArray[i].layers);
    addLayers(doc.layers);
    // show that we did something, incomplete though it is
    var s = "";
    for (var i=0; i < layerStates.length; i++) {
            s += layerStates[i].name + ": ";
            s += (layerStates[i].visible ) ? "visible" : "invisible";
            s += ", ";
            s += (layerStates[i].locked ) ? "locked" : "unlocked";
            s += "\n";
    alert(s);
    I don't know if it is possible to export that data as XML or even a text string and save it as a file on the file system for later parsing. Anyone have any thoughts about this? Is it possible?
    Currently I am using a restrictive version of a LayerComps script I created, which iterates through a top layer's sublayers, turning each on and exporting as PDF, then turning it off and moving to the next. This is more convenient than doing it by hand, but it really forces me to compartmentalize all "views" of a document in a way that does not lend it self to efficiency and forces redundant copying of pathItems between layers.
    Thoughts?

    Also good, and thanks again for your help. I wasn't sure if ExtendScript implemented the eval() method, necessary to re-objectify a JSON string, because I can't find it in the documentation, but I do see it used in some examples elsewhere. I've successfully written XML files at this point, and when I get a few minutes I'll work on the reading/modifying/exporting part. In the long run, XML files are easier to read, manipulate and maintain, so I'll probably go that route.
    var doc = app.activeDocument;
    var docName = doc.name;
    var xml = new XML("<root></root>");
    var layerStates = [];
    var layerCount = doc.layers.length;
    var count = 0;
    function addLayers(layerArray, xmlObj) {
        for (var i=0; i<layerArray.length; i++) {
            // create an object representing a layer state
            var lay = layerArray[i];
            var x = new XML("<layer/>");
            x.@name = lay.name;
            x.@visible = lay.visible;
            x.@locked = lay.locked;
            xmlObj.appendChild(x);
            layerStates[count] = x.toXMLString();
            count++;
            // if this layer has layers of its own, iterate through those
            if (lay.layers.length > 0) {
                addLayers(lay.layers, x);
    addLayers(doc.layers, xml);
    var xmlFile = new File();
    xmlFile.open('w');
    xmlFile.write(xml);
    xmlFile.copy ('C:/Program Files (x86)/Adobe/Adobe Illustrator CS4/Presets/en_US/Scripts/data.xml');
    xmlFile.close();
    All in all, the documentation for this stuff leaves a little something to be desired. My original question had more to do with how file read and write text streams was handled. The answer was actually much simpler than I anticipated. All this stuff is, once you get a handle on it, but the docs are so stingy on particulars — does it really help us to know about the XML class merely that it "wraps XML into an object" or that XML.attribute(name) "returns a list containing all attribute elements matching the given name"? I finally worked it out for myself that the XML object may be manipulated using dot syntax (x.name, x.@name), but that was certainly not mentioned anywhere.
    Ah, well. The journey is the reward, right?

  • How to add a dropdown menu in flash document (.swf, .fla) ??

    How to add a dropdown menu in flash document (.swf, .fla) ??
    as i am developing a website for my semester proj, i need to add some flash contetn in the website..
    here is the link, http://www.mediafire.com/?wnx1jkwkkx9c118
    Check Out..
    the thing is i want a dropdown list/menu in "language selection - tab " (check the html page in above link).. plz help me out..
    Thank You,
    sairam

    For Flash questions check the Flash Forums. 
    http://forums.adobe.com/community/flash
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com/

Maybe you are looking for

  • My iPod Touch 4g not visible in Windows or iTunes

    My iPod Touch 4th generation is not visible in Windows or iTunes. It also doesn't seem to want to charge. I've tried the Troubleshooting Assistant but nothing happened. Any ideas? It was working fine last night, and this morning started acting wonky.

  • SETTINGS REVERTING

    Hey all So this is a weird one, has anyone every opened a project and the sequences within that project have reverted to DV-PAL from 10bit Uncompressed when it was saved?? This is a large file thats causing problems with crashing and the lot but Sequ

  • Subject: RE :(forte-users) Web enterprise & user visibleservice Objects

    A few months ago we faced a similar problem while migrating from classic Forte to Web. We had to protect our investment in various frameworks that we wrote for the classic Forte apps, which made use of extensive user-level-caching among other things.

  • Downloading from catalogue to dvd - only allows cd download

    Just started using - works well until I want to download to external medium: whether I go through File or Share, the choice is only to "burn to cd", and if I follow that route, the "Burn to cd" page option to select a drive only shows my CD drive (D)

  • Mail in Lion - Deleted Plug-In... need it back :(

    Hello! I have a Macbook Pro running osx Lion and i was having issues with Growl Mail so i tryed to delete the plug in but ended up delted something about the attachments and now i get a missing plug in notice. I tried to go into my trash but i emptye