Print Page | Close Window

GetPageText coming up empty on some documents

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=821
Printed Date: 23 Nov 24 at 3:22AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: GetPageText coming up empty on some documents
Posted By: swb1
Subject: GetPageText coming up empty on some documents
Date Posted: 24 Nov 07 at 1:24PM

I have some documents that fail to yield anything to GetPageText(3) yet the text renders properly. I think I have found the code that causes the problem, though, I am not certain that my solution is appropriate.

 

If version 5.20 of module uPDFRenderer at line 1350 I found this code segment:

 

for X := 1 to Length(Text) div 2 do

begin

      UC := Ord(Text[X * 2 - 1]) * 256 + Ord(Text[X * 2]);

      UX := 0;

      UFound := False;

      while (not UFound) and (UX < Length(FFontCol.FoundFontData.DisplayCS2)) do

      begin

            if (UC >= FFontCol.FoundFontData.DisplayCS2[X].StartCode) and

               (UC <= FFontCol.FoundFontData.DisplayCS2[X].EndCode) then

            begin

UC := FFontCol.FoundFontData.DisplayCS2[X].ResultCode +

                  UC - FFontCol.FoundFontData.DisplayCS2[X].StartCode;

                  UFound := True;

            end

            else

                  Inc(UX);

      end;

      if UFound then

            MapText := MapText + WideChar(UC);

end;

 

I believe that this is the correction that is necessary.

 

            if (UC >= FFontCol.FoundFontData.DisplayCS2[UX].StartCode) and

               (UC <= FFontCol.FoundFontData.DisplayCS2[UX].EndCode) then

            begin

UC := FFontCol.FoundFontData.DisplayCS2[UX].ResultCode +

                  UC - FFontCol.FoundFontData.DisplayCS2[UX].StartCode;

 

This seems to solve the problem that I have been having with these documents. The documents appear to have WideStrings and when the WideStrings are not decoded properly they come back as null strings.

 

Marian, can you confirm my change? Because I am unfamiliar with Font handling and WideString handling, I cannot be confident that what I am doing here is correct.

 

Thanks, 

Steve




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