Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > General Discussion
  New Posts New Posts RSS Feed - Abstract error
  FAQ FAQ  Forum Search   Register Register  Login Login

Abstract error

 Post Reply Post Reply
Author
Message
cpri View Drop Down
Team Player
Team Player


Joined: 17 Feb 06
Location: Netherlands
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpri Quote  Post ReplyReply Direct Link To This Post Topic: Abstract error
    Posted: 21 Feb 06 at 2:22AM

I want to use quickpdf to view some pdf files. So the first thing I used was RenderPageToFile and then save this image as a jpg. Then using a simple image loader I load the picture into my program This works fine. The bad thing about this approach is that I have to save a image to disk. To overcome this problem I used the function RenderPageToStream. (See code)

[code]

procedure TForm1.Button1Click(Sender: TObject);
var
 QP: TiSEDQuickPDF;
 Test_Stream:Tstream;
 JPEG : TJpegImage;

begin
 QP := TiSEDQuickPDF.Create;
 try

   QP.UnlockKey('');
   if QP.SetGDIPlusFileName('c:\winnt\system\gdiplus.dll')=0 then
    showmessage('Error');
   QP.DrawText(100, 500, 'Hello World!');
   QP.SaveToFile('c:\test.pdf');
//  QP.RenderDocumentToFile(75,1,1,1,'C:\test.jpg');
   Test_Stream:=Tstream.Create;
   QP.RenderPageToStream(75,1,1,test_stream);
   JPEG:=TJpegImage.create;

   JPEG.LoadFromStream(test_stream);
   image1.Picture.Assign(Jpeg);
   showmessage('done');
 finally
   QP.Free;
   test_stream.Free ;
 end;

end;

[code]

Now I get an "abstract error" when I tried to run the RenderPageToStream function.

 



Edited by cpri
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 21 Feb 06 at 5:04AM
Hi CPRI!

Please edit your sample...
!!! The Reg-Key !!!
Back to Top
JanN View Drop Down
Senior Member
Senior Member


Joined: 29 Oct 05
Location: Germany
Status: Offline
Points: 116
Post Options Post Options   Thanks (0) Thanks(0)   Quote JanN Quote  Post ReplyReply Direct Link To This Post Posted: 21 Feb 06 at 5:13AM
I repeat: Please remove your Reg-Key from your post!


Now to your problem: You should use TMemoryStream or TFileStream instead of TStream. These two do not raise that error.
Back to Top
cpri View Drop Down
Team Player
Team Player


Joined: 17 Feb 06
Location: Netherlands
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpri Quote  Post ReplyReply Direct Link To This Post Posted: 21 Feb 06 at 6:32AM

Ok sorry for the key. The idea was to skip this line in my code when pasting it to the forum but somehow I forgot (It won't happen again I promise).

I tried the TmemoryStream. but now I got a JPEG error #42. (this error is raised when I try to load the jpeg into image container)

Back to Top
cpri View Drop Down
Team Player
Team Player


Joined: 17 Feb 06
Location: Netherlands
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpri Quote  Post ReplyReply Direct Link To This Post Posted: 21 Feb 06 at 7:28AM

Error fixed. It was due to the fact that the stream wasn't at the right position.

for those who are intresseted in the code here it is (without the reg key ;-))

procedure TForm1.Button1Click(Sender: TObject);
var
 QP: TiSEDQuickPDF;
 Test_Stream:Tmemorystream;
 JPEG : TJpegImage;

begin
 QP := TiSEDQuickPDF.Create;
 try

   QP.UnlockKey('....');
   if QP.SetGDIPlusFileName('c:\winnt\system\gdiplus.dll')=0 then
    showmessage('Error');
   QP.DrawText(100, 500, 'Hello World!');
   QP.SaveToFile('c:\test.pdf');
//  QP.RenderDocumentToFile(75,1,1,1,'C:\test.jpg');
   Test_Stream:=Tmemorystream.Create;
   QP.RenderPageToStream(75,1,1,test_stream);
   JPEG:=TJpegImage.create;
   test_stream.Seek(0,0);
   JPEG.LoadFromStream(test_stream);
   image1.Top :=0;
   image1.Left:=0;
   image1.Height :=jpeg.Height ;
   image1.Width :=jpeg.Width;
   image1.Picture.Assign(Jpeg);

 finally
   QP.Free;
   test_stream.Free ;
   JPEG.Free ;

 end;

 

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 21 Feb 06 at 9:08AM
Hi Cpri!

Thanks for this...
You can put it in the sample section ;-)

Best regards,
Ingo
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store