Jump to content

Suprem0

Members
  • Posts

    7
  • Joined

  • Last visited

About Suprem0

  • Birthday 06/03/1980

Profile Information

  • Location
    Philippines

Suprem0's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hi Experts, I want to create a script that will change the magnification og PDF files to "fitwidth". Searching the net, I found out that CosDoc can do this. But I'm not familiar with it, and even reading the Acrobat Core API did not help. Here is an example script that I've got: PDPageMode pageMode = 3; PDDocSetPageMode (pdDoc, pageMode); PDLayoutMode pageLayout = 1; PDDocSetLayoutMode (pdDoc, pageLayout); CosDoc cosDoc = PDDocGetCosDoc(pdDoc); CosObj cosObj = CosDocGetRoot (cosDoc); //CosObj newOffArray = CosNewArray(cosDoc,false,2); CosObj val = CosDictGet(cosObj, ASAtomFromString("FitH")); CosDictPut (cosObj, ASAtomFromString("FitH"), val); So what are those two CosDoc (CosDoc cosDoc)? Are they variables? How can I use that in AutoIt? If only I can configure how that line of codes work, maybe I can start this script. So please if anyone can explain this, it will be a great help. Thanks in advance!
  2. Sorry, but that is not the script that I used. So here it is: $inputfolder = IniRead (@ScriptDir & "\client.ini", "Folder", "in", "Not Found") $outputfolder = IniRead (@ScriptDir & "\client.ini", "Folder", "out", "Not Found") $delay = IniRead (@ScriptDir & "\client.ini", "Delay in milliseconds", "delay", "Not Found") while 1 = 1 $inpdf = FileFindFirstFile ($inputfolder & "\*.pdf") If $inpdf = -1 Or @error = 1 Then Sleep (2000) ContinueLoop Else $procpdf = FileFindNextFile ($inpdf) Do $movepdf = FileMove ($inputfolder & "\" & $procpdf, @ScriptDir & "\temp\" & $procpdf, 1) Sleep (1000) Until $movepdf = 1 $Aapp = ObjCreate ("AcroExch.App") $Aapp.Hide $AVDoc = ObjCreate ("AcroExch.AVDoc") $AVDoc.Open (@ScriptDir & "\temp\" & $procpdf,"") $PDDoc = $AVDoc.GetPDDoc $PDDoc.SetPageMode (3) ;Set view to pages and bookmarks panel Sleep ($delay) $AForm = ObjCreate ("AFormAut.App") ;expand all bookamrks $EX = "" _ & " function openBM(bm, nLevel)" & @LF _ & " {for (var i = 0; i < nLevel; i++) bm.open = true;" & @LF _ & " if (bm.children != null)" & @LF _ & " {for (var i = 0; i < bm.children.length; i++) openBM(bm.children[i], nLevel + 1); }" & @LF _ & " }" & @LF _ & " openBM(this.bookmarkRoot, 1)" $AForm.Fields.ExecuteThisJavascript($EX) $JSO = $PDDoc.GetJSObject Sleep ($delay) $JSO.saveAs ($outputfolder & "\" & $procpdf) Sleep ($delay) $PDDoc.Close() $Aapp.CloseAllDocs() Sleep ($delay) EndIf WEnd When I change the $Aapp.Hide to $Aapp.Show, I don't encounter any error. Can you please check if this will also work in your version of Acrobat? Thanks!
  3. Thanks for a wonderful idea! However, if I tried that and the AcroExch.App is set to Hide ($App.Hide) I get an error: The requested action with this object has failed.: $AForm.Fields.ExecuteThisJavascript($JsCode) $AForm.Fields^ ERROR Did I miss something here? Can you please advise what should I do? Thanks!
  4. Hi, I already found a way to solve this problem. I realize I need the word "app" before execMenuItem. Then add FileOpenDialog right next to it. Thanks guys!
  5. Hi, Just a quick question, how can you interpret this code: app.execmenuItem(Annots:ReaderEnable); to autoit using JSObject like: $App = ObjCreate("AcroExch.App") $App.Hide $AVDoc = ObjCreate("AcroExch.AVDoc") $AVDoc.Open("C:\SampleFile.pdf","") $PDDoc = $AVDoc.GetPDDoc $JSO = $PDDoc.GetJSObject $JSO.execmenuItem(Annots:ReaderEnable) That code doesn't seem to work. What did I miss? Thanks for the help!
  6. Great!!! Thanks! Reinhard. Now I can open and get some properties of PDF, like page sizes using JSObject without showing Adobe Acrobat. AutoIt is great!!!
  7. Hi! First of all, i would like to say that this is a great help also in me who is also dealing with PDF files. I tried your script and add a specific file in $printFile. Is there a way that the file open dialog window will be hidden and automatically open the specified pdf in Acrobat? #include <Acrobat_InterApplication_Communication_API.au3> Global $Aapp = _AcrobatIC_Create(False) Local $printFile = FileOpenDialog('Select a PDF',@ScriptDir,'PDF (*.pdf)', 1,"Developing apps using IAC.pdf") Global $AVDoc = _AcrobatIC_AVDocOpenNew($Aapp,$printFile) ;open PDF automatically without the need to click the "Open" button. Local $iMsgBoxAnswer = MsgBox(36,"Print","Do you want to Print?") Select Case $iMsgBoxAnswer = 6;Yes _AcrobatIC_AVDocPrint($AVDoc) Case $iMsgBoxAnswer = 7;No EndSelect Local $iMsgBoxAnswer = MsgBox(36,"Close Doc","Do you want to?") Select Case $iMsgBoxAnswer = 6;Yes _AcrobatIC_AVDocClose($AVDoc) Case $iMsgBoxAnswer = 7;No EndSelect _AcrobatIC_AppExit($Aapp)
×
×
  • Create New...