How to get all characters on a page in Words and their position

Friedrich W. H. Kossebau kossebau at kde.org
Mon Sep 29 22:22:48 BST 2014


Hi,

I would like to create a list of all characters (visible) on a given page and 
their position relativ to that page's borders.

How do I do that best?

Background:
As you might have seen I have pulled Sven's ODT generator for Okular from an 
attic branch and pushed it next to the ODP generator. Talked to the Okular 
people at Akademy and they are quite happy about that, as it will, once 
released, also meet some bigger request for support of DOC(X) in Okular. Most 
features like navigation-by-toc already work, but at least one important thing 
is still missing:
selection of text for copying.

Due to Okular being started around PDFs this is done by an interface to the 
generator which exports the text as described above, as a list of chars and 
their position. So no native selection done by the generator, even if that 
could provide better experience (surely someone is welcome to extend Okular to 
also support native selection ;) ). See here for the API I need to support:

http://api.kde.org/4.x-api/kdegraphics-apidocs/okular/html/classOkular_1_1TextPage.html#a003032e4e1cd8c15f01ed639ce62d11f

So I start from
        KWPage page = pageManager->page(okularPage->number()+1);
and then how do I get all the text frames of that page and how do I best 
calculate the distance of each char to the page borders?

Cheers
Friedrich

PS: Right, later I plan the same for the ODP generator.



More information about the calligra-devel mailing list