0 Replies Latest reply on Nov 5, 2015 8:31 AM by ivebeenlinuxed

    Artboard Range not working

    ivebeenlinuxed

      Hi,

       

      I've got a really strange problem. When I use the "Save As", "Artboard Range" for PDFs when opening in Illustrator all the artboards display, but in Acrobat only one displays.

       

      It gets stranger:

      • If I use the manual "Save Artboard Range" -> All Artboards display in Illustrator, One artboard displays in Acrobat
      • If I use the jsx "Scripting" tools -> One artboard in Illustrator, One artboard in Acrobat
      • C# (Shared COM+) -> All Artboards display in Illustrator, One artboard displays in Acrobat

       

      I need the C# to work in the same way as JSX, so one artboard saves and design work for other sorts is stripped (otherwise I'm generating huge files for each design)

       

      I attach the scripts below:

       

      Working JSX

       

      //splits the activeDocument Artboards into individual files
      
      var doc = app.activeDocument;
      
      var docName = doc.name;
      var docPath = doc.path;
      var fullName = docPath + "/" + docName;
      var abRange = ""
      
      var customerName = prompt("Customer Name");
      var jobNumber = prompt("Job Number");
      
      var DigitalFolder = "X:/DIGITAL";
      var folderLetter = customerName.substr(0, 1).toUpperCase();
      
      var f = new Folder (DigitalFolder+"/"+folderLetter+"/"+customerName+" "+jobNumber);
      if (!f.exists) {
        f.create();
      }
      
      PDFSaveOptions.pDFPreset =  "Adobe PDF Preset 1";
      //PDFSaveOptions.compatibility = PDFCompatibility.ACROBAT5;
      //PDFSaveOptions.generateThumbnails = true;
      PDFSaveOptions.preserveEditability = true;
      
      
      for (i=0; i<doc.artboards.length;i++)
          {
              PDFSaveOptions.artboardRange = (i+1)+",";
            
              var newFile = new File(DigitalFolder+"/"+folderLetter+"/"+customerName+" "+jobNumber+"/"+doc.artboards[i].name+".pdf");
              app.activeDocument.saveAs (newFile, PDFSaveOptions);
           }
      
      
      
      
      
      
      alert ("Artboards Saved to Digital", "Split Arboards");
      
      

       

       

      Not working C# (And manual saving range issue outputs the same)

      
      
      
      
              private void uploadProofToolStripMenuItem_Click(object sender, EventArgs e)
              {
                  int tmp_id = new Random().Next();
                  //Export each PDF file to the digital swap folder
                  Illustrator.Application illApp;
                  Document doc;
                  try
                  {
                      illApp = new Illustrator.Application();
                  }
                  catch (Exception ex)
                  {
                      MessageBox.Show("Could not communicate with Illustrator. If Illustrator is not open, try opening it first.");
                      return;
                  }
      
      
                  if (illApp.ActiveDocument == null)
                  {
                      MessageBox.Show("We could not find an active document in illustrator. Ensure a document is open.");
                      return;
                  }
      
      
                  doc = illApp.ActiveDocument;
      
      
                  Illustrator.PDFSaveOptions opts = new PDFSaveOptions();
                  opts.PDFPreset = "Adobe PDF Preset 1";
                  opts.PreserveEditability = true;
      
      
                  if (!System.IO.Directory.Exists("Y:/PROOF/"))
                  {
                      MessageBox.Show("Could not locate the digital workspace. Ensure network artwork drive is mounted on Y:");
                      return;
                  }
      
      
                  Directory.CreateDirectory("Y:/PROOF/tmp_" + tmp_id + "/");
      
      
                  Regex artboard_regex = new Regex(@"\A(C)?([0-9]+)([A-Za-z]{1})_");
      
      
                  for (int i = 1; i <= doc.Artboards.Count; i++)
                  {
                      opts.ArtboardRange = i.ToString();
                      string art_name = doc.Artboards[i].Name;
      
      
                      if (!artboard_regex.IsMatch(art_name))
                      {
                          continue;
                      }
      
      
                      if (art_name.Contains("_"))
                      {
                          art_name = art_name.Substring(0, art_name.IndexOf('_'));
                      }
                      illApp.ActiveDocument.SaveAs("Y:/PROOF/tmp_" + tmp_id + "/" + art_name + ".pdf", opts);
                      notifyIcon1.ShowBalloonTip(5000, "Saving...", "Saving artboard " + i + " of " + doc.Artboards.Count + " to PDF...", ToolTipIcon.Info);
                  }
      
      
      
      
                  notifyIcon1.ShowBalloonTip(5000, "Saving...", "Waiting for server to confirm upload...", ToolTipIcon.Info);
      
      
                  this.process_upload(tmp_id);
              }