Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
DrawHTMLTextBox Returns Strange Characters |
Post Reply |
Author | |
Lord Jim
Beginner Joined: 07 Sep 11 Location: USA Status: Offline Points: 10 |
Post Options
Thanks(0)
Posted: 07 Sep 11 at 2:06PM |
Hello everyone,
I'm trying to use DrawHTMLTextBox to place HTML text on a page. The text may be several pages in length. My understanding is that each call to this function would return the balance of text to be displayed, which could then be passed to the function in successive calls until the entire string has been rendered. However, when I call DrawHTMLTextBox, the first page is correctly rendered, however the return string is something like the following snippet: ??????????? ? ?????? ? ?? ? ????????????????? ???? ?? ??? ???? ?? ???????????????? ?? ????? ??????? ? ?? ?? ???????? ???? ?????????????? ??? ?????? ???????? ???????? ?? ???? ?????? ???????? ??? ????? ????????????? ?????????? ????????? ??? ?? ?????? ???????? ?? ?????? ?????? ??? ??? ????? ??????? ?????? ???????? ??????????? ??? ??? ????????? The data returned always appears to be about the correct length, but as you can see isn't too useful. Can you tell me what I'm doing wrong? Any help would be greatly appreciated. This project is in VB6 using the latest release of Quick PDF 8.11, ActiveX version. Best regards, Jim K.
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
I have just confirmed that this is a new 8.11 bug introduced with the introduction of 8.11.
We will fix this for the 8.12 release. Basically the every 2nd byte in the string needs to be swapped to obtain the correct string. ABCDEFGH needs to be converted to BADCFEHG before the string can be used. Here is the Delphi fix - Looks like it only needs to be used on the return string from DrawHTMLBox.
Update : The developer has just fixed the problem. This problem was only with this function and not the library in general. One option is to go back to 7.26 for the time being. I may be able to send you an updated ActiveX DLL if that is too difficult. Andrew. |
|
Lord Jim
Beginner Joined: 07 Sep 11 Location: USA Status: Offline Points: 10 |
Post Options
Thanks(0)
|
Dear Andrew:
Yes, an updated ActiveX DLL would be great, as regressing to the previous version would be difficult at this point. I'd be happy to report any issues that arise with the update. Best regards, Jim K. |
|
Lord Jim
Beginner Joined: 07 Sep 11 Location: USA Status: Offline Points: 10 |
Post Options
Thanks(0)
|
Dear Andrew:
When I swap the high and low bytes in the return string, I get the following: <stack><!--0000000103AD8DB000000010##000000 N00000000LN--></stack>been made in the area of customizability: in fact, Version 5 is so It looks like some kind of stack trace which is prefixed to the remaining text. Jim K.
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
That text looks correct. QPL adds <stack> to the string to keep track of the current HTML state. You should be able to pass this string into another DrawHTMLTextBox call for the second page.
We should be releasing the 8.12 beta sometime next week with the fix.
|
|
Lord Jim
Beginner Joined: 07 Sep 11 Location: USA Status: Offline Points: 10 |
Post Options
Thanks(0)
|
Dear Andrew:
The document I've been trying to render is about two and a half pages long. Swapping the byte-pairs allows the first to pages to be generated correctly, but when passing the returned text for the third page, I get this error: "Method 'DrawHTMLTextBox' of object 'IPDFLibrary' failed". I managed to get it to work by stripping the <stack> frame before I passed the returned string for the next call. I think these workarounds are sufficient for my purposes. I'll download the 8.12 beta when you release it, and go from there. Thanks for all your help, Jim K. |
|
Lord Jim
Beginner Joined: 07 Sep 11 Location: USA Status: Offline Points: 10 |
Post Options
Thanks(0)
|
Here is another possible issue with DrawHTMLTextBox:
When using an HTML unordered list (i.e. <ul>) I get a double-quote prefixing each line of the list. For example, the following code: <ul> <li><i>The menu bar and method of opening the page at the top</i></li> <li><i>A sample display of the page</i></li> <li><i>A description of the display and its purpose</i></li> <li><i>Any configurable items on that page</i></li> <li><i>The security level normally required for changing that item</i></li> </ul> gives me this: " The menu bar and method of opening the page at the top " A sample display of the page " A description of the display and its purpose " Any configurable items on that page " The security level normally required for changing that item So far I've only tested it in Foxit Reader. Jim K. |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Can you post a copy of that small section of code so that I can reproduce the problem exactly.
|
|
Lord Jim
Beginner Joined: 07 Sep 11 Location: USA Status: Offline Points: 10 |
Post Options
Thanks(0)
|
Dear Andrew:
I zipped up my test program along with some sample files. You can retrieve the archive from the URL below: ftp://updates:lj@lordjim.dyndns.org/QuickPDFTest.zip The included "test.pdf" file demonstrates a couple of issues. The first is the aforementioned HTML list problem of preceeding quote characters. You'll see that in the middle of the first page, where you will see the italicized list. The other issue is what happens when a paragraph is split across a page break. In particular, examine the text at the top of pages 3 and 4: notice that the last seven or eight words from the last line are repeated at the very end. It's not shown here, but I also noted that format settings made on one page do not carry over into the next page. Font size, for example, will be reset to a default value after a page break. In the sample code provided, make sure that you set the IDEPath constant at the top to the location of the unzipped files. Also, at the bottom of the Form_Load event, the routine attempts to shell out to Foxit Reader, which you may not want. Best regards, Jim K. |
|
Lord Jim
Beginner Joined: 07 Sep 11 Location: USA Status: Offline Points: 10 |
Post Options
Thanks(0)
|
Dear Andrew:
As this is a public forum, I removed my developer key from the sample source. Best regards, Jim K. |
|
Lord Jim
Beginner Joined: 07 Sep 11 Location: USA Status: Offline Points: 10 |
Post Options
Thanks(0)
|
Dear Andrew:
One more thing: if you look in the sample program you'll see a routine called "ByteSwap". In addition to reversing the byte pairs in the DrawHTMLTextBox return string, it also prepends an "N" character to the first hex block in the <stack></stack> frame. I noticed that sometimes multiple hex blocks will appear in the frame, and that all would have an "N" as the first character, except the very first one. If I don't add that character, only the first call will work: subsequent calls will fail with an RTE. Best regards, Jim K. |
|
Lord Jim
Beginner Joined: 07 Sep 11 Location: USA Status: Offline Points: 10 |
Post Options
Thanks(0)
|
Reference my previous issues, the revision 8.12 beta is working very well for me now. The only issue I have is that when attempting to use DrawHTMLTextBox as across multiple pages I still need to modify the return string, or DrawHTMLTextBox will crash. Currently I'm wrapping DrawHTMLTextBox with the following VB function, and I don't appear to have any problems.
'========================================================================================================= ' This function is a workaround to accommodate some issues in QuickPDF 8.12 beta's DrawHTMLTextBox function: ' ' 1. Rip out the characters in the <stack> frame between 52 and 85, but only if the length of the frame ' is greater than 66 characters. If this not done, DrawHTMLTextBox fails. '========================================================================================================= Private Function ByteSwap(strVal As String) As String Dim intPos As Integer intPos = InStr(strVal, "</stack>") If intPos > 66 Then strVal = Mid$(strVal, 1, 51) & Mid$(strVal, 93, Len(strVal)) End If ByteSwap = strVal End Function |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
I have found the problem with the DrawHTMLTextBox function and you no longer need to fix the <stack> string manually.
Thanks for the feedback and help on this issue. This bug fix will be included in the upcoming 8.12 Final that is due out today or tomorrow.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store