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!
Access violation while using ExtractFilePageText |
Post Reply |
Author | |
Fred
Beginner Joined: 18 Apr 09 Location: United States Status: Offline Points: 4 |
Post Options
Thanks(0)
Posted: 18 Apr 09 at 6:09PM |
Here below is my code, in Delphi7, QuickPdf v7.12.
The pdf file is 1 page long. You can put 0 or 1 as page #, none work.
The library doesn't return any error, I just get an ugly access violation while calling ExtractFilePageText. I think this is a pretty straight foward process so I must miss something obvious but I don't see what.
Some clue maybe: RenderPageToStream behaves the same way (ie doesn't work) whereas SecurityInfo works. Looks like accessing the page content is causing the pb...
procedure Debug;
var qp: TQuickPDF0712 ; s: string; begin qp := TQuickPDF0712.Create ; try if qp.Unlocked = 0 then qp.UnlockKey(); try s := qp.ExtractFilePageText('D:\PDF\Test\BillCingularFeb09.pdf','', 0, 0); ShowMessage(s) ; except on e: exception do begin if qp.LastErrorCode > 0 then MessageDlg('Error: '+ e.Message + #13#10 + IntToStr(qp.LastErrorCode)+': '+qp.LastRenderError, mtWarning,[mbOK],0) else MessageDlg('Error: '+ e.Message + #13#10 + 'No error message returned by the library', mtError,[mbOK],0) end; end; finally qp.Free ; end; end; Pdf file info is as followed:
User Password: No Master Password: No Printing: Fully Allowed Changing the Document: Allowed Content Copying or Extraction: Allowed Authoring Comments and Form Fields: Allowed Form Field Fill-in or Signing: Allowed Content Accessibility Enabled: Allowed Document Assembly: Allowed Encryption Level: Blank Edited by Fred - 18 Apr 09 at 8:59PM |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Fred!
Before extracting you have to do a SelectPage or DAFindPage (if you're using the DA-functions). The best is to do first PageCount and then put the extraction in a for-loop. Cheers, Ingo |
|
Fred
Beginner Joined: 18 Apr 09 Location: United States Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Hi Ingo,
Thanks for your reply.
I had tried it before, and tried again (qp.SelectPage(1);) but calling ExtractFilePageText failed as well.
Maybe an issue with Delphi project option for the compiler ?
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Fred!
I think it's a problem with the pdf. What's the returning value after LoadFromFile? Does all your pdf-files have the same problem with the routine? Does the other extract options (mainly 3 and 4) working? Oh... Now i've seen it ... It's your ExtractFilePageText! That's a standalone function ... You shouldn't mix standalone and the "normal" functions! Try the "normal" GetPageText and it will working. This structure should work: QP := TQuickPDF0712.Create; try QP.UnlockKey('MyKey'); QP.LoadFromFile(the_pdf_file); x := QP.PageCount; QP.SetOrigin(1); QP.CombineLayers; for i := 1 to x Do begin QP.SelectPage(i); STR := STR + QP.GetPageText(0); end; finally QP.Free; end; // At this moment the text from all pages // should be in string STR. Cheers, Ingo |
|
Fred
Beginner Joined: 18 Apr 09 Location: United States Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Hi Ingo,
I use SelectPage along with GetPageText otherwise the ExtractFilePageText alone. Anyway, I tried your code and it still doesn't work.
I've tested a number of pdf generated by various vendor and here are my results:
I'll send all these pdf files to QP suport if you want to take a look. Isn't the PDF format supposed to conform to strict rules (ISO 32000) so that one can expect where to retreive information ? I also have image embedded into a pdf but except doing ocr, I don't expect to extract anything from that of course.
By the way, is there a Quick Pdf table reading function ?
Thanks for your time
Frederic Edited by Fred - 20 Apr 09 at 11:03PM |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Fred!
If your samples are not too big, you can send them to me directly at ingo -dot- schmoekel -at- ewetel -dot- net I'll check them, making a complete error description and if i can't help you i'll send all to the Debenu support. Or you can do this immediately at: technical support form: http://www.quickpdflibrary.com/support/support-query.php report a bug: http://www.quickpdflibrary.com/support/report-bug.php Cheers, Ingo |
|
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