Print Page | Close Window

Printing without knowing page numbers?

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1393
Printed Date: 23 Nov 24 at 7:16AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Printing without knowing page numbers?
Posted By: corecomps
Subject: Printing without knowing page numbers?
Date Posted: 28 Mar 10 at 9:53PM
I'm seconds away from purchasing a license as well as releasing a very standard ASPX example to the community with a very common usage situation:

Person views PDF on prior page
Person selects Printer name from drop down
PDF prints on next page with a "ajax style animated gif" while it prints.

One problem.  I'm printing the PDF using the active x PrintDocument call from this page:

  http://www.quickpdflibrary.com/help/quickpdf/PrintDocument.php - http://www.quickpdflibrary.com/help/quickpdf/PrintDocument.php

Unfortunately it requires page number information.  My use case is that 100% of the time the pageCount is never cared about or known.  

Is there a -1 or 0 or something that we can pass in as to not have to know about it?

Function QuickPDF0718.PDFLibrary::PrintDocument(PrinterName As String, 
  StartPage As Long, EndPage As Long, Options As Long) As Long



Replies:
Posted By: Paddy
Date Posted: 29 Mar 10 at 6:03AM

So do you want to print all pages in the document? I presume that's the case since any other option doesn't make sense from what you've described so far.

You have to include a start page and an end page, but this is simple. The start page is 1 and to get the end page you simply call QP.PageCount() which will return the total number of pages in the document as an int -- the total number of pages is equal to the last page in the document.

E.g. QP.PrintDocument(GetPrinterName, 1, QP.PageCount(), GetPrintOptions);

HTH!



Posted By: corecomps
Date Posted: 31 Mar 10 at 4:09AM
Thanks for the tip.  I was looking for a quick way to get the page count.  Obviously missed a very easy function call.  

BTW< tested and works perfectly.  I'll release my demo code shortly.



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