Print Page | Close Window

Range Check Error

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=548
Printed Date: 19 May 24 at 6:09AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Range Check Error
Posted By: Dmitry
Subject: Range Check Error
Date Posted: 28 Oct 06 at 1:42AM
Hi!
Please tell me about this error. It that cases it occurs?


Qp.LoadFromFile('sample.pdf');
for i := 1 to Qp.PageCount do
begin
   Qp.SelectPage(i);
   PageList_.Add(Qp.GetPageText(3));
end;


At the page with number 14 occurs this error.
Page with number 14 consists of many images, but also has a little of text.





Replies:
Posted By: Dmitry
Date Posted: 30 Oct 06 at 8:58AM
Really noone knows why occurs this error?

Here is this page:
www.self-disciple.gorodok.net/sample.pdf

Please try to extract text from this sample.


Posted By: Ingo
Date Posted: 30 Oct 06 at 10:32AM
Hi!

I've got the same error while rendering to file ...
I've seen the file is created with ActivePDF ... There're often Problems with ActivePDF ...
I'm out of office now but i know i've a solution for you ;-)    Be patient 'till tomorrow ...

Best regards,
Ingo


Posted By: Ingo
Date Posted: 30 Oct 06 at 3:52PM
Hi Dimitry!

If you're source-license owner i can help you immediately. If not you can wait 'till 5.15 will be released here or you should tell me which dcu-version you need ... ;-)

With my code and the modificated version 5.15 i can extract the text from your sample...

Best regards,
Ingo

// First i open the pdf making a copy to work with.
// Sometimes i've problems with missing embedded fonts...
// so i add one by myself...

   QP := TiSEDQuickPDF.Create;
   try
       QP.UnlockKey('MyKey');
       QP.LoadFromFile(Edit1.Text);
       If QP.Encrypted > 0 Then
          QP.Unencrypt;
       QP.AddStandardFont(0);   
       QP.SaveToFile(tpath + '_' + ExtractFileName(Edit1.Text));
       Edit1.Text := tpath + '_' + ExtractFileName(Edit1.Text);
   finally
       QP.Free;
   end;

// Now i load my work-pdf.
// The direct-access-functions are not so
// cpu-hungry ;-)

   QP := TiSEDQuickPDF.Create;
   try
       QP.UnlockKey('MyKey');
       dafh := QP.DAOpenFile(Edit1.Text,'');
       x    := QP.DAGetPageCount(dafh);
       STR := '';

       verztxt := Edit1.Text + '.txt';
       AssignFile(cf,verztxt);
       Rewrite(cf);
       pc := 0;
       for i := 1 to x Do
       begin
          dapr := QP.DAFindPage(dafh,i);
          QP.CombineLayers;
          STR := QP.DAExtractPageText(dafh,dapr,3);

          WriteLn(cf,Trim(STR));

// We know that QP want more and more cpu-capacity
// if the pages are more and more ...
// So i've made every 10 pages a break starting new ...

          pc := pc + 1;
          if ( pc = 10 ) Then
             begin
               pc := 0;
               QP.DACloseFile(dafh);
               QP.Free;
               QP := TiSEDQuickPDF.Create;
               QP.UnlockKey('MyKey');
               dafh := QP.DAOpenFile(Edit1.Text,'');
              end;

       end;
    finally
       QP.DACloseFile(dafh);
       QP.Free;
       CloseFile(cf);
    end;

//==============================================

In file uPDFTrueTypeParser.pas i've made changes (which are included in the new 5.15 beta. With this changes i've got a good result extracting your sample.pdf:

unit uPDFTrueTypeParser;

// . . .

function IsString(const str: string): boolean;
var
len: integer;
p : PChar;
begin
len := length(str);
result := CompareMem( p, pchar(str), len);
inc(p, len);
end;

// . . .

procedure TPDFTrueTypeParser.LoadFromString(const Source: String);
var
SS: TStringStream;
begin
If not IsString(Source) Then //Schmoekel, 2006-10
     Exit;                     //Schmoekel, 2006-10
     
try

// . . .


Posted By: Dmitry
Date Posted: 31 Oct 06 at 3:22AM
Thanks, Ingo!
Please tell me when 5.15 version will released?


Posted By: Ingo
Date Posted: 31 Oct 06 at 5:20AM
Hi!

You can read here ... I can't look into the future ;-)
The first beta is released.

Best regards,
Ingo


Posted By: Dmitry
Date Posted: 31 Oct 06 at 5:52AM
Ok, I see.



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