Using browser javascript to copy selected text from a pdf file opened in Air app.

I have posted this question on reader forum as well, but I think it is more suited here...
I am trying to create a note-taking application in air. I want to extract selected text from pdf file as a string object or to the clipboard.
Obviously, all pdfs in my local storage will not be scripted to recieve postMessages and act accordingly, and that is not practical either. So, my problem is, how can I copy the selected text in the pdf file (opened as an object in htmlloader within my Air app) to clipboard or directly in another control by say clicking a button in air application? I suppose, this is possible using javascript, however, I don't know which reader methods are exposed to the wrapper htmlloader control. In short, I want to execute app.execMenuItem("Copy") command through htmlloader javascript. Any alternate solutions are also welcome.
This is similar to passing inbuilt commands/methods/functions (of adobe reader) to pdf-reader plugin embedded in a webpage via javascript. This is possible in IE where the pdf is rendered as activex object, and hence JSObject interface of pdf document/reader is accessible to the browser javascript. I have also read that this same JSObject is accessible to VB as interface for IAC, so as the Air is Adobe's own product, I was wondering if equivalent of JSObject is accessible to htmlloader control as well.
Thanks in advance...
Mits

Thank you Thom for your reply...
from
http://www.adobe.com/devnet/acrobat/javascript.html
...Through JavaScript extensions, the viewer application and its plug-ins expose much of their functionality to document authors, form designers, and plug-in developers...
As it is explicitly mentioned, that the functionality of adobe reader are exposed for plugin development, I thought someone here might have used external javascript to execute some safe methods in adobe reader. The functionality (i.e. external javascript interface-JSObject) is already available for VB programmers to develop IAC. Further, the Acrobat SDK example called "AcroPDFinHML" shows how one can embed a pdf-reader in a html page and execute some safe methods (like gotonextpage(), zooming etc.) in IE as ActiveX plugin. I have checked it myself for adobe reader 9, and it works perfectly, so there is no security issue as such to implement the same for another browser (like in my case, the htmlloader control in flex/air app).
I intend to create a note taking application in air, where it is very much required that I should be able to copy selected text from various pdf documents, that are open in my app, and subsequently paste/collect/save the collected notes and process them afterwords (offcourse, from the pdfs that allow me copying text). However, it is not happening for me here. As the pdfs are opened through adobe reader plugin, it does not register the copy command executed by my air app. It registers the system level copy command (by keyboard shortcut Ctrl+C), but my air app has no way to execute the system level copy command programmatically. So I am kind of stuck here...
Thanks again for your reply. Having known what am I intend to accomplish, any other (may be alternative) solutions will be appreciated nonetheless...
Mits

Similar Messages

  • Why cannot I copy selected text from a pdf file opened in Adobe Reader XI?

    Hi all,
    I had a problem when I tried to copy some selected text on a pdf file([Linux.System.Programming(2nd,2013.5)].Robert.Love.文字版.pdf) , which was opened in Adobe Reader XI as below (non-English version):
    The error's text could be primarily translated as "An error occured when copied to clipboard. Internal Error." I'm not sure about the reason of this. I guess it is a problem or bug related to operating system or Adobe Reader XI. I had this problem when I used other versions of Adobe Reader though I cannot remember the exact number of versions now.
    The version of XI I'm using is 11.0.0.  The operating system is XP SP3.
    As I was writing this question, the problem disappeared and I cannot reproduce it again now.
    Could anyone help explain why the error message appearred or why the problem disappearred? If there is referrence provided, that would be finer. Thank you.
    Message was edited by: photonxp

    The document has been protected.
    Even if it doesn't have a password, the original author has applied "plagiarism" prevention to it.
    There is a program from Wondershare, called PDF Password remover, that will remove such restrictions, but I'm not allowed to recommend it, only to point out it's existence.

  • How to extract text from a PDF file using php?

    How to extract text from a PDF file using php?
    thanks
    fabio

    > Do you know of any other way this can be done?
    There are many ways. But this out of scope of this forum. You can try this forum: http://forum.planetpdf.com/

  • How to extract text from a PDF file?

    Hello Suners,
    i need to know how to extract text from a pdf file?
    does anyone know what is the character encoding in pdf file, when i use an input stream to read the file it gives encrypted characters not the original text in the file.
    is there any procedures i should do while reading a pdf file,
    File f=new File("D:/File.pdf");
                   FileReader fr=new FileReader(f);
                   BufferedReader br=new BufferedReader(fr);
                   String s=br.readLine();any help will be deeply appreciated.

    jverd wrote:
    First, you set i once, and then loop without ever changing it. So your loop body will execute either 0 times or infinitely many times, writing the same byte every time. Actually, maybe it'll execute once and then throw an ArrayIndexOutOfBoundsException. That's basic java looping, and you're going to need a firm grip on that before you try to do anything as advanced as PDF reading. the case.oops you are absolutely right that was a silly mistake to forget that,
    Second, what do the docs for getPageContent say? Do they say that it simply gives you the text on the page as if the thing were a simple text doc? I'd be surprised if that's the case.getPageContent return array of bytes so the question will be:
    how to get text from this array? i was thinking of :
        private void jButton1_actionPerformed(ActionEvent e) {
            PdfReader read;
            StringBuffer buff=new StringBuffer();
            try {
                read = new PdfReader("d:/getjobid2727.pdf");
                read.getMetaData();
                byte[] data=read.getPageContent(1);
                int i=0;
                while(i>-1){ 
                    buff.append(data);
    i++;
    String str=buff.toString();
    FileOutputStream fos = new FileOutputStream("D:/test.txt");
    Writer out = new OutputStreamWriter(fos, "UTF8");
    out.write(str);
    out.close();
    read.close();
    } catch (Exception f) {
    f.printStackTrace();
    "D:/test.txt"  hasn't been created!! when i ran the program,
    is my steps right?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How can i extract the text from the PDF files,Power point files,Word files?

    hi friends,
    i need to extract text from the PDF files,Power Point,Ms word files.Is it possible with java?if yes how can i extract text from those files.please give solution this problem.i would be thankful if u provide solution.
    regards,
    prakash.

    Find an API which could read each of those files and start coding.

  • How do I select text from multiple pdf pages using Microsoft Document Imaging

    Hello.  I have scanned 3 pages and saved to pdf, now in Microsoft Document Imaging I can only select text from the first page and cannot select text from the other 2 pages.  Is there a way to select multiple pages?
    Thank you.
    Cat

    Why don't you ask in a MS forum? This forum is for an Adobe product and I have no idea why you are asking about Microsoft Document Imaging here.

  • How do I copy and paste text from a pdf file and paste it into a new pdf or word file?

    I have a very large pdf file (500 pages) comprised of 200 letters.  How do I copy individual letters (copy and paste sections of the file) and put them in a new pdf or word file?
    Thank you

    Hi drredwood,
    When you open your PDF file a yellow bar will appear on the top of the screen.
    Click on 'Enable All Features'.
    Then you will be able to copy the content from your pdf and to paste in any of the file.
    Regards,
    Florence

  • Can not copy text from a pdf file

    https://sites.google.com/site/sharedacrobat/data/cannot_copy_text.pdf?attredirects=0&d=1
    I can not copy the table caption in the above pdf. If I do so, I will get some gibberish, such as %"/*&+%",-.%&1",/*%9&,*09%&
    I'm wondering what happens to the pdf file. Is there a way to fix it so that I can copy the text?

    asdfabcedasf wrote:
    https://sites.google.com/site/sharedacrobat/data/cannot_copy_text.pdf? attredirects=0&d=1
    I can not copy the table caption in the above pdf. If I do so, I will get some gibberish, such as %"/*&+%",-.%&1",/*%9&,*09%&
    I'm wondering what happens to the pdf file. Is there a way to fix it so that I can copy the text?
    Does anybody know what cause the problem and how to fix it? The current walkaround is to convert the pdf into image, then load the image into acrobat and perform OCR. But this is tedious and some information may be lost. I'm wondering if there is a better solution.

  • How can I copy a picture from a PDF file?

    I am looking for a app that can copy a picture on a PDF to keynote or pages. I have tried iannotate and adobe reader but failed. I read the introductions of a lot of other PDF apps, such as goodreader and PDF expert, but I don't think they are equipped with this function. Is there any apps having this kind of function? Thanks.

    EDIT: Oops! I just noticed that you are asking about iPad! Sorry, I don't know any solutions for you. You can still take a screenshot (hold the on/off button and push the home button).
    It depends on what you need. If you are trying to extract a high-resolution image to be printed, you will need Adobe Acrobat (not Reader, but real, paid-for Acrobat) or Adobe Illustrator. Other apps, I'm sure, can do this as well, but those are two.
    If you are only going to display the image on-screen, then lower-resolution is okay. Just open the PDF, zoom in on the image, and push command+shift+4 to take a screenshot. Draw a rectangle around the image and a new copy should show up on your desktop.

  • How to combine typed text from several pdf files into 1 (not comments)

    I have a fillable pdf form that people can type answers to questions into, then save the pdf into an electronic file. Sticky notes are not used, as this pdf was created using Adobe LiveCycle Designer's text field (that is what they type into). I am wondering if there is a way to combine all peoples' answers from the text field all into one pdf document just like you can do to combine all sticky note comments into one single pdf. This is not a LiveCycle Designer type question. Thank you for your help!

    You would have to flatten or print each filled form to a new file and then combine. If you try to combine multiple filled forms directly, you will end up with all of the pages having the same information since all the fields on each form have the same name. Since the form was create in Designer, you may only be able to print in Acrobat. Otherwise, you would probably have to do the changes in Designer. Once you have a file in Designer, you can no longer edit it in Acrobat and that is why the Acrobat route would probably require a print to the Adobe PDF printer for each form.

  • How can I copy text from a PDF document in bb pbk?

    I've tried to copy a text from a PDF document but adobe reader doesn't give me that option. How can I do it? or there is a better reader for PDF that allows to copy, make bookmarks, to highlights?

    If the PDF is not an IMAGE, you can using a free program called PDF-XChange Viewer from Tracker Software. If the PDF was done as an image then you will not be able to select the text.
    Bold 9000 on Rogers Network - Company BES
    Playbook 16G WiFi Only

  • Hi I've a big problem with adobe acrobat reader XI pro and I hope you can help me. The problem is; when I past copied text from some pdf books (not all of them) it past symbols only! wherever I past it! and even if I coped that text from another pdf reade

    Hi
    I've a big problem with adobe acrobat reader XI pro and I hope you can help me.
    The problem is; when I past copied text from some pdf books (not all of them) it past symbols only! wherever I past it! and even if I coped that text from another pdf reader (adobe pdf reader, internet browsers, ...etc.).
    This problem started to happen since yesterday when I installed adobe acrobat reader XI pro to try it before I buy it, and before that when I was using the free adobe pdf reader I was totally able to copy any text from any pdf and past it anywhere with nothing wrong.
    What can I do?
    thank you a lot.

    There is no product called Adobe Acrobat Reader Pro. There is
    - Adobe Acrobat Pro ($$)
    - Adobe Reader (free)
    Which do you have? And are you a programmer?

  • When I try to select text from pdf-documents the pdf reader cannot select a single line.

    When I try to select the text from a pdf file instead of selecting a line, the paragraph gets selected. The document does not have any document restrictions, and the text is not in an object form. Any reason why I am not able to select the text.

    Hi,
    Which 'Documents' folder are you referring to?
    A screenshot of the issue would be more helpful for me to understand the issue.
    Regards,
    Florence

  • Why copying from particular pdf files and pasting to Words introduces improper fonts?

    Why copying from particular pdf files and pasting to Words introduces improper fonts?
    I’m wondering copying from particular pdf files and pasting to Words introduces improper fonts! Is there some workaround to avoid this problem?
    Thank you for the help
    Best
    Jamal

    Thank you for the answer.
    if i save it as Word, then the all goes fine.
    my issue here, is why in particular cases copying and pasting from the pdf file to Word is working very well, but in others, it is not!
    what might be the reason?
    best
    Jamal

  • Full text search of .pdf files in a file table.

    I have installed the Adobe iFilter 11 64 bit and set the path to the bin folder. I still cannot find any text from the pdf files. I suspect I am missing something trivial because I don't find much when I Bing for this so it must not be a common problem.
    Here is the code.
    -- Adobe iFilter 11 64 bit is installed
    -- The Path variable is set to the bin folder for the Adobe iFilter.
    -- SQL Developer version 64 bit on both Windows 7 and Windows 8.
    USE master;
    GO
    DROP DATABASE FileTableStudy;
    GO
    CREATE DATABASE FileTableStudy
    ON PRIMARY
    ( NAME = N'FileTableStudy'
    ,FILENAME = N'E:\SQLServerData\SQL2012\Engine\FileTableStudy.mdf'
    ,SIZE = 4096KB
    ,FILEGROWTH = 1024KB
    ,FILEGROUP FileTableStudyFileTable CONTAINS FILESTREAM
    ( NAME = FileTableStudyFileTable
    ,FILENAME = 'E:\SQLServerData\FileTableStudy'
    LOG ON
    ( NAME = N'FileTableStudy_log'
    ,FILENAME = N'D:\SQLServerLogs\SQL2012\FileTableStudy_log.ldf'
    WITH FILESTREAM
    ( NON_TRANSACTED_ACCESS = FULL
    ,DIRECTORY_NAME = N'FileTableStudyFiles'
    GO
    USE FileTableStudy;
    GO
    DROP TABLE dbo.Magazine;
    GO
    CREATE TABLE dbo.Magazine AS FILETABLE
    WITH ( FileTable_Directory = 'MagazineStore'
    ,FileTable_Collate_Filename = database_default
    GO
    CREATE FULLTEXT CATALOG MagazineFullTextCatablog AS DEFAULT;
    GO
    --EXEC sp_fulltext_service 'load_os_resources', 1;
    --EXEC sp_fulltext_service 'verify_signature', 0;
    --EXEC sp_fulltext_service 'restart_all_fdhosts';
    --EXEC sp_fulltext_service 'update_languages';
    --EXEC sp_help_fulltext_system_components 'filter';
    --RECONFIGURE WITH OVERRIDE;
    SELECT document_type
    ,path
    FROM sys.fulltext_document_types
    WHERE document_type = '.pdf';
    SELECT *
    FROM sys.fulltext_document_types
    ORDER BY document_type;
    DROP FULLTEXT INDEX ON dbo.Magazine;
    GO
    SELECT TOP 1 indexes.name IndexName
    FROM sys.indexes
    JOIN sys.tables ON indexes.object_id = tables.object_id
    AND tables.name = 'Magazine'
    JOIN sys.schemas ON tables.schema_id = schemas.schema_id
    AND schemas.name = 'dbo'
    WHERE indexes.is_unique = 1
    AND indexes.name LIKE 'PK__%';
    GO
    -- Drag documents to folder.
    CREATE FULLTEXT INDEX ON dbo.Magazine
    ( file_stream TYPE COLUMN file_type)
    KEY INDEX [PK__Magazine__5A5B77D541728F3E];
    GO
    -- Wait for index to build
    SELECT DATEDIFF(ss, crawl_start_date, crawl_end_date) IndexBuildSeconds
    FROM sys.fulltext_indexes
    --ALTER FULLTEXT INDEX ON dbo.Magazine START UPDATE POPULATION;
    SELECT *
    FROM dbo.Magazine
    WHERE file_type = 'pdf';
    SELECT *
    FROM dbo.Magazine
    WHERE FREETEXT(*,'new core licensing')
    AND file_type = 'pdf';
    SELECT *
    FROM dbo.Magazine
    WHERE CONTAINS(*, N'"Microsoft"')
    AND file_type = 'pdf';
    SELECT *
    FROM sys.fulltext_catalogs;
    SELECT *
    FROM sys.fulltext_indexes;
    SELECT *
    FROM sys.fulltext_index_columns;
    SELECT *
    FROM sys.fulltext_index_catalog_usages;
    Thanks for any help.
    Tom G.

    Hello,
    We believe we have figured this out.  It looks like it has to do with the length of the default folder location for the Adobe iFilter.
    I was able to reproduce the issue and the following resolved it for me.  See if this resolves it for you all as well.
    Here is how to get Adobe Version 11 PDF filter to work.
     1 . If you haven’t already, run the following in SQL Server:
    Sp_fulltext_service ‘Load_os_resources’, 1
    Go
    --you might also need to run:  sp_fulltext_service ‘Verify_signature’,0  --This is used to validate trusted iFilters. 0 disables it. So use with caution.
    --go
    2. Stop SQL Server.  (Make sure FDHost.exe stops)
    3.  
    Uninstall the Adobe ifilter (because it defaulted to having spaces or the folder name is too long).
    4.  
    Reinstall the Adobe iFilter and when it prompts for where to install it, change it to: C:\Program Files\Adobe\PDFiFilter
    5.  Once the installation finishes, go the computer’s Environment variables. Add the following to the PATH.
    C:\Program Files\Adobe\PDFiFilter\BIN
    NOTE: it must include the BIN folder
    NOTE: If you had the OLD location that included spaces, remove it from the path environment variable.
    6. Start SQL Server
    7.  IF you had an existing Full-text index on PDFs, drop the full-text index and recreate it.
    8. You should now get results when you run sys.dm_fts_index_keywords('db','tblname')  --Note: Change db to be the actual database name and tblname to be the actual table name.
     Give this a try and see if this fixes yours. 
    Sincerely,
    Rob Beene, MSFT

Maybe you are looking for