Determine X,Y coordinates For Dynamic Content

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for COM/ActiveX (v8)  /  Determine X,Y coordinates For Dynamic Content

DynamicPDF CoreSuite for COM/ActiveX (v8) Forum

Using vbscript and DPDF Generator.  Need to add various sized dynamic content so I need to figure out how to use GetRequiredHeight for formattedtextareas. I see lots of .NET examples but none for classic ASP/vbscript. Can anybody provide vbscript example of GetRequiredHeight and how to determine the Y coordinate of formatted text so I can keep all the text flowing together?

Thanks.

--Jim
Posted by a ceTe Software moderator
Hello,

You can add the overflow contents of the FormattedTextArea to a new page by retrieving the overflow text using GetOverFlowFormattedTextArea() method. You can also get the height required to add the text using GetRequiredHeight() method of FormattedTextArea. Please refer to the documentation on text continuation here. Here is the ASP/VB Script code sample for adding overflow text to the new position within the same page by calculating the new Y position dynamically.

<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"-->
<%
    Dim MyDocument, MyPage, MyFormattedText, MyFormattedTextArea, XPosition, NewYPosition, MyOverFlowFormattedTextArea
    'Create Document object and set properties
    Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
    MyDocument.Creator = "location.asp"
    MyDocument.Author = "ceTe Software"
    MyDocument.Title = "Hello World"
    'Add a page to the document
    Set MyPage = MyDocument.AddPage()
        MyFormattedText = "<p>Formatted text area provide rich formatting support for " + _
        "text that appears in the document. You have complete control over 8 paragraph " + _
        "properties: spacing before, spacing after, first line indentation, left indentation," + _
        " right indentation, alignment, allowing orphan lines, and white space preservation; " + _
        "6 font properties: <font face='Times'>font face, </font><font " + _
        "pointSize='6'>font size, </font><font color='FF0000'>color, " + _
        "</font><b>bold, </b><i>italic and </i><u>" + _
        "underline</u>; and 2 line properties: leading, and leading type. Text can " + _
        "also be rotated.</p><p>Formatted text area provide rich formatting support for " + _
        "text that appears in the document. You have complete control over 8 paragraph " + _
        "properties: spacing before, spacing after, first line indentation, left indentation," + _
        " right indentation, alignment, allowing orphan lines, and white space preservation; " + _
        "6 font properties: <font face='Times'>font face, </font><font " + _
        "pointSize='6'>font size, </font><font color='FF0000'>color, " + _
        "</font><b>bold, </b><i>italic and </i><u>" + _
        "underline</u>; and 2 line properties: leading, and leading type. Text can " + _
        "also be rotated.</p>"
    Set MyFormattedTextArea = MyPage.AddFormattedTextArea(MyFormattedText, 0, 0, 256, 50, DPDF_FontFamily_Helvetica, 12, False)
    XPosition = MyFormattedTextArea.X
    NewYPosition = MyFormattedTextArea.Y + MyFormattedTextArea.Height + 10
    Set MyOverFlowFormattedTextArea = MyFormattedTextArea.GetOverFlowFormattedTextArea(XPosition, NewYPosition)
        If Not (MyOverFlowFormattedTextArea Is Nothing) Then
                MyOverFlowFormattedTextArea.Height = MyOverFlowFormattedTextArea.GetRequiredHeight()
                Set MyOverFlowFormattedTextArea = MyPage.AddOverflowFormattedTextArea(MyOverFlowFormattedTextArea)
        End If
    ' Output the Document to the Browser
        MyDocument.DrawToWeb
        Set MyPage = Nothing
        Set MyDocument = Nothing
%>


Thanks,
ceTe Software Support Team.
Thank you this is helpful. However, in my specific case I have formatted text followed by an unordered list of varying length.  So I would be determining the y location after the unordered list had completed.  Does getting x and y work the same way with unordered list?  I suppose if there is not a way to get Y from an unordered list, I could write a short formatted text line like "<br>" after the unordered list and use the process you described to get Y.
Posted by a ceTe Software moderator
Hello,

Yes, you can work with UnOrderedList the same way as you did with FormattedTextArea. You should be able to get X, Y position from the UnOrderedList object without any problem. You can also get the required height by using GetRequiredHeight() method and overflow list using the GetOverflowList() method. Please refer to the help documentation to see the members of the UnOrderedList here.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 1:14 PM.