Posted by dmcrobbie in SWF Studio V3 on Feb 17 2008, 12:53 am

I'm using Studio 3.5 beta in a Flash AS3 CD-ROM project and testing on Windows Vista with Adobe Reader 8.1.2. I can get PDFs to load through ssCore.Shell.invoke, but I'm not having any luck targeting a specific page. I've tried using Adobe's parameters ("file.pdf#page=4"). And I've tried the method below from your documentation. Neither work for me. Any ideas?


temp_btn.addEventListener(MouseEvent.CLICK, testLink);
function testLink(e:MouseEvent):void {
   ssDefaults.synchronousCommands = true;
   var r = ssCore.ActiveX.isRegistered({progId:"AcroPDF.PDF"})
   if (r.success) {
   if (r.result != "TRUE") {
        ssCore.App.showMsgBox({prompt:"Acrobat Reader is required to run this application", icon:"critical"});
        ssCore.App.quit({});
       }
   }
   ssCore.ActiveX.createObject({object:"AcrobatReader", progId:"AcroPDF.PDF"});
   ssCore.AcrobatReader.setGuides({topGuide:"top", leftGuide:"left", bottomGuide:"bottom", rightGuide:"right"});
   ssCore.AcrobatReader.setShowToolbar({On:"false"});
   ssCore.AcrobatReader.LoadFile({fileName:"startdir://file.pdf"});
   ssCore.AcrobatReader.setCurrentPage({n:"4"});
   ssCore.AcrobatReader.setVisible({visible:"true"}); 
}


Posted by northcode in SWF Studio V3 on Feb 17 2008, 02:14 am

The #page= trick will only work if you're opening the PDF file in a browser. If you use Flash getURL (or Shell.invoke) that will open the PDF in the standalone version of Acrobat Reader and not the browser, so that won't work.

The code in the Examples section of the help does work. I have Acrobat 8 installed and it works okay here. There is a typo in there, which you have corrected.

The example doesn't display any errors (except for Acrobat not installed) but there are other things that could be going wrong. I would start by building with debug mode enabled (checkbox on Output Tab) and watching for errors in the trace window AND checking the results of some of the ssCore calls, like display something if the first test for r.success is NOT true. That's a catastrophic failure that could be caused by synchronous commands not being enabled (for instance).


Posted by fruitbat in SWF Studio V3 on Apr 22 2008, 05:16 pm

I realize this is an old thread but while search through the discussions of ActiveX controls I saw this:

ssCore.AcrobatReader.setGuides({topGuide:"top", leftGuide:"left", bottomGuide:"bottom", rightGuide:"right"});and was confused. What is setGuides?

I don't see a setGuides method available when I look at the ActiveX control for AcroPDF.PDF through SWF Studio, and it's not documented in the Adobe PDF Interapplication Communication API Reference.

Am I just confused?


Posted by Dan in SWF Studio V3 on Apr 23 2008, 09:29 am

Search the SWF Studio help for the setGuides command. SWF Studio adds functionality to automatically manage the size of ActiveX objects you create, so that they'll "follow" when a user resizes your application. The position of the ActiveX object is set by the use of guides, i.e. imaginary horizontal and vertical lines that you define in code.


Posted by mbd in SWF Studio V3 on Apr 23 2008, 10:11 am

As to where the command comes from, if you look at ssCore.ActiveX you'll see a setGuides method. All of those methods, except for createObject, will work directly on the object you create. When you use those methods in this way the "object" parameter can be left out since the API understands the method will apply to the parent object.

If we take the code you quoted as an example, AcrobatReader is just the name of the ActiveX object we've given it in Flash. You don't have to call it AcrobatReader and there's absolutely no significance in doing so. We could instantiate the Shell.Explorer (IE) control and call it AcrobatReader.

Also notice that there is no object parameter specified. If you called that same method directly on ssCore.ActiveX it would look like:

ssCore.ActiveX.setGuides({object:"AcrobatReader", topGuide:"top", leftGuide:"left", bottomGuide:"bottom", rightGuide:"right"});

The ssCore.ActiveX methods supersede any ActiveX control methods. So, if your particular ActiveX control had a method called setGuides, you couldn't call it in this manner, you would have to execute ssCore.ActiveX.callMethod.


Posted by fruitbat in SWF Studio V3 on Apr 23 2008, 02:10 pm

Thanks for the clarification!

Right after posting, I thought to check the ActiveX API and there it was. But when I edited my original post to say that I answered my own question the edit was ... I don't know what. Reverted? Rejected?

It seemed to go through at the time, asked me for the reason for my edit ("Because I am an idiot" seemed appropriate) and so on.

Anyway, thanks again for taking the time to reply.