Solved

Load a PDF file in an TImage without generating a file

Posted on 2009-07-01
6
619 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

863 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

26 Experts available now in Live!

Get 1:1 Help Now