Read text from a simple PDF file

Is it possible to extract text from a simple PDF (Non-Interactive) in ABAP? May be using the class CL_FP_PDF_OBJECT ?
Let's say I have a pdf document with a couple of lines of text. How can I read the "actual" text in an ABAP program?
Thanks for your help!

Of course you can do this, but not using the standard SAP/ABAP/Adobe.
Check for the Java library called iText. Now you think you don´t need Java, of course. If you cannot use Java, at least you can check the coding of this library and do it in ABAP for yourself.
But there is no such a tool in standard SAP because why would one buy a Interactive form licence if it would be so easy?

Similar Messages

  • Extracting text from .doc,.ppt,.pdf files

    How can i extract ascii text from the file types like .doc , .ppt , .pdf ,. xls ..etc.
    Any tips/hints would be helpful
    Thanks
    Rama

    HI I tried for pdf, but didn't succeed
    Following is for text/Doc files
    <pre>
    import java.io.*;
    public class Doc
         public static void main(String[] args)
              try{
                   File file=new File("c:\\downloads\\WP2001.doc");
                   LineNumberReader buffer=new LineNumberReader(new FileReader(file));
                   StringBuffer buff=new StringBuffer("");
              boolean valid=true;
              while(valid)
                   //System.out.println(buffer.readLine());
                   buff=buff.append(buffer.readLine()+"\n");
                   if(buffer.read()==-1)
                        valid=false;
                   else
                   buffer.setLineNumber(buffer.getLineNumber()+1);
                   System.out.println(buff);
              catch(Exception fne)
                   System.out.println("File Not Found"+fne);
    </pre>
    pathreading

  • How do I link to Anchor Text from browser to PDF file exported from InDesign?

    I see that this question was asked previously but not answered:
    http://forums.adobe.com/message/3737541
    I need a way to link to topics (from an HTML page) within a structured PDF file generated from InDesign, i.e. one that has an interactive bookmarks
    panel, that doesn't break the links when the file is updated.
    In particular, I don't want to refer to:
    *  page numbers because the document will repaginate when it is updated, breaking existing links
    * named destinations that are numeric as addition/deletion of topics renumbers the named destinations, breaking the links.
    Is there any option in InDesign that creates named destinations derived from bookmark titles as that would seem to solve my problem?
    I have a similar need, but I have not been able to find an answer anywhere online, even after a several hours of research.
    I am on contract with General Electric to develop a UI Style Guide for an international team of developers. My client wants to be able to distribute the Style Guide as a PDF document, but needs to provide links to specific topics when submitting a "Story" in an Agile development environment to the programmers.
    Ideally, I would like to be able to create "named destinations" in InDesign such that I can provide the client with a list of URLs similar to this format:
    file:\\StyleGuide\Test1-20131024a.pdf\#nameddest=AnchorText-01
    However, I can not figure out how to create "named destinations" in the PDF file from the InDesign file in which I have created the Anchor Text in the Hyperlinks tab.
    Alternately, the client would be satisfied with the ability to link to specific bookmarks in the exported PDF file that have been derived from the configuration of the Table of Contents styles, but my research has led me to believe that it is not possible to hyperlink from a browser window to a bookmark in a PDF file (only to specific page numbers, search word lists, named destinations, and comments) as described here: http://blogs.adobe.com/tcs/2011/01/tcs-specific/linking-to-a-page-within-a-pdf-and-more.ht ml
    Having been using InDesign since 1988, when it was PageMaker, I would prefer to use it to provide GE with the most attractive deliverable, but they are now leaning heavily toward having me licensed with Madcap Flare, which has this capability built in:
    http://webhelp.madcapsoftware.com/flare9/Default.htm#Nav_Links/Named_Destinations/Creating _Named_Destinations.htm
    Please help me to find a solution that will allow me to continue using InDesign for this project.
    Thank you!
    Lynne O’Connor
    Technical Writer (contractor)
    GE Oil & Gas - Measurement & Control

    Follow-up post (solution is not available):
    I have just completed a phone call with Gaurev Sethi of Adobe escalated technical support in which I shared my screen to explain and demonstrate the desire to link from an external URL to a specific location within a PDF file that has been exported from InDesign. After 40 minutes, during which I was placed on hold a few times while he consulted with his team, it was determined that the desired functionality is not supported in InDesign and has been identified as a limitation of the software.
    In researching alternate documentation software that supports PDF export, I discovered that Madcap Software supports this functionality in its Flare product:
    http://webhelp.madcapsoftware.com/flare9/Default.htm#Nav_Links/Named_Destinations/Creating _Named_Destinations.htm
    Note that linking via URL to a bookmarked location within a PDF is not supported:
    http://blogs.adobe.com/tcs/2011/01/tcs-specific/linking-to-a-page-within-a-pdf-and-more.ht ml
    More about parameters that can be specified to open PDF files are available here:
    http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf
    Although the above link is for a previous version of Acrobat, I could find no evidence to the contrary in the current SDK documentation.
    -Lynne

  • How do I copy text from an uploaded pdf file?

    I have a document and want to copy the text of one page into a new document.  How do I proceed to do that?  I am using the Adobe cloud product.
    Thanks in advance.

    Just some observations.
    PDF page content that is an image (and music notes may very well be that in a given PDF) then all that can be exported is the image.
    Only an image editor can "edit" such eh.
    As to textual content - once in TXT, RTF, DOC or DOCX yes, expect to have to do "cleanup"
    Of course there's the old school alternative that is always available.
    Paper copy beside you as you transcribe to a fresh word processing file.
    Be well...

  • My reader will not open a PDF file that I have downloaded from a government web site (an application form) - it states that the file is not good.  I can open on the web site but not from my mac computer

    My reader will not open a PDF file that I have downloaded from a government web site (an application form) - it states that the file is not good.  I can open on the web site but not from my mac computer.

    Maybe this: http://helpx.adobe.com/acrobat/kb/pdf-error-1015-11001-update.html ?
    Do you have a link to that document?

  • Indesign CS3-JS - Problem in reading text from a text file

    Can anyone help me...
    I have an problem with reading text from an txt file. By "readln" methot I can read only the first line of the text, is there any method to read the consecutive lines from the text file.
    Currently I am using Indesign CS3 with Java Script (for PC).
    My Java Script is as follows........
    var myNewLinksFile = myFindFile("/Links/NewLinks.txt")
    var myNewLinks = File(myNewLinksFile);
    var a = myNewLinks.open("r", undefined, undefined);
    myLine = myNewLinks.readln();
    alert(myLine);
    function myFindFile(myFilePath){
    var myScriptFile = myGetScriptPath();
    var myScriptFile = File(myScriptFile);
    var myScriptFolder = myScriptFile.path;
    myFilePath = myScriptFolder + myFilePath;
    if(File(myFilePath).exists == false){
    //Display a dialog.
    myFilePath = File.openDialog("Choose the file containing your find/change list");
    return myFilePath;
    function myGetScriptPath(){
    try{
    myFile = app.activeScript;
    catch(myError){
    myFile = myError.fileName;
    return myFile;
    Thanks,
    Bharath Raja G

    Hi Bharath Raja G,
    If you want to use readln, you'll have to iterate. I don't see a for loop in your example, so you're not iterating. To see how it works, take a closer look at FindChangeByList.jsx--you'll see that that script iterates to read the text file line by line (until it reaches the end of the file).
    Thanks,
    Ole

  • Problem with reading text from .DOC files through java and POI

    I have used a jar file "poi-scratchpad-3.2-FINAL-20081019.jar" and "poi-3.2-FINAL.jar" to read text from a .DOC file. I used the "getParagraphText()" function of the class "org.apache.poi.hwpf.extractor.WordExtractor" to get the text.
    I am able to get the text in the .DOC file but along with that i am getting the following messages/warnings
    Current policy properties
    *     thread.thread_num_limited: true*
    *     file.write.state: disabled*
    *     net.connect_ex_dom_list:*
    *     mmc.sess_cab_act.block_unsigned: false*
    *     mmc.sess_cab_act.action: validate*
    *     mmc.sess_pe_act.block_blacklisted: false*
    *     mmc.sess_pe_act.block_invalid: true*
    *     jscan.sess_applet_act.stub_out_blocked_applet: true*
    *     file.destructive.in_list:*
    *     jscan.sess_applet_act.block_all: false*
    *     file.write.in_list:*
    *     file.nondestructive.in_list:*
    *     window.num_limited: true*
    *     file.read.state: disabled*
    *     jscan.session.origin_uri: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/poi/poi/3.2-FINAL/poi-3.2-FINAL.jar*
    *     file.nondestructive.state: disabled*
    *     jscan.session.user_ipaddr: 10.136.64.153*
    *     net.connect_other: false*
    *     thread.thread_num_max: 8*
    *     file.destructive.ex_list:*
    *     file.nondestructive.ex_list:*
    *     file.write.ex_list:*
    *     jscan.sess_applet_act.sig_invalid: block*
    *     file.read.in_list:*
    *     mmc.sess_cab_act.block_invalid: true*
    *     jscan.session.policyname: TU1DIERlZmF1bHQgUG9saWN5*
    *     mmc.sess_pe_act.action: validate*
    *     thread.threadgroup_create: false*
    *     net.connect_in_dom_list:*
    *     net.bind_enable: false*
    *     jscan.sess_applet_act.sig_trusted: pass*
    *     jscan.session.user_name: 10.166.64.201*
    *     jscan.session.user_hostname:*
    *     file.read.ex_list:*
    *     jscan.sess_applet_act.sig_blacklisted: block*
    *     jscan.session.daemon_protocol: http*
    *     net.connect_src: true*
    *     jscan.sess_applet_act.unsigned: instrument*
    *     mmc.sess_pe_act.block_unsigned: false*
    *     file.destructive.state: disabled*
    *     mmc.sess_cab_act.block_blacklisted: true*
    *     window.num_max: 5*
    Below the above messages/warnings the data is getting printed. Only the text part of the data is retrieved not the fonts, styles and bullets etc.
    Can anyone explain me why I am getting above warnings and how can I remove them. Is it possible to fetch the text depending on delimiters.
    Thanks in advance,
    Tiijnar
    Edited by: tiijnar on May 21, 2009 2:45 AM

    The jar files which were used are downloaded from http://jarfinder.com. Those jars created the problem of displaying those messages on console. I downloaded APIs from apache.org and used them in my application. Now my application is running good.
    Tiijnar

  • How can I correct "hidden" text in a searchable PDF file?

    This seems like a simple question. However, the answers are invariably complex, do not yield the desired result, and often answer a different question entirely. I say all that just to warn people up front that the "problem" is easier than how many people and PDF application developers, including Adobe, typically understand it while the proposed "solutions" are invariably a total...well, botch is a reasonable word if a bit understated.
    Here is the actual problem:
    I have "searchable" PDF files created by scanning documents and running them through an OCR process. I create "searchable" PDF files in order to archive, index, and eventually enable searching for the documents scanned. A "searchable" PDF satisfies those criteria better than any other commonly used, "portable" archive format -- though I would be happy if someone could point out an obvious alternative I may have overlooked. I do not need perfect OCR results. If I need a document to edit or perhaps feed into a spreadsheet or database, I expect to be able to reprocess the page images in a given "searchable" PDF file to OCR and convert the contents to Word, RTF, Excel, or another file format as necessary with more care for the results than for the archived document itself. Therefore, the "searchable" PDF document is the scanned page images which compose it while the OCR generated "searchable" text is secondary, but still important. Therefore, each file must contain scanned page images of sufficient detail to be efficiently converted by OCR if possible and legible enough for whoever views the images to be able to work out what an OCR process may fail to understand. Once scanned, those pages are the "document" and therefore "immutable." However, OCR is imperfect. For a searchable document archive, it does not have to be, but some errors are significant in that they may prevent the document from being found by a search. Therefore, there must be a way to view and, if necessary, edit the "hidden" text in a "searchable" PDF without altering the visual display of a document or how it is printed. No strike-throughs. No visible "corrections." None of the stuff PDF editors want to insert into a PDF file when editing it. I do not want to edit the document without exporting it to a format appropriate for an editable document. I just want adequately "correct" hidden text in a "searchable" PDF file.
    I apologize for the length and redundancy in my description of the problem. However, past attempts to explain my problem and objectives as well as what I have seen in reply to similar queries across the Internet indicate that most people trying to answer this question come at it from the same point of view shared by most, if not all, PDF tool or application vendors. They seem to think that any desire to edit a PDF file is a desire to have a PDF word processor of some sort. Or, they assume that the OCR process employed may need tweaking of the means by which people apply it and then a process like "find suspects" is adequate to deal with any errors. But no, those are not what I am trying to accomplish and answers which address those topics do not answer this question.
    In short, which tool or application from any vendor will reveal the "searchable" hidden text in a PDF produced by any OCR or other process and then enable corrections to the hidden text without changing any document display parameters at all? Note, hidden text typically includes bounding box information denoting the portion of the image from which the text was recognized. That information must not be lost or changed when editing the "searchable" text.
    So, any tools or applications capable of doing this? If Adobe Acrobat XI Pro can (use of a trial copy demonstrated that the hidden text content can be reviewed, but editing did not work by any straight-forward means I could work out while trying out the application), fine. However, $500.00 list or even a $200.00 possible upgrade from a copy of Adobe Acrobat X Standard which came with my scanner is a lot of money for personal use when review and edit of the OCR generated hidden text in a "searchable" PDF file is the only function I require. Therefore, other suggested tools or applications which do what I need for less would be greatly appreciated.

    My "claim"? Actually I've made no "claim" such as you've mentioned.
    Simply stated your OP has foundational premises that presume as factual what is not.
    Here, we're in Adobe's hosted user forum for Acrobat.
    Any other application use is not material. 
    Acrobat XI provides 3 OCR methods.
    Searchable Image, Searchable Image (Exact) & ClearScan.
    Only the first two provide the "hidden" text output.
    (Glyphs have no stroke, no fill)
    From back to the Acrobat 3 product family the design functionality of Searchable Image and Searchable Image (Exact) has been to facilitate the use of Find / Search.
    The "hidden" text is can be touched up. Acrobat Pro provides the facility to view the hidden text.
    So you can see what the OCR output that correlates to the bit-map images of the characters that are present.  
    With Acrobat XI Pro use Tools - Protection -Remove Hidden Information
    In the Remove Hidden Information pane select "Hidden text" then "Show preview".
    The default for the preview is "Show Only Hidden Text".
    Back in the PDF --
    You'd select some of the hidden text and retype what you suspect is the correct string of characters.
    Save and return to the preview of the hidden text.
    If you got it right, good. Continue.
    If not, darn - try again.
    Plug 'n chug -- somewhere over the rainbow it'll be done eh.
    Full disclosure -- this is something I've done (enquiring minds don't you know).
    I've found it to be a rather Sisypean undertaking.
    So, "doable" but not practicable.
    This is to be expected because such touchups are not the concern / focus of the output from Searchable Image or Searchable Image (Exact) - (the names tell it all).
    To have touchup "editablity" of an OCR output using Acrobat make use of ClearScan.
    ClearScan replaces recognized character bit-maps with a character from an Acrobat internal font.
    The character strings can be selected to change to a generic, system available font.
    Something that is good to know when embarking on the "tweak the PDF" journey is that PDF (the file format / technology as defined by its ISO Standard, ISO 32000-1) does not tolerate "editing". PDF is decidely not a word processor file format and "editing" can quickly render a PDF unusable.
    Minor touchups can be made and your best "tool" for this is still Acrobat Pro. (Save As often and periodically "bank" the PDF via some file rename scheme.) 
    Be well...

  • How to Create a Table of Contents From an Imported PDF File?

    I have imported a 150 page PDF file into inDesign 5. I want to create a Table of Contents for my document, but there are no paragraph or heading styles in the document. If I built the document in inDesign, I would have labeled each chapter "Heading 1" and then instructed inDesign to collect up all the Heading 1s and make a TOC automatically.
    But I didn't create this PDF, it has no formatting at all. Its just been placed in the inDesign document space.
    Anyone have any tips of how I can pick out all the Chapter headings.....they are in a distinctive format (14 point bold) from the rest of the document text.
    Anyone?

    InDesign cannot read *anything* out of a PDF file.
    Open in Acrobat, copy heading, paste in InDesign. Repeat until done.

  • Adobe Reader could not open a pdf file - either not supported file type or file damaged

    On March 5th, I started getting the Adobe Reader error message "Adobe Reader could not open a pdf file because it is either not supported file type or the file has been damaged.
    I get this when I try to open the pdf file as an attachment in Outlook 2013 from my G-Mail account.  If I save the attachment and then try to open the pdf document, I get the same error4.
    I get this error message with every pdf file that now comes to me in Outlook.
    If I log on to my G-Mail I am able to open the pdf document.  If I also save the attachment to my computer, I do not get the error message when I open the pdf file. This would suggest the file is okay
    This would lead me to believe the problem maybe with Outlook.
    I'm using Adobe Reader XI v11.0.10
    I'm using Windows 8.1
    Is anyone encountering this same issue with outlook?

    I copied it again.  Do you see it?  BTW, how do I set privacy?  (I'm new at this)
    I opened with two different notepads and got different information.here it is from Windows Notepad.  First few lines are:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
    >
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">td img {display: block;}</style>
    </head>
    Here it is from MS Notepad:
    <HTML><HEAD><style>.ending {font-family: Calibri; font-size: 18px;}</style><BODY><TABLE><TR><TD colspan=100%><a href="http://www.trulynolen.com/questionnaire?l=14115468&o=141050070&z=85087-7515"><img src=http://newsletter.tnolen.com/email/service.png border=no></a></TD></TR><TR><TD align=center class="ending">If you would not like to receive email communication from Truly Nolen in the future, please <a href="http://newsletter.tnolen.com/unsubstart.asp?b=14115468&z=85087-7515&e=[email protected]/unsubstart.asp?b=14115468&z=85087-7515&e=[email protected]">click here</a></TD></TR></TABLE></BODY></HTML>

  • This PostScript file was created from an encrypted PDF file.

    I have a postscript file which has been created from secure or encrypted (opening restriction) pdf.
    Now when i use distiller to convert this postscript file to pdf then distiller cannot produce a pdf file.
    The log file contains following text:
    This PostScript file was created from an encrypted PDF file.
    Redistilling encrypted PDF is not permitted.
    %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
    %%[ Warning: PostScript error. No PDF file produced. ] %%
    1) Is there a way to convert this postscript file into pdf ?
    I have a limitation that i cannot remove security from secure pdf.
    2) Do distiller provide any settings which can be changed to convert
    this kind of ps(from secure pdf) to pdf.
    3) Can we provide password to distiller during process of conversion to
    pdf.
    4) If above methods do not work then is there a way we can
    programatically use Distiller Api's for conversion of postscript (in case
    of postscript created from secure pdf) to pdf
    Like methods 'FileToPdf' etc.
    Thanks in advance.

    I am facing a similar problem.
    My workflow dictates that I convert the input PDF job initially to PS and finally back to PDF. If the input PDF file is secure (it's not encrypted - you will still be able to open the document), the redistillation of PS to PDF fails while using Normalizer 6.0 && 9.0 libraries. If I use Normalizer 505 library, the redistillation succeeds. I have checked with the same generated PS on both Distiller 6.0 && 9.0, and both the versions fail to reconvert as well. I am a little surprised that 6.0 and 9.0 will fail to do something that 505 library manages.
    Any suggestions?

  • Cannot copy text from DRM-free PDF on PC

    I can on my Mac. Both use Adobe Reader v11.x. I think the behaviour started when I updated to version 11 on the PC.
    I cannot copy text from DRM-free PDFs that I read. I can switch to the Select Tool cursor but drag-select does not work as it did before. Double-click can highlight (and copy) a word. A triple-click can do so for a line. This is clumsy and inefficient and I cannot grab more than a line of text.
    File > Properties: Security shows 'No Security'. I am stumped. Is there some detail I am missing? (I downloaded and switched to FoxIt Reader to take notes now but prefer my knowledge of navigation shortcuts in Adobe Reader.)

    Hi jroth,
    How are you "re-printing" the PDF? Once you have a PDF file, it shouldn't be necessary to re-create it just because you've made changes. You could simply save the file at that point. But it sounds like you're concerned about preventing changes to the comments. If that's the case, rather than reprinting, you could assign some document permissions to the PDF to prevent people from changing the content. To assign that security, choose File > Properties and click the Security tab.
    I'm guessing here, because I'm not sure what process you're using, but it sounds as though that second iteration is being printed as an image. That would change the searchable text to an image, and could certainly cause the issue you're encountering.
    Best,
    Sara

  • How do I delete some pages from an existing pdf file?

    I have an existing pdf file that is too large to send to some people. How can I delete some pages from this existing pdf file, and break it up into two files?

    Acrobat
    You can download a 30 day trial at that link.
    You may also be able to do it with CreatePDF, but I'm not sure.

  • Reading text from server socket stream

    I have a basic cd input program i've been trying to figure out the following problem for a while now, the user enters the artist and title etc and then a DOM (XML) file is created in memory this is then sent to the server. The server then echos back the results which is later printed on a html page by reading the replys from the server line by line.
    The server must be run it listens for clients connecting the clients connect and send DOM documents through the following jsp code.
    <%@page import="java.io.*"%>
    <%@page import="java.net.*"%>
    <%@page import="javax.xml.parsers.*"%>
    <%@page import="org.w3c.dom.*"%>
    <%@page import="org.apache.xml.serialize.*"%>
    <%!
       public static final String serverHost = "cdserver";
       public static final int serverPort = 10151;
    %>
    <hr />
    <pre>
    <%
            Socket mySocket = null;          // socket object
            PrintWriter sockOut = null;      // to send data to the socket
            BufferedReader sockIn = null;    // to receive data from the socket
            try {
                //  #1 add line that creates a client socket
                mySocket = new Socket(serverHost, serverPort);
                // #2 add lines that create input and output streams
                //            attached to the socket you just created
                 sockOut = new PrintWriter(mySocket.getOutputStream(), true);
                 sockIn = new BufferedReader(new InputStreamReader(mySocket.getInputStream()));
            } catch (UnknownHostException e) {
                throw e; // This time the JSP can handle the exception, not us
            } catch (IOException e) {
                throw e; // This time the JSP can handle the exception, not us
    String cdTitle, cdArtist, track1Title, track1Time, track1Rating;
    // Retrieve the HTML form field values
    cdTitle = request.getParameter("cdtitle");
    cdArtist = request.getParameter("cdartist");
    track1Title = request.getParameter("track1title");
    track1Time = request.getParameter("track1time");
    track1Rating = request.getParameter("track1rating");
    // Create a new DOM factory, and from that a new DOM builder object
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    // Note that we are creating a new (empty) document
    Document document = builder.newDocument();
    // The root element of our document wil be <cd>
    // It gets stored as the child node of the whole document (it is the root)
    Element rootElement = document.createElement("cd");
    document.appendChild(rootElement);
    // Create an element for the CD title called <title>
    Element cdTitleElement = document.createElement("title");
    // Add a text code under the <title> element with the value that
    // the user entered into the title field of the web form (cdTitle)
    cdTitleElement.appendChild(document.createTextNode(cdTitle));
    // Place the <title> element underneath the <cd> element in the tree
    rootElement.appendChild(cdTitleElement);
    // Create an <artist> element with the form data, place underneath <cd>
    Element cdArtistElement = document.createElement("artist");
    cdArtistElement.appendChild(document.createTextNode(cdArtist));
    rootElement.appendChild(cdArtistElement);
    // Create a <tracklist> element and place it underneath <cd> in the tree
    // Note that it has no text node associated with it (it not a leaf node)
    Element trackListElement = document.createElement("tracklist");
    rootElement.appendChild(trackListElement);
    // In this example we only have one track, so it is not necessary to
    // use a loop (in fact it is quite silly)
    // But the code below is included to demonstrate how you could loop
    // through and add a set of different tracks one by one if you
    // needed to (although you would need to have the track data already
    // stored in an array or a java.util.Vector or similar
    int numTracks = 1;
    for (int i=0; i<numTracks; i++) {
      String trackNum = Integer.toString(i+1);
      Element trackElement = document.createElement("track");
      trackElement.setAttribute("id", trackNum);
      trackListElement.appendChild(trackElement);
      // Track title element called <title>, placed underneath <track>
      Element trackTitleElement = document.createElement("title");
      trackTitleElement.appendChild(document.createTextNode(track1Title));
      trackElement.appendChild(trackTitleElement);
      // Track time element called <time>, placed underneath <track>
      Element trackTimeElement = document.createElement("time");
      trackTimeElement.appendChild(document.createTextNode(track1Time));
      trackElement.appendChild(trackTimeElement);
      // Track rating element called <rating>, placed underneath <track>
      Element trackRatingElement = document.createElement("rating");
      trackRatingElement.appendChild(document.createTextNode(track1Rating));
      trackElement.appendChild(trackRatingElement);
    OutputFormat format = new OutputFormat();
    format.setIndenting(true);
    // Create a new XMLSerializer that will be used to write out the XML
    // This time we will serialize it to the socket
    // #3 change this line so that it serializes to the socket,
    // not to the "out" object
    XMLSerializer serializer = new XMLSerializer(writer, format);
    serializer.serialize(document);
            // Print out a message to indicate the end of the data, and
            // flush the stream so all the data gets sent now
            sockOut.println("<!--QUIT-->");
            sockOut.flush();
            BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
            String fromServer;
            String fromUser;
             #4 add a while loop that reads text from the
            server socket input stream, line by line, and prints
            it out to the web page, using out.println(...);
            Note that because the reply from the server will contain
            XML, you will need to call upon the toHTMLString() method
            defined below to escape the < and > symbols so that they
            will display correctly in the web browser.
            Also note that as you receive the reply back from the
            server, you should look out for the special <!--QUIT-->
            string that will indicate when there is no more data
            to receive.
            while ((fromServer = sockIn.readLine()) != null) {
            out.println(sockIn.readLine());
                // If the reply from the server said "QUIT", exit from the
                // while loop by using a break statement.
                if (fromServer.equals("QUIT")) {
                    out.println("Connection closed - good bye ...");
                // Print the text from the server out to the user's screen
                out.println("Reply from Server: " + fromServer);
                // Now read a line of text from the keyboard (typed by user)
                fromUser = stdIn.readLine();
                // If it wasn't null, print it out to the screen, and also
                // print a copy of it out to the socket
                if (fromUser != null) {
                    out.println("Client: " + fromUser);
                    sockOut.println(fromUser);
            // Close all the streams we have open, and then close the socket
            sockOut.close();
            sockIn.close();
            mySocket.close();
    %>
    I'm suppose to modify the commented sections labled with #.
    #1,2 are correct but i have doubts on the 3rd and 4th modification.
    for #3 i changed so i serializes to the socket not to the "out" object:
    from
    XMLSerializer serializer = new XMLSerializer(out, format);
    to
    XMLSerializer serializer = new XMLSerializer(writer, format);
    with "out" it prints out some of the results entered but it just hangs i'm thinking it might be the while loop that i added in #4. If i changed it to serialize the socket XMLSerializer serializer = new XMLSerializer(writer, format); it doesn't print out nothing at all; just a blank screen where it hangs.
    I can post the rest of the code (server thats in java and cdinput.html) but since i want to keep my post short and if required i'll post it later on i also omitted some of the code where it creates the DOM textnodes etc to keep my post short.

    On your previous thread, why did you say the server was using http POST and application/xml content type when it quite obviously isn't, but a direct socket communication that abuses XML comments for message end delimiters?
    The comments imply you need to wait for "<!--QUIT-->" on a line by itself, but your loop is waiting for "QUIT".
    Pete

  • How to read the and Write the PDF file give me the solution

    Hi all,
    How to read the and Write the PDF file give me the solution
    My coding is
    import java.io.File;
    import com.asprise.util.pdf.PDFImageWriter;
    import com.asprise.util.pdf.PDFReader;
    import java.io.*;
    import java.io.FileOutputStream;
    public class example {
    // public example() {
         public static void main(String a[])
              try
              PDFReader reader = new PDFReader(new File("C:\\AsprisePDF-DevGuide.pdf"));
                   reader.open(); // open the file.
                   int pages = reader.getNumberOfPages();
                   for(int i=0; i < pages; i++) {
                   String text = reader.extractTextFromPage(i);
                   System.out.println("Page " + i + ": " + text);
    // perform other operations on pages.
    PDFImageWriter writer = new PDFImageWriter(new FileOutputStream("c:\\new11.pdf"));
                   writer.open();
                   writer.addImage("C:\\sam.doc");
                   writer.close();
                   System.out.println("DONE.");
    reader.close();
              catch(Exception e){System.out.println("error:"+e);
              e.printStackTrace();
    I get the pdf content then it returns the string value but ther is no option to write the string to PDF, and we only add a image file to PDF,but i want to know how to wrote the string value to PDF file,
    Please give response immtly
    i am waiting for your reply.
    thanks,
    Suresh.G

    I have some question flow
    How library to use this code.
    I try runing but have not libary.
    Please send me it'library
    Thank you very much!

Maybe you are looking for

  • Do I need a new printer?

    I have a Deskjet 812C connected to my 24" iMac. When I try to print out a text document with Word or Appleworks, the font is wrong; it's elongated and gets cut off by the next line of text. If I print out a picture, I get a few pages of jibberish bef

  • Message type MBGMCR: posting of GR for a text po

    Hi Goods issues are posted by using this message type MBGMCR in R/3 system. Idocs are coming from SRM system. We are getting an error message for an idoc of this message type MBGMCR : "No stock posting possible for this material, The material belongs

  • I recently started getting a "not delivered" message in imessages. Any suggestion what the problem might be?

    I recentlt started getting a "not delivered" message in imessage!  Any suggestions what may cause this? rtrruss

  • How to make a title of region as a link to another page?

    Hi there, I need to hyperlink a region title, so when I click in the title I will go to another page in the app without login agian, In other words keep the same session. Thanks, abdul Edited by: dtabed on May 12, 2009 1:40 PM

  • Logic 4 fil

    I read in a post here that Logic 8 won't open Logic 4 files. Can someone let me know which prior versions will? 7, I hope? Thanks in advance! SB