0 Replies Latest reply on Jun 22, 2010 6:31 PM by DV22

    Vbscript, change page size


      So I have folder with numerous word/excel files that need to be converted to PDF on Legal Size "paper".

      We have the "Save As PDF" plugin for Office so converting the files to PDF is no problem, however, using that plugin you cannot specify a "Print Size".

      Also, while it is very easy to alter the actual document in Word/Excel, this would change the visual appearance (page breaks etc) and they have to look the same, but with "extra space" at the top.

      So my next thought was to then open it in Acrobat Pro and change the dimensions there and this is what I have so far:


      Dim oPDF
      Set oPDF = CreateObject("AcroExch.PDDoc") ' creates COM object
      Set jsObj = oPDF.GetJSObject ' access to javascript interface
      tArr = jsObj.getPageBox("Media") ' retrieves page coords
      ' get page box args : (0) Left, (1) Top, (2) Right, (3) Bottom
      tArr(1) = 1008 ' = 14 inches for height
      Set rect = CreateObject("AcroExch.Rect") ' special rectangle object
      rect.Left = tArr(0)
      rect.Top = tArr(1) ' with new size here
      rect.Right = tArr(2)
      rect.Bottom = tArr(3)
      jsObj.setPageBoxes "Media", 0, 2, rect            '' errors on this line with Type mismatch

      ' cleanup below


      No matter what I do for the "setPageBoxes" i -always- get a Type mismatch. I've tried passing just an array, the rect object, comma delimited string, pure numbers, everything.


      Is it even possible through the "JSObject" interface to alter this parameter or is there a place where Adobe defines exactly what Type they are looking for in each language? It seems so mind boggling simple to just pass a normal array but... sigh.