Print Page | Close Window

RenderpagetoDC example needed

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1036
Printed Date: 28 Apr 24 at 9:33PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: RenderpagetoDC example needed
Posted By: rogerad
Subject: RenderpagetoDC example needed
Date Posted: 19 Mar 09 at 6:43AM
could someone please show an example using renderpagetodc

i am using a tpanel and DELPHI 6
 when i assigned the handle to tpanel nothing appeared
 here was my code

hand := panel1.handle;
qpbook.RenderPagetodc(1,1,hand );


i am trying to see the 1st page of the pdf


-------------
roger adams



Replies:
Posted By: Ingo
Date Posted: 19 Mar 09 at 7:45AM
Hi Roger!

This is the function:
RenderPageToDC(DPI, Page, DC: Integer)
I don't know anything about this function (it's a new one) but if you're using value "1" for dpi this should be too less ;-)
As dpi you should try 72, 150 or up to 300.

Cheers, Ingo
 


Posted By: Rowan
Date Posted: 25 Mar 09 at 12:57AM
Hi Roger,

You are using a TPanel.Handle property, which is a HWND handle, but a HDC handle is required instead. You should try using something like TBitmap.Canvas.Handle or
TPaintBox.Canvas.Handle.

I hope this helps.

Cheers,
Rowan


Posted By: RhoTu
Date Posted: 29 Jun 09 at 10:40PM
I would like to do the opposite.  I have a Delphi app that has drawn on an image and I would like that to be rendered/copied to a QP document.  Any examples as to proc/func calls?
 
TIA
 
RT


Posted By: Ingo
Date Posted: 30 Jun 09 at 6:45AM
Hi Rho!
 
If you want to do it the other way round you should do a new post 'cause in this case now nobody will find this answer here if he's searching for the same and see the original headline but anyway...
BTW: In the sample section here there are samples for what you need!
 
Here's a code snippet for you:
   QP  := TDQuickPDF.Create;
   try
      QP.UnlockKey('MyKey');
      QP.LoadFromFile(Edit1.Text);
      If ( QP.Encrypted > 0 ) Then   
         QP.Unencrypt;   
      QP.CombineLayers;
//    0 = BMP / 1 = jpg / 3 = EMF / 4 = EPS        
      Test_Stream := Tmemorystream.Create;
      QP.RenderPageToStream(72,1,1,test_stream,1,0);
   finally
      QP.Free; 
   end;
   test_stream.Seek(0,0);
   jpg := TJpegImage.create;
   jpg.LoadFromStream (test_stream);
   Form1.Image1.Picture.Assign(jpg);
   Form1.Show;
   test_stream.Clear;
   jpg.Destroy;

 
Cheers, Ingo


Posted By: RhoTu
Date Posted: 30 Jun 09 at 2:43PM
Ingo,
 
thanks but I am looking for the opposite example.  Take the TImage canvas and write it to the QPdoc.
 
I guess:
  image1.Picture.Bitmap.SaveToStream();
  qp.loadFromStream
  ...
 
didn't want to start a new subject since this was on point.  I always use forums by clicking on
'New Messages' or 'Unread Messages'.
 
TIA
 
RT


Posted By: DELBEKE
Date Posted: 30 Jun 09 at 3:02PM
//set orgin at the upper left corner
Qp.SetOrigin(1);
//load image from a stream
//   option can specify the page number if the image is a multi-page, 0 otherwhise
Id = Qp.AddImageFromStream(MyStream, Option);
//select the image
Qp.SelectImage(Id);
//draw the image
Qp.DrawImage(10,10,100,100);
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk