Print Page | Close Window

page 1342 of 5200

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=3405
Printed Date: 02 May 24 at 11:20AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: page 1342 of 5200
Posted By: Necuacuam
Subject: page 1342 of 5200
Date Posted: 11 Nov 16 at 9:00AM
Hi! Tongue

I need to create PDF files on the fly. When the process is started I don't know how many pages the file will have. Nevertheless, I need to inform the amount of pages at the page foot (e.g. "page 1342 of 5200").

I tried to use the ReplaceTag command replacing a string like #ReplaceWithPageCount with the sum of the file pages. This method fails when the tag was written with a non-standard font Ouch

I am sure this scenario is not quite odd and I would like to know possible solutions for this problem.

Best regards Sleepy





Replies:
Posted By: mLipok
Date Posted: 11 Nov 16 at 10:11AM
First generate entire document.
Second add page numbering.

This is what I make for my self:
; #FUNCTION# ====================================================================================================================
; Name ..........: _QPDF_PageEnumerator
; Description ...:
; Syntax ........: _QPDF_PageEnumerator(Byref $oQP[, $sFormat = 'Page: %d of %d'])
; Parameters ....: $oQP                 - [in/out] an object.
;                  $sFormat             - [optional] a string value. Default is 'Page: %d of %d'.
; Return values .: None
; Author ........: mLipok
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _QPDF_PageEnumerator(ByRef $oQP, $sFormat = 'Page: %d of %d')
Local $iX = 0
Local $iY = $__eQPDF_A4_HeightInMM - 20

Local $iCounter = $oQP.PageCount()
Local $sText = ''
Local $iTextWidth = 0

For $iPage = 1 To $iCounter
$oQP.SelectPage($iPage)
$oQP.SetOrigin($__eQPDF_SORIGIN_TopLeft) ;
$oQP.SetMeasurementUnits($__eQPDF_MUNITS_Milimeters)
$sText = StringFormat($sFormat, $iPage, $iCounter)
$oQP.SetTextSize(5)
$iTextWidth = $oQP.GetTextWidth($sText)
$iX = $__eQPDF_A4_WidthInMM - $iTextWidth - 10
$oQP.DrawText($iX, $iY, $sText)
Next

EndFunc    ;==>_QPDF_PageEnumerator


-------------
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


Posted By: Necuacuam
Date Posted: 11 Nov 16 at 10:46AM
Quite simple. Great solution. Clap

Thank you mLipok 

Best regards Sleepy



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