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!
|  | 
| Previewing a PDF before Saving? | 
| Post Reply   | 
| Author | |
| stevemaughan   Beginner   Joined: 08 Oct 14 Location: United States Status: Offline Points: 7 |  Post Options  Thanks(0)  Quote  Reply  Topic: Previewing a PDF before Saving? Posted: 08 Oct 14 at 1:19PM | 
| 
   Hi -  I'm sure this question will reveal my newbie credentials - but here goes. I'm going to use QuickPDF as my "printing engine". So instead of writing two routine, one to export to a PDF file, and the other to print to a printer, I'm going to write the PDF export then do a shell command to print it when necessary. The one obstacle is print preview.  What's the best way to show the PDF file?  Can I create it in memory and somehow show it on a canvas (which would be wonderful!).  Or do I have to save it to disk and then re-open it to preview? All help appreciated, Steve | |
|  | |
| mLipok   Senior Member     Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 453 |  Post Options  Thanks(0)  Quote  Reply  Posted: 08 Oct 14 at 3:06PM | 
| 
   You can use Debenu Viewer or using QuickPDF RenderPageToDC here is example in AutoIt Func _QP_Display($oQP, $iLeft, $iTop, $iWidth, $iSelectPage = 1) 	If Not IsObj($oQP) Then 		; TODO 	Else 		; select Page 		$oQP.SelectPage($iSelectPage); 		$oQP.CombineContentStreams() 		$oQP.SelectContentStream(1) 		; calculate DPI 		Local $iPageWidth = $oQP.PageWidth(); 		Local $iPageHeight = $oQP.PageHeight(); 		Local $iDisplayDPI = ($iWidth / $iPageWidth) * 72 		; create GUI 		Local $iHeight = ($iWidth * $iPageHeight) / $iPageWidth 		Local $hwnd = GUICreate('QuickPDF Test Display', $iWidth, $iHeight, $iLeft, $iTop) 		GUISetState(@SW_SHOW) 		Local $hDC = _WinAPI_GetDC($hwnd) 		; render QP object to Device Context 		$oQP.RenderPageToDC($iDisplayDPI, $iSelectPage, $hDC); 		While 1 			Switch GUIGetMsg() 				Case $GUI_EVENT_CLOSE 					ExitLoop 			EndSwitch 		WEnd 		_WinAPI_ReleaseDC($hwnd, $hDC) 		GUIDelete($hwnd) ; Deletes a GUI window and all controls that it contains. 	EndIf EndFunc   ;==>_QP_Display Edited by mLipok - 08 Oct 14 at 3:16PM | |
| 
     Here you can find description how to test my examples: http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 | |
|  | |
| stevemaughan   Beginner   Joined: 08 Oct 14 Location: United States Status: Offline Points: 7 |  Post Options  Thanks(0)  Quote  Reply  Posted: 08 Oct 14 at 3:19PM | 
| 
   Great!  I'll investigate the RenderPageToDC procedure, Thanks, Steve | |
|  | |
| 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