I am trying to get the PDF Object coordinates from each word in a text based PDF document. See attached example.
However, I am running into these issues:
[1] The Object Height and Width are always returning a value of 1 (seems to be a bug here. Height and Width should have values)
[2] The text objects on the sample PDF should be one word per text object. You will see that the first word "Banna" is presented as two text objects: "B" and "anna". AND the last line with the text "Banna and Apple" should be 3 separate text objects, NOT one with three words.
FViewer.PdfViewer.PageIndex := APageNum - 1;
ACount := FViewer.PdfViewer.Objects.Count;
for i := 0 to ACount - 1 do
begin
AObj := FViewer.PdfViewer.Objects[i];
if (AObj.ObjectType = ptText) then
begin
msgbox(Format( 'Info: %s, %0.2f, %0.2f, %0.2f, %0.2f',
[ AObj.Text, AObj.X, AObj.Y, AObj.Width, AObj.Height ]));
msgbox(Format( 'Matrix: %0.2f, %0.2f, %0.2f, %0.2f, %0.2f, %0.2f',
[ AObj.matrix.a, AObj.matrix.b, AObj.matrix.c, AObj.matrix.d, AObj.matrix.e, AObj.matrix.f ]));
end;
end;
attach/jeffp/202685152012_TEST.pdf
jp