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 > I need help - I can help
  New Posts New Posts RSS Feed - Previewing a PDF before Saving?
  FAQ FAQ  Forum Search   Register Register  Login Login

Previewing a PDF before Saving?

 Post Reply Post Reply
Author
Message
stevemaughan View Drop Down
Beginner
Beginner


Joined: 08 Oct 14
Location: United States
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevemaughan Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mLipok View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Apr 14
Location: Poland, Zabrze
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote mLipok Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
stevemaughan View Drop Down
Beginner
Beginner


Joined: 08 Oct 14
Location: United States
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevemaughan Quote  Post ReplyReply Direct Link To This Post Posted: 08 Oct 14 at 3:19PM
Great!  I'll investigate the RenderPageToDC procedure,

Thanks,

Steve
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