Using TAcroPDF to view .pdf files

Hello,
I've imported the Acrobat Reader ActiveX control to Delphi 2010, added AcroPDFLib_TLB to Uses, declared
var Acrobat: TAcroPDF;

I've then tried several things, like
fn := 'C:\test.pdf';
Acrobat.src := fn;
Acrobat.show;

but don't seem to be able to show the files.

I'd apprecate any tips - I'm probably missing something obvious!

Thanks, Ian
0
Ian
10/15/2009 2:13:33 AM
embarcadero.delphi.tools 5366 articles. 3 followers. Follow

6 Replies
9922 Views

Similar Articles

[PageSpeed] 10

> {quote:title=Ian Johnson wrote:}{quote}
> Hello,
> I've imported the Acrobat Reader ActiveX control to Delphi 2010, added AcroPDFLib_TLB to Uses, declared
> var Acrobat: TAcroPDF;
> 
> I've then tried several things, like
> fn := 'C:\test.pdf';
> Acrobat.src := fn;
> Acrobat.show;
> 
> but don't seem to be able to show the files.
> 
> I'd apprecate any tips - I'm probably missing something obvious!
> 
> Thanks, Ian

OK, I've figured this out - I guess I should have persevered a big more before posting...
Once I imported the TAcroPDF component and dropped it onto a form, I then just did

  fn := 'C:\test.pdf';
  Acrobat.src := fn;
  AcroPDF1.src := fn;

and it displays on the form.

I think it is ok now, but any comments greatly appreciated.

Ian
0
Ian
10/15/2009 5:00:02 AM
"Ian Johnson" wrote in message news:173104@forums.codegear.com...
> I think it is ok now, but any comments greatly appreciated.

You might consider creating the TAcroPDF in code so that you can test that 
its actually created and that the adobe viewer is installed on the PC 
running the program.
0
Joe
10/15/2009 5:48:17 PM
> {quote:title=Joe Demartino wrote:}{quote}
> "Ian Johnson" wrote in message news:173104@forums.codegear.com...
> > I think it is ok now, but any comments greatly appreciated.
> 
> You might consider creating the TAcroPDF in code so that you can test that 
> its actually created and that the adobe viewer is installed on the PC 
> running the program.

Does this mean that TAcroPDF requires the user to have the viewer installed on their machine?  I assumed this was not required.  Otherwise, why not just use ShellExecute? 

ShellExecute(Handle,PChar('open'),Pchar(fn),nil,nil,SW_SHOWMAXIMIZED)

where fn: string is the .pdf file name.

Ian
0
Ian
10/15/2009 9:05:41 PM
> {quote:title=Ian Johnson wrote:}{quote}
> > {quote:title=Joe Demartino wrote:}{quote}
> > "Ian Johnson" wrote in message news:173104@forums.codegear.com...
> > > I think it is ok now, but any comments greatly appreciated.
> > 
> > You might consider creating the TAcroPDF in code so that you can test that 
> > its actually created and that the adobe viewer is installed on the PC 
> > running the program.
> 
> Does this mean that TAcroPDF requires the user to have the viewer installed on their machine?  I assumed this was not required.  Otherwise, why not just use ShellExecute? 
> 
> ShellExecute(Handle,PChar('open'),Pchar(fn),nil,nil,SW_SHOWMAXIMIZED)
> 
> where fn: string is the .pdf file name.
> 
> Ian

It also appears that TAcroPDF doesn't shut down Acrobat.exe when the program closes - does this mean it's not cleaning up after itself?
If I create a blank application with a TAcroPDF on the form and run it, Acrobat.exe shows up in the Processes page of the Task Manager.  When I close the form Acrobat.exe is still there.
Ian
0
Ian
10/15/2009 11:07:24 PM
"Ian Johnson" wrote in message news:173401@forums.codegear.com...
> Does this mean that TAcroPDF requires the user to have the viewer 
> installed on their machine?  I assumed this was not required.  Otherwise, 
> why not just use ShellExecute?

Yes... thats what you're accessing.

It may, though, also work with their SDK or other products installed too, if 
it installs the right files.

> ShellExecute(Handle,PChar('open'),Pchar(fn),nil,nil,SW_SHOWMAXIMIZED)
> where fn: string is the .pdf file name.

That also works.  But they're for two different things.  TAcroPDF embed a 
viewer within your application, while shell execute shows the pdf in an 
acrobat (or foxit) reader separate from your application.
0
Joe
10/16/2009 6:43:55 PM
> {quote:title=Joe Demartino wrote:}{quote}
> "Ian Johnson" wrote in message news:173401@forums.codegear.com...
> > Does this mean that TAcroPDF requires the user to have the viewer 
> > installed on their machine?  I assumed this was not required.  Otherwise, 
> > why not just use ShellExecute?
> 
> Yes... thats what you're accessing.
> 
> It may, though, also work with their SDK or other products installed too, if 
> it installs the right files.
> 
> > ShellExecute(Handle,PChar('open'),Pchar(fn),nil,nil,SW_SHOWMAXIMIZED)
> > where fn: string is the .pdf file name.
> 
> That also works.  But they're for two different things.  TAcroPDF embed a 
> viewer within your application, while shell execute shows the pdf in an 
> acrobat (or foxit) reader separate from your application.

Thanks Joe.  Yes, I figured out the difference, and was doing it by using ShellExecute and if the return value was <= 32 then there is some sort of problem and so I was using my own application with TAcroPDF.  However, the key is, as you explain, that TAcroPDF still needs the viewer to have found its way to the user's machine.  I'm also concerned that shutting my app down with the TAcroPDF control on the form leaves Acrobat.exe in the task manager.  My approach therefore, which I appreciate would not be e
veryone's choice, is to return a message if there is any problem with ShellExecute advising them to get the viewer.

Regards, Ian
0
Ian
10/17/2009 6:41:26 AM
Reply:

Similar Artilces:

How to convert .tiff image file to .pdf file without using any 3rd party tool using C#.net
HI allI have a urgent requirement i want to convert .tiff image to .pdf file Thanks in advance Regards RaviPlease click "mark as answer" if this post helped you. I dont think its possible without doing a lot of code or using third party tools, but if you  are looking for a free tool you can try a combination of http://blog.codebeach.com/2008/02/convert-multipage-tiff-to-pdf-in-net.htmland  http://www.codeproject.com/KB/aspnet/Creating_PDF_documents_in.aspx Thanks and RegardsS.K.Vignesh----------------------Do remember to "Mark as answer" for this pos...

read pdf document and show in html file using asp.net codebehind code with out using tools
    Hi,   how can i read pdf document and display data in html page using asp.net code with out using tools i mean using using only code behind   thanks and regards chandrasekhar Hi,  You can configure your Web browser to open PDF files either in the browser window or in a separate Adobe Acrobat window. To configure the browser, you must have Adobe Acrobat or Adobe Reader installed. Adobe Acrobat 5.0-6.0, Adobe Reader 6.0, and Acrobat Reader 5.x include ActiveX plug-in files that allow you to use Internet Explorer (IE) or America Online (AOL) to view PDF fi...

Writing to a PDF file or using PDF in RDLC using VWD 2005 Express
I've looked all over this forum to know how to write to a PDF file without any success. What I want to do is have the user press a button or click a link and a form/application will print out with the fields filled in from the SQL Server Express database. The form/application is a PDF file (some have edit fields some don't). I need a way to fill in this form/application using data from the database already. I've looked at some third party packages without understanding how they work. I've tried to place the PDF file on the rdlc form (or convert it) so it generates like a report witho...

How can I view a pdf file in the browser using asp.net
 How can I view a pdf file in the browser using asp.net... In my project i have a link and its a pdf. I would like that when i click the link it will view the pdf file in another window. Thanks  <a href="somepdf.pdf" target="_blank">Click here</a> Regards Mike [MVP - ASP/ASP.NET]My site  Thanks it works what if, if the browser has no adobe reader? what should be dislplay?Thanks  If there is no PDF viewer on the client machine, the default behaviour of the browser is to produce a Download dialogue box.  As a web dev...

How to upload a file using input(file) tool
Hello Guys, I would like to know that how to upload a file using the input(file) tool. I mean i need the code for that..I have placed that tool in the page..Now how to attach and upload that file to the server... Please help me!!!!!!! Pramod   Check this out! http://authors.aspalliance.com/das/tutorial/fileupload.aspx Hi Pramod! Below is a very simple example of one way to do it: if (FileUploadControl.HasFile) { FileUploadControl.SaveAs(@"C:\PathToAPhysicalDirectory\" + FileUploadControl.FileName); } Make sure you have the right permissions set on the target directory. A...

Want to show pdf files as thumbnails and view just like images using hover over extender
I have everything working to upload image files, hover over a thumbnail and have the image show up in a larger picture.  How do I do that with a pdf file.  I can upload them, but they dont' show. Hi, This will help u out http://www.codeproject.com/KB/GDI-plus/pdfthumbnail.aspxMAKMark as Answer if this reply helps youMVP ASP/ASP.NetASP.Net Hosting : Host DepotMy Site : ASPSnippets...

How can we view PDF,Excel,Autocad and other file format using asp.net application on client mechine ,where these these softwares are not installed.
How can we view PDF,Excel,Autocad and other file format using asp.net application on client mechine ,where these these softwares are not installed.Even the Viewer for these files are not there.Any Idea what could be the work around ?  Kamran ShahidSr. Software Engineer(MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])Netprosys Inc.www.netprosys.comRemember to click "Mark as Answer" on the post that helps U Not sure But i think you should First of all Create HTTPHANDLER for each formatand pass this to aspnet_isapi.dll in IIS file Mapping.For example for Pdf here is the linkhttp:...

How to use a delphi XE3 obj file in delphi 2007?
Hi, I'm migrating an application from delphi 2007 to delphi XE3 and I would like to do it in several steps. To do this I need to use a part of my new code (XE3) in the current delphi 2007 application. So I want to use the .obj file from my XE3 file. I know I have to use the {$L 'Filename'} and I know that I have to declare the functions that I want to use in external in my D2007 project. I wanted to make an easy and simple example to see how it works with only 1 function 'hello world' compiled in obj with XE3 but I can't find the way to use it in D2007. In D200...

how to convert html file (with tables) to pdf file using iTextSharp.
hello, i searched a lot and also look at iTextsharp tutorials but didn't find any solutions. i have a html file which contains a table. and i try to convert it into pdf using iTextSharp but it doesn't work. here is my code:string inputFile =@"C:\Try.htm";string outputfile =@"C:\try.pdf";            try            {                // step 1: creation of a document-object  &...

web services used to convert Word files to PDF files
My professor asked me to design a web services which convert Microsoft's word files to PDF files. by use VS.NET and Windows Server 2003. After I installe Adode Acrobat 6.0 Professional, I can find some Acrobat components, Acrobat Distiller, Acrobat Web Capture 1.0 Type Library, etc. Please tell me which one can be used for my project and how to use it. Or please tell me popular free components of third parts. Thanks!...

How to use a .dmp file for a system which crashes using a delphi app
Hi, I put this post here because I am not sure of the best location. I have been given a memory dump (.dmp) file by a client who thinks that a Delphi 7 application is causing their system to blue screen from time to time. Does anyone know how I can use this .dmp file to locate the problem in the delphi app? The build the client is using has debug symbols turned on. I have downloaded Microsoft Debugging Tools for windows and have dupmchk.exe (and kd.exe) but I would really appreciate some help with how these or any other useful tools should be used? Many thanks Ben > I have down...

tools to use before using ffmpeg in order to remove errors from uploaded files
hi,can somebody pls guide me about the tools that i can use before using ffmpeg in order to remove the errors of the files so that they can be converted into flv format using ffmpeg without any problem.thanks,harry ...

Use of PDF files.
Name: Buzz Burns Email: bdotbuzzatRoadRunnerdotcom Product: Firefox Summary: Use of PDF files. Comments: Could not load the following: http://images.frys.com/art/rebates_pdf/5541610_0630.pdf Tried with Explorer - worked fine. Buzz Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15 From URL: http://hendrix.mozilla.org/ ...

Cannot view pdf files
Name: Abdul Razak Bin Naina Mohamed Email: razor_aura84atyahoodotcom Product: Firefox Summary: Cannot view pdf files Comments: I cannot view pdf website. An error--can't launch adobe acrobat. I solve the problem by untick the display pdf browser in the adobe reader application's preferences. Is this a common problem/crash in Firefox version 3? Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/2.0.0.14;MEGAUPLOAD 1.0 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a respons...

Viewing PDF files
When trying to view/open an attached PDF I recieve the normal security warning but when I chose open I get nothing. The security screen lists the file name as 1.id= or 2.id= etc. The Webaccess screen thinks I have opened the correct filename. If I chose "save as" first and then chose open it woks correctly. I got this complaint after upgrading to GW 6.5 Sp3. Server is NW5.1 SP7 with NES. Chester, It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply. Has your problem...

File in use / is there a tool /
When a file (exe) on a netware server is opened by several users is there a tool which can change the lock (in use) on theserver to copy another version of the program or delete it if a file is help open, the only way to release the file locks is to release the file locks. that can be done by having the users release the file lock or by clearing their connection (e.g., in MONITOR). -- Cheers! Richard Beels ~ Network Consultant ~ Sysop, Novell Support Connection ~ MCNE, CNE*, CNA*, CNS*, N*LS But if we clear connection, the client automticallly re...

Viewing PDF Files
Sometimes, when I select a link to a PDF file, the file appears within the SeaMonkey window, appearently using the nppdf32.dll plugin. Other times, the Download Manager is launched; and the file is eventually displayed within a separate Adobe Reader window. Why does this lack of consistency occur? Windows XP Home Edition 5.1.2600 Service Pack 2 AVG Anti-Virus 8.5.375 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 SeaMonkey/1.1.17 with Menu, Navigation, Status, and PrefBar bars displayed Cookies for the originating Web site only No firewall or...

How to get Page count for a Tiff file or PDF file using API or any other method
Dear Experts, Could you plz help me what is the method to find out the number of pages for a PDF file or a selected file like TIFF, DOC etc programmatically. Thanks in advance. Regards, V.Karthik. ...

Opening a file (xls, gif, pdf) using a hyperlink when the webserver and files are in another domain
I have beeen trying to do this for days. I have an IIS server runnning asp.net2.0. The client machines are an a sepearte domain but on the same LAN. The clients can access the .aspx pages without difficulty. One of the pages has a list of dynamically created hyperlinks to files which reside on the IIS server. The hyperlinks are calling 'file://server/share/filename.extension'. I have tried everything to get the clients to open the files in their browsers but it never works. I have used 'logonuser' to log the clients on at adminstrator level on to the IIS server but it still w...

Problem with converting .doc file to .pdf file and also filling it with some details using iTextSharp
Hello Mate,                     I am having a problem in converting a .doc file in to .pdf file using iTextSharp.dll .And also i would like to wirte some details in to the form. the problem is the conversion of .doc to .pdf file is not working and also filling in to the converted .pdf file is also not working.Could you please tell me a solution?   This is my code  in this below method i am passing the full path of an existing .doc file public void Convert_And_Fill(string filepath...

Unable to view PDF's using Adobe reader using FireFox 3.0b4
Name: Christopher Wise Email: anubisdotwiseatgmaildotcom Product: Firefox Summary: Unable to view PDF's using Adobe reader using FireFox 3.0b4 Comments: Error Message while trying to view .pdf "Cannot use Adobe Reader to view PDF in your web browser. Reader will now exit. Please exit your browser and try again. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b4) Gecko/2008030714 Firefox/3.0b4 On Mar 13, 3:57=A0am, Christopher Wise <hendrix-no-replyatmozilladotorg> wrote: > Name: =A0 =A0Christopher Wise > Email: =A0 anubisdotwis...

Changing the default All Files (*.*) option to Adobe PDF Files (*.pdf) in a file open dialogue in ASP.net
In My file Upload page, I am using <input type=file> tag to browse a file from client machine.The Browse button by default is showing all files *.* in the file dialogue boxI have a requirement like the file dialogue should by default show just PDFs *.pdf, and have an option to show all files *.* as shown below:Adobe PDF Files (*.pdf)All Files (*.*)Is there a way to handle this using any web controls, or technique using ASP.net or HTML?Thanks in advanceAnsar I need answer to this one, too. As far as I know, there is no way to do this....

Can't create pdf file automatically from my application when run from IIS using PDF Printer
Hi everybody,  I've an application developed in ASP.Net to convert any file to pdf file using Adobe PDF Printer. In the .aspx page I've kept one button control and in the click event I've written : protected void Button1_Click(object sender, EventArgs e) { try             {                 Process printProcess = new Process();                 printProcess.StartInfo.FileNa...

Combining PDF files into one very large pdf file
Does anyone have a utility/componennt that will combine various PDF files into one very large PDF file? The size of the final file may be larger then the current memory available for the computer. Thanks Ed Dressel On Thu, 2 Apr 2009 08:29:47 -0700, Ed Dressel <none@tbinc.com> wrote: >Does anyone have a utility/componennt that will combine various PDF files >into one very large PDF file? The size of the final file may be larger then >the current memory available for the computer. > >Thanks >Ed Dressel Ed, I would check out www.adultpdf.com Str...

Web resources about - Using TAcroPDF to view .pdf files - embarcadero.delphi.tools

Resources last updated: 2/14/2016 5:13:29 PM