Description
Returns whether the current object has page overflow.
Applies to
Syntax
boolean IsOverflowPage()
Return value
Boolean. Returns True if the content of the PDFMultilineText/PDFRichText object cannot display in the current page, and returns False if the content can all display in the page.
Usage
The two functions, IsOverflowPage and GetOverflowPageText, shall work together to ensure proper paging of the PDFMultilineText/PDFRichText in the PDF document. By calling the function IsOverflowPage, you find out whether the content overflow. If the returned result is True, the GetOverflowPageText function gets the overflow content, which can be loaded into the next page. You can call the functions in a loop until the function IsOverflowPage finally returns False.
For best practice, you shall set the page layout parameters before calling the functions (IsOverflowPage and GetOverflowPageText), to make sure the paging of PDFMultilineText/PDFRichText is consistent with the page layout settings of the current PDF document.
Example
This example checks whether paging is needed by calling the IsOverflowPage. If the returned result is true, call GetOverflowPageText to load the overflow content in a new page:
PDFdocument lpdf_doc PDFpage lpdf_page PDFrichtext lpdf_rtext PDFcolor lpdf_color PDFsharedtext lpdf_stext string ssText integer fhandle; long fileLen; long readSize lpdf_doc = create PDFdocument lpdf_page = create PDFpage lpdf_rtext = create PDFrichtext lpdf_rtext.width = lpdf_page.getwidth( ) //Read a file from the current directory fileLen = FileLength64("testdocument.txt") fhandle = fileopen("testdocument.txt", textMode! ) blob readByte readSize = fileReadEx(fhandle, readByte, fileLen) ssText = string(readByte) fileclose(fhandle) lpdf_rtext.addtextblock(ssText ) lpdf_page.addcontent( lpdf_rtext) lpdf_doc.addpage( lpdf_page) //Check whether paging is needed by isoverflowpage do while lpdf_rtext.isoverflowpage( ) //Get the overflow content lpdf_stext = lpdf_rtext.getoverflowpagetext( ) lpdf_page = create pdfpage lpdf_page.AddContent(lpdf_stext) lpdf_doc.addPage( lpdf_page) loop lpdf_doc.save( "D:\save\overflowpage_richtext.pdf")
This example shows the recommended way (with the best performance) to break the page and set the document margins. View comments in the following code example.
PDFdocument lpdf_doc PDFpage lpdf_page PDFmultilinetext lpdf_mtext lpdf_doc = create PDFdocument lpdf_page = create PDFpage lpdf_mtext = create PDFmultilinetext string ssText integer fhandle; long fileLen; long readSize PDFsharedtext lpdf_stext lpdf_doc = create PDFdocument lpdf_page = create PDFpage lpdf_mtext = create PDFmultilinetext lpdf_mtext.width = lpdf_page.getwidth( )-100 fileLen = FileLength64("4.txt") fhandle = fileopen("4.txt", textMode! ) blob readByte readSize = fileReadEx(fhandle, readByte, fileLen) ssText = string(readByte) fileclose(fhandle) lpdf_mtext.content = ssText lpdf_page.addcontent( lpdf_mtext) lpdf_doc.addpage( lpdf_page) //Break the page using isoverflowpage do while lpdf_mtext.isoverflowpage( ) lpdf_stext = lpdf_mtext.getoverflowpagetext( ) lpdf_page = create pdfpage lpdf_page.AddContent(lpdf_stext) lpdf_doc.addPage( lpdf_page) loop //Set the document margins here and then save immediately, to produce better performance. lpdf_doc.leftmargin = 50 lpdf_doc.rightmargin = 50 lpdf_doc.topmargin = 50 lpdf_doc.bottommargin = 50 lpdf_doc.save( "D:\save\overflowpage1.pdf")
This example shows another recommended way (with the second best performance) to break the page and set the document margins. View comments in the following code example.
PDFdocument lpdf_doc PDFpage lpdf_page PDFmultilinetext lpdf_mtext lpdf_doc = create PDFdocument lpdf_page = create PDFpage lpdf_mtext = create PDFmultilinetext string ssText integer fhandle; long fileLen; long readSize PDFsharedtext lpdf_stext lpdf_doc = create PDFdocument lpdf_page = create PDFpage lpdf_mtext = create PDFmultilinetext lpdf_mtext.width = lpdf_page.getwidth( )-100 fileLen = FileLength64("4.txt") fhandle = fileopen("4.txt", textMode! ) blob readByte readSize = fileReadEx(fhandle, readByte, fileLen) ssText = string(readByte) fileclose(fhandle) //Set the document margins here lpdf_doc.leftmargin = 50 lpdf_doc.rightmargin = 50 lpdf_doc.topmargin = 50 lpdf_doc.bottommargin = 50 lpdf_mtext.content = ssText lpdf_page.addcontent( lpdf_mtext) lpdf_doc.addpage( lpdf_page) //Break the page using isoverflowpage do while lpdf_mtext.isoverflowpage( ) lpdf_stext = lpdf_mtext.getoverflowpagetext( ) lpdf_page = create pdfpage //If set margins before break pages, then AddPage before AddContent produces better performance than AddContent before AddPage lpdf_doc.addPage( lpdf_page) lpdf_page.AddContent(lpdf_stext) loop lpdf_doc.save( "D:\save\overflowpage1.pdf")
See also
PDFMultilineText objects:
PDFRichText objects: