sma6871
sma6871

Reputation: 3298

Display PDF in Firemonkey application

How can I view PDF files in my Firemonkey application?

I tried to add Adobe reader ActiveX into my project, but I've got an error!!

Upvotes: 0

Views: 6333

Answers (3)

Macgayver Armini
Macgayver Armini

Reputation: 31

I current showing pdf in firemonkey with Adobe Pdf Reader Active X, here the code:

ACRO := TAcroPDF.Create( Self );
ACRO.Width := Width;
ACRO.Height := Height;
ACRO.ParentWindow := FmxHandleToHWND( Self.Handle );
ACRO.LoadFile( 'C:\ProgramData\teste.PDF' );
// if focus no set, user need click on activeX component
ACRO.SetFocus;

Note: you need add uses "FMX.PlatForm.Win" and import activeX to you project. Normally the file generate is "AcroPDFLib_TLB.pas" you need add this to uses.

Upvotes: 3

Wouter van Nifterick
Wouter van Nifterick

Reputation: 24086

3 solutions:

  1. If you must embed: try an embedded browser.

  2. Otherwise, you could always launch an external viewer.

  3. Worst case scenario: convert your pdf's to html

Upvotes: 2

Warren  P
Warren P

Reputation: 68912

You can not host ActiveX controls in firemonkey. There is no PDF display component that I know of for Firemonkey, but if there was, it would have to be implemented separately or with a lot of conditional defines under the hood so it could work on both Mac OS X and Windows.

I am aware of ways that you can put one Firemonkey form into a VCL application but not aware of any way you can do the reverse. In short there is no easy way to do this, and the shortest path would be to write your own component, which would have to somehow host a PDF viewer either as an OLE Object or ActiveX control on Windows, and be implemented some other way on Mac OS X.

Upvotes: 2

Related Questions