Print Page | Close Window

Creating a multipage pdf with long text string

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3224
Printed Date: 16 Jul 25 at 9:50AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Creating a multipage pdf with long text string
Posted By: yapi
Subject: Creating a multipage pdf with long text string
Date Posted: 09 Dec 15 at 12:33AM
I am creating a pdf that among other components has very long strings that may produce text that are larger than a page. It is my understanding that if I add a text on a page, the text that will overflow will be clipped.

Is it possible to add a text on a page, so the library will split the text into pieces that fit onto multiple pages without clipping and add new pages as needed?



Replies:
Posted By: mLipok
Date Posted: 09 Dec 15 at 10:57AM
Func _QPDF_TXT_to_PDF(ByRef $oQP, $sText, $iLeftMargin = 20, $iRighMargin = 10, $iTopMargin = 10, $iBottomMargin = 10, $iTABtoSpace = 4, $sStyle = Default)

; Replace @TAB to spaces.
$sText = StringReplace($sText, @TAB, _StringRepeat(Chr(160), $iTABtoSpace))

Local $iTextWidth = $__eQPDF_A4_WidthInMM - $iLeftMargin - $iRighMargin
Local $iTextHeight = $__eQPDF_A4_HeightInMM - $iTopMargin - $iBottomMargin

If $sStyle = Default Then
Local $iIDFont = $oQP.AddTrueTypeFont('Arial {1250}', 0)
$oQP.SetOrigin($__eQPDF_SORIGIN_TopLeft);
$oQP.SetMeasurementUnits($__eQPDF_MUNITS_Milimeters)
$oQP.SetHTMLNormalFont('Default', $iIDFont)
$sStyle = 'DefaultStyle'
$oQP.SaveStyle($sStyle)
ElseIf IsString($sStyle) And StringLen($sStyle) Then
If $oQP.ApplyStyle($sStyle) = 0 Then
Return SetError($QPDF_ERR_WRONGSTYLEPARAMETER, 0, 0)
EndIf
Else
Return SetError($QPDF_ERR_WRONGSTYLEPARAMETER, 0, 0)
EndIf

Local $sOverFlowOutput = $oQP.DrawHTMLTextBox($iLeftMargin, $iTopMargin, $iTextWidth, $iTextHeight, $sText)
While $sOverFlowOutput
$oQP.NewPage()
$oQP.ApplyStyle($sStyle)
$sOverFlowOutput = $oQP.DrawHTMLTextBox($iLeftMargin, $iTopMargin, $iTextWidth, $iTextHeight, $sOverFlowOutput)
WEnd
Return SetError($QPDF_ERR_OK, 0, $oQP.PageCount())
EndFunc   ;==>_QPDF_TXT_to_PDF



-------------
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: yapi
Date Posted: 09 Dec 15 at 5:23PM
Thank you for your quick reply. Basically you recommend to treat a string as an html string and replace special characters (like TAB) to html. What about CR,LF?  Shall I replace them as well?


Posted By: mLipok
Date Posted: 09 Dec 15 at 7:24PM
You must try as I do not remember.
try to replace to <br>



-------------
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: pdfer
Date Posted: 18 Dec 15 at 3:03AM
Does this technique use the kerning tables in the selected font, or just the left and right bearings of the glyph?


Posted By: mLipok
Date Posted: 18 Dec 15 at 8:02AM
Really I do not know what you mean.
Maybe some other member will be able to answer to your question.

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



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