Solved

Load a PDF file in an TImage without generating a file

Posted on 2009-07-01
6
616 Views
Last Modified: 2013-11-23
Hi,

I'm receiving a file from a socket (using Indy) and I need to display that file on screen. I tried the Abobe ActiveX Control but I have to first save the file to disk and then load the PDF from that file.

I want to load the file on screen without generating the file. Any idea how I can do that?

(I'm using Delphi 7...)

Thanks
0
Comment
Question by:pmaltais
  • 4
  • 2
6 Comments
 
LVL 8

Expert Comment

by:BdLm
ID: 24758386
to display a pdf file a timage component is not the wright apporach,  which ado pdf active x did you try ?
0
 
LVL 8

Expert Comment

by:BdLm
ID: 24758467
0
 

Author Comment

by:pmaltais
ID: 24759164
I'm using Adobe Acrobat 7.0 Control Type Library 1.0 wich I think is bundled with Acrobat Reader. Not sure.

Just to make sure I was clear enough in my initial question, I want to use the stream directly with the ActiveX and never have to save the file first.

Thnaks
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 8

Expert Comment

by:BdLm
ID: 24762140
Yes, I understood,


did you try the Active X for viewing ?  http://delphi.about.com/cs/howto/ht/htpdf.htm
in a second step , did you get a StringStream from your Indy socket ? lets have a look later on the loadfile function, override it or replace it ....


0
 

Author Comment

by:pmaltais
ID: 24763352
yep,

I already tried the ActiveX as mentionned in the link you provided and it work very well.

Right now I'm using a ReadStream and I assign the received buffer to a TMemoryStream. What your saying is that I should assign it to a TStringStream instead right?

By the way, this is my first experience with Delphi and Indy so it may explain why I dont get it all right  away... some code example would be apreciated.

Ok thanks
0
 
LVL 8

Accepted Solution

by:
BdLm earned 200 total points
ID: 24771777
if it is working, no need to change from one stream class to another,
my idea is to add a further function to the pdf object like

PDF2 = class (Tpdf)
               function loadFromStream  :  TStream
               end;



function PDF2.loadfromStream : tStream
begin
          .....
          put your code here ...
       
end;



0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now