Skip navigation
Currently Being Moderated

Shrink Artboard to fit content

Jul 4, 2008 1:24 AM

I've been searching everywhere for a script or plugin that will shrink the artboard to fit the content. Fireworks has a feature like that. Has anyone done this in Illustrator?
 
Replies
  • Currently Being Moderated
    Jul 4, 2008 2:57 PM   in reply to (hakoon)
    Why would you want to shrink the artboard? Are you sure you don't mean the pagesize?
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2008 9:41 AM   in reply to (hakoon)
    From the Help files for Illustrator CS3:

    The printable area is bounded by the innermost dotted lines and represents the portion of the page on which the selected printer can print. Many printers cannot print to the edge of the paper.

    The nonprintable area is between the two sets of dotted lines representing any nonprintable margin of the page.

    The page edge is indicated by the outermost set of dotted lines.

    The artboard is bounded by solid lines and represents the maximum printable area. To hide the artboard boundaries, choose View > Hide Artboard.

    The scratch area is the area outside the artboard that extends to the edge of the 227‑inch square window. The scratch area represents a space on which you can create, edit, and store elements of artwork before moving them onto the artboard. Objects placed onto the scratch area are visible on‑screen, but they do not print.

    ----

    From that follows that if you change the pagesize you also change the size of the artboard. Semantics maybe, but if you make a huge artboard you can actually tile multiple pages - sizes of which are set by those of your paper size for printing - inside that artboard. You can also make an artboard that is smaller than the papersize if you so choose and by moving the page-outline with the pagetool decide what part of the page to print.
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 12, 2008 1:44 AM   in reply to (hakoon)
    Nini, you're missing the point here. What Hakoon wants, and myself also, is a plugin or script with which you can have illustrator automatically snap the size of the artboard to the bounding box of the artwork you load.
    I would like something like this very much too, since I have to import and then edit loads and loads of technical drawings, that are sent to me as WMF's. (since wmf is the only fileformat we found that the 3D-designers software can output and that I can import in illustrator without problems, we tried all other options, please don't suggest I try another format, thx)
    The ONLY problem is, that when I open such a WMF, the artboard is always set to240x120mm...
    So, I have to manually set the artboard to the bounding-box size of the artwork... A tool that would automate this would be VERY helpful!
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 12, 2008 3:43 AM   in reply to (hakoon)
    > What Hakoon wants, and myself also, is a plugin or script with which you can have illustrator automatically snap the size of the artboard to the bounding box of the artwork...

    As for scripting: The AI scripting model provides read-only access to the current document Artboard size.

    JET
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 9, 2008 12:51 PM   in reply to (hakoon)
    I see what the first poster is talking about. Viewing AI files in Bridge really sucks because none of the scratch area shows up in Bridge's thumbnail preview. If either there was a way to change the artboard size to match the document objects boundary, or a way in Bridge to customize the viewing extents of the thumbnails to include the scratch areas of AI files, then that would be awesome.

    As it stands, you can do neither. Viewing scratch areas in the thumbnails in Bridge would make Bridge immensely more useful.

    -Peter
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 20, 2008 7:42 AM   in reply to (hakoon)
    An automatic shrink (or snap) artboard to fit content would be extremely useful.

    With the advent of AI 10, Illy suddenly got fussy about the artboard size. Prior to that it didn't make much difference what the size of the artboard was. But now that output is controlled via Print, making a cropped pdf straight from Illy requires the artboard size to be exactly right, so a shortcut would be most welcome.

    Saving Illy files as EPS and then using Distiller alleviates the problem but that artboard thing is still a nuisance.
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 20, 2008 6:41 PM   in reply to (hakoon)
    You have this feature in AI CS4 - fit an artboard to artwork bounds or to selected art.
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 20, 2008 9:08 PM   in reply to (hakoon)
    Yu do I thought it was in CS 3 as well I guess that is not so.

    Did anyone double click the artboard tool to see if there is this option in CS3?
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2008 5:50 AM   in reply to (hakoon)
    Is there even an artboard tool in CS3? Do you mean the crop tool, Wade?
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2008 1:04 PM   in reply to (hakoon)
    Is that what they called it?
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 22, 2008 3:55 AM   in reply to (hakoon)
    In CS3 and prior, Illustrator's Artboard is not moveable from the center of the pasteboard. So if your artwork is not centered, setting the Artboard size to the size of the content of your file would not likely do what you want.

    The scripting model does not provide access to the Artboard size. It is read-only. When scripters need to resize an Artboard, they resort to workarounds involving creation of a new document.

    JET
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2008 6:11 AM   in reply to (hakoon)
    In AI CS4, artboards are movable and resizable; they can be forced to snap to artwork bounds or the bounds of just the selected art.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2009 11:37 AM   in reply to (hakoon)
    I understand how to re size the art board in AI CS4 (fit to art work bounds). I'd like to run an action on this art board feature.

    Basically I want to run a re size (say all images down to a constrained 5" width) on my image and bring the art board down with it using an action. Of course I have like 300 to do so I'd like to batch all the work.

    I can "action" a re size but it won't record my "action" of the art board "fit to art work bounds".

    Ideas?
     
    |
    Mark as:
  • Currently Being Moderated
    May 29, 2009 1:26 PM   in reply to (nate1234)

    Right, yes there is this functionality in CS4 - what the OP, myself, and many others want is a way to make it more automatic - like a keyboard shortcut to snap the artboard to selected art, all art, or what have you. If it's in Fireworks, why not have it in Illustrator. At least, if nto a shortcut, a way to script it, or put it in an action would be nice.

     
    |
    Mark as:
  • Currently Being Moderated
    May 3, 2011 9:33 AM   in reply to (hakoon)

    Me too, me too!!!!

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2011 12:21 AM   in reply to dnewmanSFBR

    wow, such an old post, all the OP and others requests are now possible with CS5.

     

    here you go, for you and other CS4 users

     

    #target Illustrator
     
    //  script.name = shrinkABtoFitArt_CS4.jsx;
    //  script.description = resizes active artboard to fit the the Art (+ margins);
    //  script.required = one document with at least one piece of art;
    //  script.parent = carlos canto // 5/3/11;
    //  script.elegant = false;
     
    if (app.documents.length > 0)
        {
            //alert("more than 0");
              var idoc = app.activeDocument;
              var pageItemsCount = idoc.pageItems.length;
            if (pageItemsCount>=1)
                { 
                        var msg = "Enter Artboard Margins \n";
                        msg += "\nEnter negative numbers to cancel";
                        
                        var margins = Number(Window.prompt (msg, 10, "CS4 Shrink Arboard to Fit"));
                        if (margins>=0)
                             {
                                  
                                  var activeABindex = idoc.artboards.getActiveArtboardIndex();
                                  var newAB = idoc.artboards[activeABindex];
     
                                  var iartBounds = idoc.visibleBounds;
                                  
                                  var ableft = iartBounds[0]-margins;
                                  var abtop = iartBounds[1]+margins;
                                  var abright = iartBounds[2]+margins;
                                  var abbottom = iartBounds[3]-margins;
                                  
                                  newAB.artboardRect = [ableft, abtop, abright, abbottom];
                                  
                                  var myZoom = idoc.activeView.zoom;
                                  idoc.activeView.zoom = myZoom+.01;
                                  idoc.activeView.zoom = myZoom;
     
                             }
                        else
                             {
                                  alert("nos vamos");
                             }
                 }
             else
                {
                    alert("there is no art in the active document");
                 }
         }
     else 
        {
            alert ("there are no open documents");
        }
    

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2011 3:42 AM   in reply to CarlosCanto

    I never had CS4 but Illustrator has options for opening files and handling artboards…

     

    convertCropAreaToArboard
     
    

     

    convertTilesToArboard
     
    

     

    createArtboardWithArtworkBoundingBox // This may be what you want?
     
    

     

    preserveLegacyArtboard
     
    

     

    You could batch script opening files… even script it to work from bridge as input… I don't use actions so I don't know it these options are available when recording some open file in AI?

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2011 8:09 AM   in reply to CarlosCanto

    Out of the blue!!!  Thank you! I'll bug my boss about upgrading to CS5.

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2011 8:14 AM   in reply to Muppet Mark-QAl63s

    Thanks for the suggestions, I'll look into these.

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2011 10:26 AM   in reply to dnewmanSFBR

    you're welcome

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 7, 2011 8:27 AM   in reply to CarlosCanto

    CarlosCanto wrote:

     

    wow, such an old post, all the OP and others requests are now possible with CS5.

     

     

    Sorry Carlos, I have CS5 (and CS5.1) and I'm still unable to record the changing of the artboard size as an Illustrator action.  Could you explain how to do this in CS5 please?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 7, 2011 1:51 PM   in reply to Rhiannon Miller

    #target illustrator

    function fitArtboards() {
        
         if (app.documents.length == 0) {
             
              alert('Open a document before running this script');
             
                   return;
                  
         } else {
             
              for (var i = 0; i < documents.length; i++ ) {
                  
                   app.activeDocument = documents[i];
                  
                   app.activeDocument.artboards[0].artboardRect = app.activeDocument.geometricBounds;
                  
                   redraw();
                  
              }
         }
    }

    fitArtboards();

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 7, 2011 10:36 PM   in reply to Rhiannon Miller

    Rhiannon Miller wrote:

     

    CarlosCanto wrote:

     

    wow, such an old post, all the OP and others requests are now possible with CS5.

     

     

    Sorry Carlos, I have CS5 (and CS5.1) and I'm still unable to record the changing of the artboard size as an Illustrator action.  Could you explain how to do this in CS5 please?

     

    Hi Rhiannon, sorry for the confusion, I didn't mean you could record an action in CS5, I meant you could do it manually in CS5.

     

    I'll give it try tomorrow, I have CS5 at work. I'll let you know.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2011 6:28 AM   in reply to CarlosCanto

    Hi, I've been following this thread and have a similar issue.  I'm working in CS4.  I believe I have the right script to shrink the artboard to fit my content--thanks, everyone!--but now I'd like to automate the whole thing so that it will open, run the script and save.  I've got a few hundred very similar images here and obvs running the script on each individually is overwhelming.  I'm not clear why running a script cannot be a recordable action, but so it goes. 

     

    Can someone please explain the basics of getting a code to do this?  I don't even know--would I run it in Script Editor?

    Advice?

     

    Thanks!

    Trevor

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2011 7:19 AM   in reply to obeacon

    Script Editor is Apple's AppleScript utility… The above code is JavaScript and its best to use the Adobe ExtendScript Toolkit to edit and save…

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2011 7:32 AM   in reply to Muppet Mark

    Hi Mark,

    I'm a dummy compared to this forum--So If I drop the code above into ExtendScript and run it, that will perform the task of the script I've identified...?

    Thanks so much.        Trevor    

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2011 8:13 AM   in reply to obeacon

    You can C&P from the post above… If you use the sample by Prepress then it should work with all open documents… Paste into a new document window in the ESTK from there you can test/run with Illustrator as the selected target… or you could save to file what ever you want to call it and file extension '.jsx' drop that in your Illustrator scripts and restart the app… I would have used visibleBounds over geometricBounds myself but hey ho each to their own…

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 5, 2011 1:58 AM   in reply to (hakoon)

    Document setup - Edit Artboard - then double click on image.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 9, 2013 4:37 PM   in reply to (hakoon)

    I just tried the Artboard Tool. Shift-O, then double-click on the image. Save. Done.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 10, 2013 6:31 AM   in reply to tynmanout

    ALWAYS state the version you are using.

     

    You are resurrecting a thread that started almost 5 years ago. In the current version (16), there is a command for fitting the artboard to artwork. That did not exist back then.

     

    JET

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2013 9:00 PM   in reply to JETalmage

    The question wasn't about whether it's possible, it's about how to record that action into a script. When you record a script it does not record that step in CS5 or earlier. (Not sure if it does in later versions.) To do so you must choose (from Actions menu, as you're recording the script) Insert Menu Item and then choose from the menu Object [sorry I can't remember the name of the command and I don't have CS5 here] something like Fit to Artboard.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)