Print Page | Close Window

stack fails in html text

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=2032
Printed Date: 04 Apr 26 at 7:52PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: stack fails in html text
Posted By: greenley
Subject: stack fails in html text
Date Posted: 06 Nov 11 at 11:01PM
Basically trying to create my own DrawHTMLTextBox that will space the lines to fit within a table, i.e. narrow the spacing between lines.

I am trying:

  void TForm1::DrawSizedHTMLText(int tableID, int row, int col, AnsiString text)
  {
    int cellLeft = QP.GetTableCellDblProperty(tableID,row,col,101);
    int cellTop = QP.GetTableCellDblProperty(tableID,row,col,102);
    int cellWidth = QP.GetTableCellDblProperty(tableID,row,col,103);
    int cellHeight = QP.GetTableCellDblProperty(tableID,row,col,104);
    int leftPadding = 6;
    int numLines = QP.GetHTMLTextLineCount(cellWidth-leftPadding,(const wstring &)WideString(text));
    double lineHeight = cellHeight/(double)numLines;
    double linePos = 0;
    AnsiString text1 = (AnsiString)QP.DrawHTMLTextBox(cellLeft-leftPadding,cellTop+linePos,cellWidth-leftPadding,lineHeight*1.5,(const wstring &)WideString(text)).c_str();

    //text1=L"<stack><!--0000000202A18E8000000010##000000        N0000000002A18E8000000012##000000        N00000000LN--></stack>begins to pay for covered services you use. Check your policy to see when the  <font color=\"#0775A8\">deductible</font> starts over (usually, but not always, January 1st). See the chart starting on page 2 for how much you pay for covered services after you meet the <font color=\"#0775A8\">deductible</font>.</font>";
    text1=L"begins to pay for covered services you use. Check your policy to see when the  <font color=\"#0775A8\">deductible</font> starts over (usually, but not always, January 1st). See the chart starting on page 2 for how much you pay for covered services after you meet the <font color=\"#0775A8\">deductible</font>.</font>";
    linePos += lineHeight;
    QP.DrawHTMLTextBox(cellLeft-leftPadding,cellTop+linePos,cellWidth-leftPadding,lineHeight*1.5,(const wstring &)WideString(text1));
  }

When I use text1 directly from the call to DrawHTMLTextBox, I get 'Access violation at address 026E6C00 in module 'QuickPDFDLL0812.dll'. Read of address A18E800C'. Process stopped.
Text1 at this point contain the stack as shown in the first commented out assignment to text1 which I got from the debugger, if I delete the stack code and use the second commented assignment, the code runs, but of course the interupted HTML tags are lost. To be clear, I get the error if I use text1 directly from the call to DrawHTMLTextBox or using the assigned value that is commented out in this example.

Suggestions?



Replies:
Posted By: AndrewC
Date Posted: 07 Nov 11 at 11:33PM
This error has finally been fixed in the 8.13 beta 1 release which can be downloaded from

   http://www.quickpdflibrary.com/blog/2011/11/quick-pdf-library-8-13-beta-1-released/ - http://www.quickpdflibrary.com/blog/2011/11/quick-pdf-library-8-13-beta-1-released/

Andrew.


Posted By: AndrewC
Date Posted: 08 Nov 11 at 3:37AM
As mentioned in another question I found that a <p spacing="-2pt" tag will allow you to control line spacing.

string text = "<p spacing=\"-2pt\">begins to pay for covered services you use. Check your policy to see when the  <font color=\"#0775A8\">deductible</font> starts over (usually, but not always, January 1st). See the chart starting on page 2 for how much you pay for covered services after you meet the <font color=\"#0775A8\">deductible</font>.</font>";
            QP.DrawHTMLTextBox(10 ,10, 300 , 200, 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