We help IT Professionals succeed at work.

Open a pdf file and display a specific page in the document

Hi,

I am trying to open a pdf document and automatic display the page number xx.

From the command shell, following syntax do exactly what I want:
acrord32.exe  /A "page=3" c:\pdftest.pdf

In VB/VBA I try to use the ShellExecute api function:
Call ShellExecute(Me.hwnd, "Open", "c:\pdftest.pdf", "page=3", "", SW_SHOWNORMAL)

The api function display the pdf file, but does not "jump" to page 3. Is it possible to use the ShellExecute function, or can this be done in other way?
Comment
Watch Question

ssCore.init();
ssDefaults.synchronousCommands = true;

function openPDFonPage(pageNum) {
PDFLocation = "/A \"page=" + pageNum + "=OpenActions\" \"" + ssGlobals.ssStartDir + "\\Example.pdf\""

var AdobePath = ssCore.Shell.getDefaultApplication({extension:"pdf"});
if (AdobePath.success) {
ssDebug.trace(AdobePath.result);
} else {
ssDebug.trace('error('+AdobePath.Error.code+') '+AdobePath.Error.description);
}
ssCore.Shell.execute({path:AdobePath.result, arguments:PDFLocation});
}

Reference:
http://www.northcode.com/forums/archive/index.php?t-5934.html

DELPHI code is given in this thread:
http://www.experts-exchange.com/Software/Misc/Q_22997066.html

Author

Commented:
Hi, I am using a third part application (Citect SCADA) that has embedded Visual Basic (vba) - .Net is not supported. I need a Visual Basic 6.0/vba solution.
Forced accept.

Computer101
EE Admin

Explore More ContentExplore courses, solutions, and other research materials related to this topic.