Print Page | Close Window

Rendering

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=3552
Printed Date: 15 Jul 25 at 12:33AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Rendering
Posted By: MrPopup
Subject: Rendering
Date Posted: 25 Mar 18 at 3:42AM
Using Windows DLL V13. Would like to be able to render a page to an image but not to a file. That is have the image binary returned (renderPageToBinary). Have tried all combinations but no joy. At present I renderPageToFile and then read the file. Very slow and inefficient. Appreciate any help. Thank you. Cheers.Smile



Replies:
Posted By: Ingo
Date Posted: 25 Mar 18 at 3:35PM
Hi MrPopup ;-)

here you can get an idea how you can do it without rendering to a file.
I did it with RenderPageToStream and it works well for me:

// . . .

   QP  := TDebenuPDFLibrary1211.Create;
   try
      QP.UnlockKey('...');
      QP.LoadFromFile(Edit1.Text, '');
      If ( QP.EncryptionStatus > 0 ) Then
         QP.Decrypt;
      pmax := QP.PageCount;
      Form4.Label1.Caption := '1 from ' + IntToStr(pmax)
      QP.CombineContentStreams;
      test_stream := TMemoryStream.Create;
      if ( zoom = 0 ) then
         zoom := 72;
      QP.RenderPageToStream(zoom,1,1,test_stream);
   finally
      QP.Free;
   end;
  
// . . .

   try
      test_stream.Seek(0,0);
      jpg := TJPEGImage.Create;
      jpg.LoadFromStream (test_stream);
      Form4.Image1.Picture.Assign(jpg);
      Form4.Label1.Caption := '1' + ' from ' + IntToStr(pmax)
   finally
      test_stream.Free;
      jpg.Free;
   end;

// . . .




-------------
Cheers,
Ingo



Posted By: tfrost
Date Posted: 25 Mar 18 at 5:51PM
I think RenderPageToStream is Delphi only, and a user of the DLL edition is unlikely to be using Delphi. I believe that with the DLL edition you can use the 'render to string' function, but I have never tried this.  I assume that it is going to render to a (byte *) rather than the (char *) that is documented.  The DLL 'getting started' guide implies that with function names ending 'ToString' you have to copy the 8-bit-data result out of the buffer before calling the function again.  It's one of the reasons I never looked further at the DLL edition!


Posted By: MrPopup
Date Posted: 27 Mar 18 at 1:07AM
Thank you ingo and tfrost.
Appreciate you taking the time to respond.I have previously tried all renderTo options but will try again. 
As tfrost surmised I am not using Delphi - my development environment is Jade (www.jadeworld.com).
ToString does return something but I cannot use the returned data - it does not appear to be an image.
Will keep you posted as to success or not.
Again, thanks.
Cheers.



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