AddOverflowTextArea

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for COM/ActiveX (v5)  /  AddOverflowTextArea

DynamicPDF Generator for COM/ActiveX (v5) Forum

 Nov 04 2011 3:46 PM
Having an issue wrapping text lager than on page that starts about half way down the page. Using the below code it prints about a 3rd of the text on the bottom of the page then prints about a 3rd on the top of the next page then the remaining 3rd on the top of the following page leaving the second half of each of these pages empty.
how do I get it to use the entire new page area for the overflow text?

Do
   Set objOverflowTextArea = objTextArea.GetOverflowTextArea( 0, 0 )
   If Not( objOverflowTextArea is Nothing ) Then
      Set objPage = objDoc.AddPage()
      Set objTextArea = objPage.AddOverflowTextArea( objOverflowTextArea )
   End if
Loop While Not ( objOverflowTextArea is Nothing )
 Nov 04 2011 5:04 PM
Posted by a ceTe Software moderator
Hello,

The behavior you are seeing is expected behavior. Initially when a certain height is defined for the TextArea the overflow TextArea returned by the GetOverflowTextArea( 0, 0 ) will have the same height.  In the code you are using the x & y co-ordinates of the overflow TextArea are 0 & 0 respectively, so you will see it start at the beginning of the second page, when the predefined height is filled it overflows to the third page. If you want the overflow TextArea to fill the page you would need to set the height of the overflow TextArea. Below is the sample code that adjusts the height of overflow TextArea to fill the page.
 
    Dim MyDocument
    Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
    ' Make a large text string.
    Dim MyText
    MyText = "This is a test of the overflow text functionality. "
    MyText = MyText & MyText
    MyText = MyText & MyText
    MyText = MyText & MyText
    MyText = MyText & MyText
    MyText = MyText & MyText
    MyText = MyText & MyText
    MyText = MyText & MyText
        
    Dim MyPage
    Dim MyTextArea
    Dim MyOverflowTextArea
    Set MyPage = MyDocument.AddPage()   
    Set MyTextArea = MyPage.AddTextArea( MyText, 0, 500, 200, 200 ) 
    Do 
        If MyTextArea.HasOverflowText Then
             Set MyOverflowTextArea = MyTextArea.GetOverflowTextArea( 0, 0 ) 
                         Set MyPage = MyDocument.AddPage()   
                         MyOverflowTextArea.Height = MyPage.PageHeight - MyPage.MarginBottom
             Set MyTextArea = MyPage.AddOverflowTextArea( MyOverflowTextArea )
         End if
    Loop While MyTextArea.HasOverflowText = True 
    
    ' Output the PDF.
    MyDocument.DrawToWeb
    Set MyPage = Nothing
    Set MyDocument = Nothing

Thanks,
ceTe Software Support Team.
 Nov 04 2011 5:22 PM
Please explain more on why you used MyPage.PageHeight - MyPage.MarginBottom. MyPage.PageHeight returns 792 and MyPage.MarginBottom returns 54 fopr a result of 738. However my grid (objDoc.SetLayoutGrid) reflects 0 to 684 for the height and I do not go past 670 because of the page number at the bottom. will 792 cause me issues and cause any text to exceed 670?
 Nov 07 2011 5:06 AM
Posted by a ceTe Software moderator
Hello,

In order to get the height available on the page for the text area you can use MyPage.PageHeight - MyPage.MarginBottom - MyPage.MarginTop. You are seeing the layout grid for 682 points is because this is the height on page excluding the top and bottom margins. The above example is a sample showing how to use it and the height calculation is not considering the top margin of the page.

If you do not want to exceed the height of 670 for text area then you can set the height to (670 - the Y position of the text area). You will have full control on the position and height of the text area so you can calculate these values depending on the available place on the page and the desired location of text area.

Thanks,
ceTe Software Support Team.
 Nov 10 2011 3:44 PM
Just wanted to say thank you. I now have this working perfectly thanks to your help and this fine product.

All times are US Eastern Standard time. The time now is 11:50 AM.