getSelectedText() from flex

Publishing Flash documents by embedding them in Flex applications
Post Reply
stkmks
Posts: 1
Joined: Wed Feb 13, 2008 4:55 am

getSelectedText() from flex

Post by stkmks » Wed Feb 13, 2008 5:21 am

Hi, I found your product while looking to render PDF's within flex, and with the SDK it looks great some personal projects of mine.

Just some quick questions:
From flex im trying to get the contents of selected text into a label for display. I'm having a problem in that the resulting string seems to be encoded in some way, text that is in bold is visible, but the rest when assigned to flexlabel.text shows up as squares.. just in case here is what i tried:

- set the onSelection event for the Print2FlashDoc component to a method,
- from the method called doc.getSelectedText(anothermethod)
- the signature for the callback method was anothermethod(result:String) (it wasn't documented that i had to do this..?)
- anothermethod then used the parameter result to set the text attribute of a flex label.

When running, the events were called ok, but the resulting text was not displayed correctly. Not sure how far i got, but trying typeof result parameter did echo string. I tried using a flex rich text component with the same results.

Any ideas on how to get the text from the selection correctly? Or decode the output into plain text? I dont mind loosing any formatting.

Also
- Noticed the performance of the resulting swf's is not so good for large pdf's (say 90 pages plus) the mouse skipping frames when over the pages of these large docs, any tips, as id like to display documents with a few hundred pages.

- If i were to register the pro version, does that cover all future updates, or just to a specific version?

Thanks for any help.
Attachments
text.png
text.png (71.38 KiB) Viewed 9260 times

staff
Posts: 281
Joined: Sat Dec 15, 2007 4:48 pm

Re: getSelectedText() from flex

Post by staff » Wed Feb 13, 2008 9:45 am

Can you copy text from your document manually by selecting it with mouse and pressing Ctrl-C? If you can't do this and receive garbled text this way, it is a known problem with certain PDF documents that use custom encoding for their fonts. The problem is Adobe Reader does not send valid character codes when printing such documents to Print2Flash printer. As a result search and text copying functions cannot work. We haven’t found a solution yet, but we continue to explore this issue to find a workaround and we’ll let you know when a solution is found. We think one of possible workarounds would be using some tool to remove custom encoding from such documents. Or if you obtained that PDF from another type of document (e.g. from MS Word using Adobe Distiller), convert the original document to Flash rather than PDF.

Performance of large documents depends on Flash Player rendering speed so if you experience slow operation, it means your Flash Player/document combination is at the limit of your computer speed. You may try to reduce document size and complexity by reducing Print2Flash Printer resolution in Default Printing Preferences window.

If you obtain a license, it will cover all minor version updates (2.x).

samant
Posts: 2
Joined: Wed Dec 10, 2008 1:18 am

Re: getSelectedText() from flex

Post by samant » Wed Dec 10, 2008 1:23 am

Hi, I am facing the same problem. But I can able to select and copy the text from the original pdf document. Please suggest.

samant
Posts: 2
Joined: Wed Dec 10, 2008 1:18 am

Re: getSelectedText() from flex

Post by samant » Wed Dec 10, 2008 2:53 am

When I convert the pdf file to the doc file and then publish the swf file via Print2Flash tool, its working fine. It seems that there is an issue with Print2Flash tool in reading some pdf files.

staff
Posts: 281
Joined: Sat Dec 15, 2007 4:48 pm

Re: getSelectedText() from flex

Post by staff » Thu Dec 11, 2008 7:45 am

Yes, there is such a problem but it is related to Adobe Reader as it is the Adobe Reader that actually reads PDF files and prints them. The fact is it may sometimes send text to printers not as text but as images or with invalid character codes. As a result Print2Flash cannot extract valid text and text copy and search functions cannot work. The text may be searchable and copyable in the Adobe Reader interface but when it sends the document to printers, it still may represent some text as images or send it with invalid codes.

The fact is printing feature in Adobe Reader is oriented towards printing on real printers and getting a hard copy of documents. As it does not matter whether text is represented by valid or invalid character codes when it is printed on paper, Adobe Reader seems not to be over-scrupulous to represent text as text when sending it to printers. This problem is known to happen for some of PDF documents containing custom encoding fonts or Type 1 fonts so you may try to remove dependency on those fonts from source documents. Also, you may try another software for PDF document conversion, for example, Foxit Reader 2.0 which is known to be able to resolve this problem for some of the PDF documents which are printed with incorrect character codes by Adobe Reader.

If you obtain your PDF documents from another type of documents, e.g. MS Word, you may convert those documents directly to Flash and do not use PDF format.

coolsegi
Posts: 1
Joined: Wed Jan 28, 2009 9:51 am

Re: getSelectedText() from flex

Post by coolsegi » Wed Jan 28, 2009 10:07 am

I am facing the same problem. I am able to extract the text with some fonts and with some fonts I am not able to extract the text. Could you please share what is the exact reason for this issue and how can I resolve this? Are there any particular settings in the indesign which can be used for publishing such pdfs which work fine with this tool for extracting the text.
Please help its very urgent! Is there any forum where we can call and discuss this?

DarrenHasler
Posts: 1
Joined: Tue Feb 01, 2011 3:52 pm

Re: getSelectedText() from flex

Post by DarrenHasler » Tue Feb 01, 2011 3:57 pm

I can copy the text but it loses its font. It comes in regular font. There is a bug in the feature.

Post Reply