Print Page | Close Window

DrawTextBox and GetPageText

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


Topic: DrawTextBox and GetPageText
Posted By: haka
Subject: DrawTextBox and GetPageText
Date Posted: 17 Jun 11 at 9:08PM
Hallo.
A text that is stored with DrawTextBox can not be read by GetPageText.

procedure TForm15.Button1Click(Sender: TObject);
var LPDF: TQuickPDF;
    s   : string;
begin
  LPDF := TQuickPDF.Create;
  try
    LPDF.UnlockKey(QuickPdfSN);
    LPDF.SetPageSize('A4');
    // Store OCR-Text...
    LPDF.DrawTextBox(50, LPDF.PageHeight-50,  LPDF.PageWidth-10, LPDF.PageHeight-70, 'DrawTextBox', 1);
    LPDF.DrawText   (50, LPDF.PageHeight-100, 'DrawText');
    // Read Text...
    s := UTF8ToAnsi(LPDF.GetPageText(0));
    ShowMessage(s);
  finally
    LPDF.Free;
  end;
end;

Variable s only contains "DrawText". Is this a bug?
I'm using QuickPDF 7.25 and Delphi 2009.

Greetings, Harald



Replies:
Posted By: Ingo
Date Posted: 17 Jun 11 at 9:34PM
Hi!

Try to change the two lines.
First DrawText then the other one...
New result?
What are the settings regarding font heighs and so on?
Is the box big enough for "DrawTextBox"?
You should deal a bit more with the settings.
I had been wondered that you could ever extract text before save it to disk ;-)

Cheers and welcome here,
Ingo


Posted By: haka
Date Posted: 18 Jun 11 at 11:59AM
Hallo Ingo.

I tried many things. There seems to be a problem with DrawTextBox.
Code example:

procedure TForm15.BtnSaveClick(Sender: TObject);
begin
  with TQuickPDF.Create do
  try
    UnlockKey(QuickPdfSN);
    SetPageSize('A4');
    DrawTextBox(50, PageHeight-50,  PageWidth-10, PageHeight-70, 'My text (DrawTextBox)', 1);
//  DrawText   (50, PageHeight-100, 'DrawText');
    SaveToFile('C:\Temp\quickpdf-drwatextbox.pdf')
  finally
    Free;
  end;
end;

procedure TForm15.BtnReadClick(Sender: TObject);
var s: string;
begin
  with TQuickPDF.Create do
  try
    UnlockKey(QuickPdfSN);
    LoadFromFile('C:\Temp\quickpdf-drwatextbox.pdf');
    s := UTF8ToAnsi(GetPageText(0));
    ShowMessage(s);
  finally
    Free;
  end;
end;

And the example PDF: http://www.officemanager.de/tmp/foren/quickpdf-drwatextbox.pdf

You can not read the text with GetPageText.

Thanks, Harald



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