After converting a PDF using the following command with version 0.9 of pdf2swf, the reported height of text characters tends to be to tall.
I'm writing my own viewer that allows the user to select/highlight text on the pdf as you would on any text editor/web browser.
//load the SWF of the PDF...
this.loader.addEventListener(Event.INIT, onContentLoaded);
this.loader.load(bytes); //assume bytes is a byte array that contains the binary data of the swf I'm trying to view
//after it's loaded, get the MovieClip object
function onContentLoaded(e:Event):void {
mc = MovieClip(loader.content);
mc.gotoAndStop(1);
}
//select text by character index when the mouse button is held down and over characters
mc.textSnapshot.setSelected(startIndex, endIndex, true);
June 2007 (125 - 133)
Report to Congress (135 - 152)
In accordance with the (154 - 175)
Department of Defense Appropriations Act 2007 (177 - 221)
(Section 9010, Public Law 109-289) (223 - 256)
you see that the highlight extends nearly twice as high as the actual characters and perhaps half the character height below the character. Take a look at the screenshot at
http://imgur.com/K8EUq.png to see what I'm talking about.
Is this a bug in pdf2swf? Is there a smarter way to highlight text in the SWF that will have a more accurate line height? Any advice or suggestions are welcome!
Thanks in advance!
Regards,
Matt