Solved

open a pdf file to a specific page of the document

Posted on 2007-12-03
3
1,427 Views
Last Modified: 2012-06-21
I need to open a PDF file at a specific page numbers, before version 8.1.1 of Adobe reader I used the parameters part of ShellExecute to set the page number, this no longer works.

I can open the document using:

filename := 'c:\manual.pdf';
ShellExecute(hInstance, nil, PChar(filename ), nil, nil, SW_SHOW);

Can anyone help with setting the page number?
Thanks
0
Comment
Question by:Link-HRSystems
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 21

Expert Comment

by:ziolko
ID: 20394631
this is not using ShellExecute but works for me:


procedure TForm1.Button1Click(Sender: TObject);
var aread: TAcroPDF;
begin
  FReader := TAcroPDF.Create(nil);
  FReader.setShowToolbar(False);
  FReader.SetBounds(0, 0, Width - 30, Height - 30);
  FReader.ParentWindow := Self.Handle;
  FReader.LoadFile('C:\Documents and Settings\All Users\Documenten\RAD Studio\5.0\Demos\IntraWeb\Win32\Features\Downloads\multicast.pdf');
  FReader.setCurrentPage(7);
end;


TAcroPDF is defined in AcroPDFLib_TLB which can be generated from AcroPDF.dll

ziolko.
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 250 total points
ID: 20403048
This works for me using 8.1:


procedure TForm1.Button1Click(Sender: TObject);
var
  sei: TShellExecuteInfo;
begin
  ZeroMemory(@sei, sizeof(sei));
  with sei do
  begin
    cbSize := SizeOf(sei);
    fMask  := SEE_MASK_NOCLOSEPROCESS;
    Wnd   := Form1.Handle;
    lpVerb := 'open';
    lpFile := PChar('"C:\Program Files\Adobe\Reader 8.0\Reader\acrord32.exe"');
    lpParameters := PChar('/A "page=12" "c:\guide_to_obtain_sponsors.pdf"');
    lpDirectory := PChar('c:\');
    nShow := SW_SHOWNORMAL;
  end;
  ShellExecuteEX(@sei);
end;

Open in new window

0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 20403303
If this is a Delphi related question, you should select the Delphi zone as the primary zone so the points
will go there.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
DBCtrlGrid, Delphi, Scroll 8 82
software inventory tools 3 86
Delphi Firmonkey, Android:  blocking dialogs not implemented on this platform 5 88
Map all network 11 82
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
This video demonstrates basic masking and how to edit the mask to reveal the desired image.
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question