Wish PdfDocument - Allow Canvas Measuring without StartPage

Robert Valentino

Well-Known Member
Licensed User
B4X:
          Private   mPDF                                   As PdfDocument

          mPDF.Initialize
          mPDF.StartPage(mPageSize.Width, mPageSize.Height)

           TextHeight           = mPDF.Canvas.MeasureStringHeight(mMeasureHeightString, mFont_Roboto_Regular, (10 / mScale))                   
           SubHeadingHeight    = mPDF.Canvas.MeasureStringHeight(mMeasureHeightString, mFont_Roboto_Regular, (14 / mScale))
PdfDocument requires that you do a StartPage before you can MeasureStringHeight or MeasureStringWidth

Normally I measure my Header items to determine where I want to place them on the page (ONLY Done once) before actually doing the pages

Having to do a StartPage before measuring items I find throws off the whole Next Page logic.

I am converting from PDFWriter which asks for the page size when you do the Initialize


ALSO: Would be nice if we had a mPDF.IsInitialized function and maybe mPDF.IsPageStarted


BobVal
 
Top