<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>Debenu Quick PDF Library - PDF SDK Community Forum : HTML Text Alignment</title>
  <link>http://www.quickpdf.org/forum/</link>
  <description><![CDATA[This is an XML content feed of; Debenu Quick PDF Library - PDF SDK Community Forum : I need help - I can help : HTML Text Alignment]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 25 Jun 2026 18:13:16 +0000</pubDate>
  <lastBuildDate>Fri, 20 May 2022 08:39:34 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 11.01</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.quickpdf.org/forum/RSS_post_feed.asp?TID=3983</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Debenu Quick PDF Library - PDF SDK Community Forum]]></title>
   <url>http://www.quickpdf.org/forum/forum_images/QPDF_Forum_Title.png</url>
   <link>http://www.quickpdf.org/forum/</link>
  </image>
  <item>
   <title><![CDATA[HTML Text Alignment : Brilliant - thanks for that -...]]></title>
   <link>http://www.quickpdf.org/forum/html-text-alignment_topic3983_post16103.html#16103</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=3272">chris_adsi</a><br /><strong>Subject:</strong> 3983<br /><strong>Posted:</strong> 20 May 22 at 8:39AM<br /><br />Brilliant - thanks for that - it makes sense but I would never have found that info elsewhere - really appreciate your detailed explanation.<div><br></div><div>We have built all our own document rendering engine with flow logic etc built in - often we have a pair of values to render side by side, with the tops aligned - like a prompt / label on left hand side of page, and then the detail / value to the right of it - all this is in a dynamic document so the positioning is always calculated on the fly.</div><div><br></div><div>Sometimes we need formatting in either the label or the detail so we use HTML text so we can use bold / italics even superscript. We don't know if the label or the detail will be the longest pieces of text ether so we are always looking for the longest of the pair.</div><div><br></div><div>I had converted all pairs to both be HTML text so at least the tops were in the same place, but then that just means some unneccessary markup in the fields that don't need any formatting (font size etc) - this info is invaluable - thanks!</div>]]>
   </description>
   <pubDate>Fri, 20 May 2022 08:39:34 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/html-text-alignment_topic3983_post16103.html#16103</guid>
  </item> 
  <item>
   <title><![CDATA[HTML Text Alignment : Hi Chris,The DrawHTMLText function...]]></title>
   <link>http://www.quickpdf.org/forum/html-text-alignment_topic3983_post16099.html#16099</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=3324">kevinqpl</a><br /><strong>Subject:</strong> 3983<br /><strong>Posted:</strong> 19 May 22 at 7:29PM<br /><br /><div>Hi Chris,</div><div><br></div><div>The DrawHTMLText function has to align all the text in each line along the baseline. This is quite a complex calculation when there are different fonts and font sizes.</div><div><br></div><div>Each font has certain metrics, which are values stored in the font by the font designer. One of these values is the "line height", and another is the "descent".</div><div><br></div><div>QPL works out the maximum height of all the blocks of text on each row, and then moves up by the maximum descent value.</div><div><br></div><div>For historical reasons, the descent value is usually a negative number.</div><div><br></div><div>Functions like DrawText use the baseline as the vertical reference point.</div><div><br></div><div>So to get perfect alignment between DrawText and DrawHTMLText, you would need to subtract the text height and then add the descent. But because the descent is given as a negative number you actually have to subtract the text height and then subtract the descent.</div><div><br></div><div>With the default origin at the bottom of the page, this bit of code should show how to get the alignment right:</div><div><br></div><div>&nbsp; &nbsp; QP.DrawLine(0, 700, 500, 700);</div><div>&nbsp; &nbsp; QP.DrawHTMLText(100, 700, 500, '&lt;font size=24pt&gt;This is some text');</div><div><br></div><div>&nbsp; &nbsp; QP.SetTextColor(1, 0, 0);</div><div>&nbsp; &nbsp; QP.SetTextSize(24);</div><div>&nbsp; &nbsp; QP.DrawText(100, 700 - QP.GetTextHeight - QP.GetTextDescent, 'This is some text');</div><div><br></div>]]>
   </description>
   <pubDate>Thu, 19 May 2022 19:29:44 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/html-text-alignment_topic3983_post16099.html#16099</guid>
  </item> 
  <item>
   <title><![CDATA[HTML Text Alignment : When I am rendering HTML Text...]]></title>
   <link>http://www.quickpdf.org/forum/html-text-alignment_topic3983_post16098.html#16098</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=3272">chris_adsi</a><br /><strong>Subject:</strong> 3983<br /><strong>Posted:</strong> 19 May 22 at 4:23PM<br /><br />When I am rendering HTML Text using&nbsp;DrawHTMLText it seems to be adding some padding / spacing at the top of where I am expecting it to render. - about 5 to 10 points of measurement.<div><br></div><div>I am trying to render some HTML text alongside some other elements, and even with the same Top position it always renders lower. I can't make fixed adjustments though because the document is pretty dynamic so other content could flow, or be longer or shorter.</div><div><br></div><div>Is it something in my text itself that I need to add / remove - I doubt I need to remove anything actually as I have stripped out all HTML tags as it still does it.</div>]]>
   </description>
   <pubDate>Thu, 19 May 2022 16:23:07 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/html-text-alignment_topic3983_post16098.html#16098</guid>
  </item> 
 </channel>
</rss>