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 > Sample Code
  New Posts New Posts RSS Feed - PDF-Preview with RenderPageToStream
  FAQ FAQ  Forum Search   Register Register  Login Login

PDF-Preview with RenderPageToStream

 Post Reply Post Reply
Author
Message
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Topic: PDF-Preview with RenderPageToStream
    Posted: 26 Mar 09 at 2:29AM
Hi All!

This sample for the function RenderPageToStream you
can use as a starting point for a small pdf-viewer.
In this case you have to set a variable for "dpi" to
have zoom-functionality and for "page" (to have forward-
and previous-functions). This could it be in the first
step for you.

If you want to split a big pdf-document into single
pages you can use a similar variant of my sample with
the function RenderDocumentToFile.

For this sample you need a form-, image-, fileload-
and button-component - That's all.

The sample is written in Delphi/Pascal but i think it's
readable enough to use it in any other language.

Cheers, Ingo
 


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, ExtCtrls, jpeg, QuickPDF0712;

// . . .

var
  Form1: TForm1;
  fstring, s      : String;
  page, pagecount : Integer;
  QP              : TQuickPDF0712;
  Test_Stream     : Tmemorystream;
  jpg             : TJpegImage;

implementation

{$R *.DFM}

// . . .

procedure Pages(fap: String);
begin

   jpg         := TJpegImage.create;
   Test_Stream := Tmemorystream.Create;

   QP  := TQuickPDF0712.Create; 
   try
      QP.UnlockKey('YourKeyShouldBeHere');
      QP.LoadFromFile(the_selected_pdf_document);
      If ( QP.Encrypted > 0 ) Then
         QP.Unencrypt;
//    dpi=72 (you shouldn't use more than 300
//    page=1 (The selected page number)
//    options=1 (1=jpg ... read in the documentation)
      QP.RenderPageToStream(72,1,1,test_stream);
   finally
      QP.Free;
   end;
   test_stream.Seek(0,0);
   jpg.LoadFromStream (test_stream);
   image1.Picture.Assign(jpg);
   test_stream.Clear;
end;
 
Back to Top
HNRSoftware View Drop Down
Senior Member
Senior Member


Joined: 13 Feb 11
Location: Washington, USA
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote HNRSoftware Quote  Post ReplyReply Direct Link To This Post Posted: 09 Aug 15 at 3:06PM
I realize this is an old post, but your example is very useful.  I am dealing with a pdf file from an Architect containing a lot of 11"x17" drawings and diagrams that need to be extracted to a more useful size.  QuickPDF is doing a great job with this, but I am now trying to design a more general version of the same exercise.  What I am finding is that any particular page in the pdf can take 1-20 seconds to render to a useful resolution.  I notice that you recommend less than 300 dpi, but in my case, 600dpi and  higher can be useful and/or necessary, and works just fine.  We need to be able to examine details in the drawings by using the computer screen as a magnifying glass.  In detail, this is working fine, but I am having trouble estimating how long a render will take.  I will probably solve this by designing a cache system and accept the delay for the first render of a page, and then it will speed up for subsequent displays/zooms.  I am fascinated by the situation that individual pdf pages are in the several hundred kilobyte range, but that jpg (or a variety of other file formats) renderings are in the multiple megabytes.   As always, thanks for the useful forum.  Howard Richoux
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 10 Aug 15 at 8:51PM
Hi Howard,

often the architect plans are completely embedded in the pdf and shown with the pdf dimension settings. So it could be more senseful to extract the image with "SaveImageListItemDataToFile" out of the pdf to have the full quality...

Cheers, Ingo
Cheers,
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