I have a problem with opening pdf file from Delphi. I need to open pdf with parameters, because I want to create help manual for my program. I try to use shellExecute, but this function needs path for reader pdf.
procedure TForm3.Button2Click(Sender: TObject);
var e,s:String;
begin
s:='/A nameddest=somePlaceInPDF pathToMyFile.pdf';
e:='AcroRd32';
ShellExecute(handle,'open',pchar(e),pchar(s),nil,sw_show);
end;
The program runs, but it is not a solution for me. Some users can use other pdf reader. Do you know a way to skip adding a reader path?
The other way is
if ShellExecute(handle,'open',pchar(e),pchar(s),nil,sw_show) < 32 then
begin
ShellExecute(0,0,'rundll32.exe','shell32.dll,OpenAs_RunDLL pathToMyFile.pdf',0,SW_SHOW);
end;
I think, that I need to some method, which pull the path from the pdf reader. Is this the best solutions for this problem?