Print Page | Close Window

DrawHTMLTextBox and   and text align

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2222
Printed Date: 26 Jun 25 at 12:47PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DrawHTMLTextBox and   and text align
Posted By: Jan
Subject: DrawHTMLTextBox and   and text align
Date Posted: 11 Apr 12 at 4:25PM
DrawHTMLTextBox have (I know only 7.26 version) a special behavior with using  
1) When I don't use   , DrawHTMLTextBox trim start space.
2) When I use   , DrawHTMLTextBox wrong divide text between lines.
3) When I use &nbsp; instead of start (and after <br>) spaces DrawHTMLTextBox
  work OK,
but in case "one line text box" for HTML text I prefer draw maximum text in this text box.
May problem is how recognize this case :-)
I do not expect answer, may be this sample will be useful for someone.
 
qp.SetOrigin(1);
qp.SetMeasurementUnits(0);
qp.SetPageDimensions(598.0, 845.0);

int iFontID = qp.AddTrueTypeFont("Times New Roman", 0);

qp.SetHTMLNormalFont("Default", iFontID);

// 1) DrawHTMLTextBox trim start spaces

string textHTML = "      text with spaces over two lines<br>     two line text";

qp.DrawHTMLTextBox(0, 0, 50, 500, "<font size=\"10pt\"><p spacing=\"-1.2\">" + textHTML + "</p></f>");

// 2) DrawHTMLTextBox don't trim start spaces (OK), maximum use box width (OK when I have one line text), wrong divide word at end of line

string pomHTML = textHTML.Replace(" ", "&nbsp;");

qp.DrawHTMLTextBox(0, 60, 50, 500, "<font size=\"10pt\"><p spacing=\"-1.2\">" + pomHTML + "</p></f>");

// 3)
textHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text with spaces over two lines<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;two line text";

qp.DrawHTMLTextBox(0, 140, 50, 500, "<font size=\"10pt\"><p spacing=\"-1.2\">" + textHTML + "</p></f>");




Replies:
Posted By: AndrewC
Date Posted: 13 Apr 12 at 12:34PM
Just for comparison, here is the output from QPL 8.15 Beta 2.  There were some changes in the way &nbsp characters were handled in QPL 8.

text with
spaces over
two lines
two line text


   text wit
h spaces ov
er two lines
   two line
text


    text
with spaces
over two
lines
    two line
text


Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk