How to Read a PDF File?

Hi,
I want to do something pretty basic: open a PDF file and
programmatically process its contents. Fundamentally, I would
like to
just have something that can get the text and do readLine and
return a
string for each line of text.
I searched everywhere for something that can do this. Just
reading a
PDF in raw will not work b/c it contains a good deal of
binary.
AlivePDF
http://alivepdf.bytearray.org/
appears to only be able to
create new PDF files.
The Core AS3 libraries appear to only be able to display PDF
content
in a browser:
http://livedocs.adobe.com/flex/3/html/help.html?content=PDF_1.html
Is there anything out there that can do this, or am I just
going to
have to write my own?
Thanks in advance,
Davis

Thanks for the info. I'm pretty new to AS/Flex, etc.
Incidentally, I'm looking to build an application using Flex, and a
good portion of it I've already written in Java. I actually have
this code done as a java library. What I'd really like to do is
just have the Flex App call that. Now, I know you can call out to
Java using RemoteObject, HTTP, WebService, etc, but the target for
this app is more likely to be Air -- i.e. a local desktop
application. As such, I don't really want to require a user to run
a J2EE web container locally just to call into a Java library.
So far, that is the only way I can figure out how to
communicate between AS and Java. The alchemy thing is what I'm
looking for -- but as a Java version. I don't really want to port
my code to C/C++ now, and then use the alchemy bridge. I'd either
port it to AS directly or use some bridge to Java.
As a Flex newbie -- can anyone tell me if there is an easier
way to integrate with Java code that doesn't require a web
container?
Thanks!
Davis

Similar Messages

  • How to read a PDF file content???

    Hi Experts,
    I need to read the pdf file content.
    Pdf file is in some repository
    I m unable to read pdf data with getContent() function.
    Please suggest me a way to read the pdf file
    Help will be appreciated and rewarded

    Hi Pankaj,
    Are you able to achieve the above said functionality? Even I too have the similar requirement.
    Can you pls let me know the solution or alternatives for your requirement you have followed...
    Thanks in advance.
    Nandu.

  • How to read from pdf file using VB

    I have a PDF file which contains three columns, emp no, designation, contact_info. I have 10 rows in that pdf file. I want to read row by row from the pdf file and write into another text file(tab delimited) using VB.
    Could you please help me reading the pdf file?
    Thanks,
    Arindam

    Without reading it in detail, this seems to be automating a save as text function in Acrobat. This will not give you any position information.
    If you want position information without writing a plug-in, you need to use the getPageNthWord and getPageNthWordQuads methods in JavaScript.
    If you have not already done so, you will need to download the Acrobat SDK which has the documentation you need.
    Writing in C# makes even very simple things complicated; if you have a choice, consider VB.

  • How to Read whole pdf file in ios7 email

    I recently installed iOs7 on my Ipad.  I only see the first page of any pdf attachment in the emails received. How do I read a multi page pdf file in email app

    Hi,
    Check standard program RSTXPDFT4. It is supplied in 4.6C, you can see how to do what you want.

  • How to read from pdf file?

    I am new to reading pdf using C# where I have below function in my project. How to recognize text position in pdf file?
    Here _dblRect has 151.0, 696.0, 400.0, 500.0
    _strFileName is txt file name.
    Can someone explain how this function works?
    private string fcnTextFromCrop(string _strFileName, double[] _dblRect, CAcroPDDoc _docOriginal, int _intPage)
                string str = "";
                try
                    object jSObject = _docOriginal.GetJSObject();
                    System.Type type = jSObject.GetType();
                    object target = null;
                    object[] args = new object[] { _intPage };
                    target = type.InvokeMember("extractPages", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, jSObject, args);
                    object[] objArray2 = new object[] { "Crop", 0, 0, _dblRect };
                    type.InvokeMember("setPageBoxes", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, target, objArray2);
                    object[] objArray3 = new object[] { _strFileName, "com.adobe.acrobat.plain-text" };
                    type.InvokeMember("saveAs", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, target, objArray3);
                    object[] objArray4 = new object[] { true };
                    type.InvokeMember("closeDoc", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, target, objArray4);
                    using (StreamReader reader = new StreamReader(_strFileName))
                        str = reader.ReadToEnd();
                        reader.Close();
                    System.IO.File.Delete(_strFileName);
                catch
                    str = "";
                return str;

    Without reading it in detail, this seems to be automating a save as text function in Acrobat. This will not give you any position information.
    If you want position information without writing a plug-in, you need to use the getPageNthWord and getPageNthWordQuads methods in JavaScript.
    If you have not already done so, you will need to download the Acrobat SDK which has the documentation you need.
    Writing in C# makes even very simple things complicated; if you have a choice, consider VB.

  • How to read a PDF file in ABAP

    We are on <u><b>46C</b></u>
    I searched sdn and found couple of solutions which might work in higher versions of SAP but not in 46C. The classes used in the examples are not available in 46C. Could anybody please share the code to read a PDF in ABAP.
    Regards
    Kasi

    Hi,
    Check standard program RSTXPDFT4. It is supplied in 4.6C, you can see how to do what you want.

  • How to read a PDF file from server

    Hi All,
    I am strucked while creating new file instance .
    Here i know the URL.
    How to create the File instance by using this URL.
    I tried the following way:
    URI uri = url.toURI();
    File f = new File(uri);
    Here i got the following exception :
    <code>
    Exception in thread "main" java.lang.IllegalArgumentException: URI scheme is not "file"
    </code>
    Can any one help me?
    Thanks in advance......

    Can any one help me how can i down load a file
    from server by using URL?RTFAPI. Url.openStream().

  • Using a servlet to read a pdf file that is in remote server

    Hi,
    I read some topics about how to read a pdf file using a servlet...but my issue is that my pdf files are on a remote Sun solaris server (intranet) and my servlet will be in a public network (internet), so my question is, still be possible to use this solution to read my remote file ? how i can access the remote file ??
    any idea from where I can start ??
    best regards,
    carlos.

    You may use a FTP client component to connect with your servlet to the Sun server, retrieve the bytes and serve them to the browser. Instead of reading the stream from a local file, you will be reading from a network socket, but the code -if well written and designed- may be very similar.
    There are many good ftp client components for java, you may also use other protocols like HTTP or SCP (ssh file transfer).
    Regards,
    Martin Cordova
    http://www.martincordova.com
    Dinamica framework for J2EE
    - the easiest way to Java webapps...

  • Read a pdf file line by line

    Hi
    I am trying to read contents of a pdf file .I used pdfbox it worked but the problem ,is for large pdf files it throws OutofMemory Exception
    so i want to know how to read a pdf file line by line using pdfbox or any other API's
    Thanks

    gkraju wrote:
    It will work but
    String x1= stripper.getText(doc);reads the whole document .so it will also throws exception if the file size is large.It might be an idea if you spent a few minutes considering the code fragment which was kindly posted. Your problem is that reading the whole file's text into memory uses up all the memory. Okay, that's a problem. So instead of whining here, why not consider what might fix that problem? The ridiculously obvious idea is to not read the whole file's text into memory. Can you figure out how to change the posted code to read, for example, only one page? If you can't figure that out then, really, perhaps you ought to consider doing something else instead of programming.

  • How do I read a pdf file in Acrobat Reader (vs. Preview)?

    How do I read a pdf file in Acrobat Reader (vs. Preview)? I have a Mac OS, need to know the process to read a pdf file document in Acrobat Reader instead of Preview. Much thanks for suggestions.

    Right click the PDF. Choose "Open With..." Select Reader.
    Or.
    Right click and "Get Info"
    under "Opens with" change the default app to Reader, and click "Change all" to set the preference for ALL PDFs.

  • How do I convert a read only word doc to a read only pdf file?

    How do I convert a read only word doc to a read only pdf file?
    Thanks, Linda

    Hi Linda,
    I just tried it, and was able to convert a Word .doc to to PDF, in spite of the fact that it was marked Read Only. Here are the instructions for uploading and converting to PDF with Acrobat.com:
    http://help.adobe.com/en_US/Acrobat.com/Acrobat/WS396AAA88-4AA4-4a40-87B8-004A5DC1E131.htm l
    Kind Regards,
    Michelle

  • How can I convert .pdf file to .doc using the free adobe reader app? when I try to convert the .pdf file it asks me to sign in. when I click on "sign in", I am taken to a service subscription page. So, no free conversions using free adobe reader app?

    how can I convert .pdf file to .doc using the free adobe reader app? when I try to convert the .pdf file it asks me to sign in. when I click on "sign in", I am taken to a service subscription page. So, no free conversions using free adobe reader app?

    As has been mentioned Adobe Reader cannot export PDF page content. Nor can it create PDF or manipulate PDF page content.
    What you can do is use one of Adobe's online subscription services. Two provide for PDF  to Word export.
    There's ExportPDF and PDF Pack.
    Be well...

  • How do I save PDF files on my iPad to read later?

    How can I save PDF files from a website on iBooks to read later?

    Open the PDF in Safari and then tap it and you should get a bar at the top of it with 'open in iBooks' as an option - tap that and it should be copied to the iBooks app.

  • How to reduce a PDF file size under Adobe Acrobat Reader DC. The size is now 23MB; I need it to be less than 4MB. thanks

    how to reduce a PDF file size under Adobe Acrobat Reader DC. The size is now 23MB; I need it to be less than 4MB. thanks

    I've found in Pdf's many time when you go to Optimize a PDF and look at the font list there are often up to a 1/2dozen copies of a given font, say Helvetica, then that many Helvetica Bold, or Arial or Ariel Italic
    What I do ie remove from list all but one copy of each different font. often dramatically reduces the size. also something lese is Flattening images will in some cases reduce a file size. I have run into a case where it actually made a PDF Larger.

  • How read a pdf file and change TableCell height after reading it using itext api

    I have created a pdf form file using itext ( see class CreatingFormClass ) with itext PdfPTable and PdfPCell. It is done successfully .
    Now I  read this pdf file and filling this pdf file(see class FillingFormClass  ) and at this point i want to change  PdfPCell height () according to Items.
    It is possible or Not???
    My code is given below.
    Thanx in advance
    public class FillPdfFormMainClass {
    public static  String RESULT1 = "E:/BlankForm.pdf";
        public static  String RESULT2 = "E:/FilledForm.pdf";
        public static void main(String[] args) throws DocumentException, IOException {
            String empName="Rakesh Kumar Verma";
                    // This part is Dynamic. It can be 1 item Or can be 25 items
            String listOfItem="Item 1 \n Item 2 \n Item 3\n Item 4 \n Item 5 \n Item 6 \n Item 7 \n Item 8 \n Item 9";
            CreatingFormClass example = new CreatingFormClass(0);
            example.createPdf(RESULT1);
            FillingFormClass class1 = new FillingFormClass();
            class1.manipulatePdf(RESULT1, RESULT2,empName,listOfItem);
    public class CreatingFormClass implements PdfPCellEvent {
        protected int tf;
        public CreatingFormClass(int tf) {
            this.tf = tf;
        public void createPdf(String filename) throws DocumentException, IOException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(filename));
            document.open();
            PdfPCell cell;
            PdfPTable table = new PdfPTable(2);
            table.setWidths(new int[]{1, 2});
            table.addCell("Name:");
            cell = new PdfPCell();
            cell.setCellEvent(new CreatingFormClass(1));
            table.addCell(cell);
            table.addCell("Item List:");
            cell = new PdfPCell();
            cell.setCellEvent(new CreatingFormClass(2));
            cell.setFixedHeight(60);
            table.addCell(cell);
            document.add(table);
            document.close();
        public void cellLayout(PdfPCell cell, Rectangle rectangle, PdfContentByte[] canvases) {
            PdfWriter writer = canvases[0].getPdfWriter();
            TextField text = new TextField(writer, rectangle, String.format("text_%s", tf));
            text.setBackgroundColor(new GrayColor(0.95f));
            switch (tf) {
                case 1:
                    text.setText("Enter your name here...");
                    text.setFontSize(8);
                    text.setAlignment(Element.ALIGN_CENTER);
                    break;
                case 2:
                    text.setFontSize(8);
                    text.setText("Enter Your Address");
                    text.setOptions(TextField.MULTILINE);
                    break;
            try {
                PdfFormField field = text.getTextField();
                writer.addAnnotation(field);
            } catch (IOException ioe) {
                throw new ExceptionConverter(ioe);
            } catch (DocumentException de) {
                throw new ExceptionConverter(de);
    public class FillingFormClass {
        public void manipulatePdf(String src, String dest,String empName,String listOfItem) throws IOException, DocumentException {
            PdfReader reader = new PdfReader(src);
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(String.format(dest, empName)));
            AcroFields form = stamper.getAcroFields();
            form.setField("text_1", empName);
            form.setField("text_2", listOfItem);
            stamper.close();
            reader.close();

    Hi,
    I am facing the same problem. Please help me out. I just want to read a PDF file as bytes from one location and write it as another pdf file in some other location with a diolog box prompting to open or save in the location where we want.
    I executed the following code:
    try{
    File report =new File(location);
    BufferedInputStream in=new BufferedInputStream(new FileInputStream(report));
    response.setContentType("application/x-download");
    response.setHeader("Content-Disposition", "attachment; filename=" + report.getName());
    OutputStream outs = response.getOutputStream();
    int readlen;
    byte buffer[] = new byte[ 256 ];
    while( (readlen = in.read( buffer )) != -1 )
    outs.write( buffer, 0, readlen );
    outs.flush();
    outs.close();
    in.close();
    response.setStatus(HttpServletResponse.SC_OK);
    } catch (FileNotFoundException fileNotFoundException) {
    PrintWriter out= response.getWriter();
    out.print("<center><Font color = 'RED'><b>"+PxDSLUtils.getApplicationProperty("label.error.CTM_E017")+"</b></Font></center>");
    Though it prompts with open, save dialog box when i try to open directly or when i save it some where locally and then open it i am getting the following message " File is repaired ot damaged.Operation failed." Any idea about what can be done??? Its very urgent.Please suggest.
    I am not convetin to string just reading and writng as bytes itself.
    Thanks in advance,
    Mani

Maybe you are looking for

  • Interview preparartion...

    Hi, I am a two years experience in SAP R3 4.7, ECC 5.0 and ECC 6.0. and i am looking for a job change. So plz suggest me suitable documents and sites to so that I can prepare for the interview. What wouold be the most obious questions asked in a inte

  • I need recovery media for my HP Touchsmart tm2t-2100 CTO.

    I purchased my Tablet PC in December of 2010.  It has worked great until it crashed in the middle of May this year (2012).  I was not able to restore using system recovery through the F11 keys nor my DVD's.  I own a full copy of Windows 7 Ultimate th

  • Flash player not working for facebook game "resort world"

    Windows 7, 64bit Flash Player ver. WIN 10,1,85,3 I'm having trouble with the specific game on facebook called "resort world", everytime i try to access it, the page just keeps refreshing itself non-stop. I ran the uninstaller, restarted my computer a

  • How do i sign Singn in on android with no computer

    How?

  • Web stats for hit counter

    I've got a nice hit counter built with help from these forums. It's working beautifully. Now I'm building the web stats page. (no I'm just using CF7 and don't have CFStat from CF8 yet) I would like to display the total count for the month (which I've