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!
PDF-Preview with RenderPageToStream |
Post Reply |
Author | |
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3527 |
Post Options
Thanks(0)
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; |
|
HNRSoftware
Senior Member Joined: 13 Feb 11 Location: Washington, USA Status: Offline Points: 88 |
Post Options
Thanks(0)
|
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
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3527 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store