RTF to TXT conversion

Guys,
Does anyone know of a java class(es) that converts RTF files to TXT files?

Again.
Does anybody know of an RTF parser or RTF to TXT converter, written in java, that won't load the whole rtf file in memory before pasrsing it?
If I use RTFEditorKit, I'll have to load the whole file, which I do not want to do for big files.
I just wanna load portions and search them for occurences of certain words.
Any Help?

Similar Messages

  • RTF to HTML conversion - Non-English Text

    Hello,
    I am trying to convert a RTF file to a HTML file. Below is the code that I am using. I am not able to convert non-english text properly (German, French, Swedish etc). I like to know the proper way of doing this and if there is a more efficient way of doing this conversion in general (It is taking around 1 minute for this to complete on a 300 MHz, 320 MB iBook). Thanks.
    Regards
    Sarat
    Code Begins
    public class FormatConverter {
    private DefaultStyledDocument tempRTFDoc;
    private HTMLEditorKit htmlKit;
    private RTFEditorKit rtfKit;
    public FormatConverter () {
    tempRTFDoc = new DefaultStyledDocument();
    htmlKit = new HTMLEditorKit();
    rtfKit = new RTFEditorKit();
    public String convert(String strText) {
    String strResult = "";
    StringReader reader = new StringReader(strText);
    try {
    tempRTFDoc.remove(0,tempRTFDoc.getLength());
    rtfKit.read(reader,tempRTFDoc,0);
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    htmlKit.write(byteArrayOutputStream,tempRTFDoc,0,tempRTFDoc.getLength());
    strResult = byteArrayOutputStream.toString();
    catch(IOException ie){}
    catch(BadLocationException ble){}
    return strResult;
    public static void main(String args[]) {
    // Read the rtf file from disk
    FileInputStream in = null;
    try {
    in = new FileInputStream("sample.rtf");
    } catch (java.io.FileNotFoundException ioe) {
    System.out.println("sample.rtf file not found");
    byte []input = new byte[10000];
    try {
    in.read(input);
    } catch (java.io.IOException ioe) {
    System.out.println("Error reading from sample.rtf");
    // Do the conversion
    FormatConverter conv = new FormatConverter();
    String strHTML = conv.convert(new String(input));
    // Write the html file to disk
    FileWriter out = null;
    try {
    out = new FileWriter("output.html");
    } catch (java.io.IOException ioe) {
    System.out.println("Error creating file output.html");
    try {
    for (int i = 0; i < strHTML.length(); i++)
    out.write(strHTML.charAt(i));
    } catch (java.io.IOException ioe) {
    System.out.println("Error writing to file output.html");
    // Close the files
    try {
    if(in != null)
    in.close();
    if(out != null)
    out.close();
    } catch (java.io.IOException ioe) {
    System.out.println("Error closing files");
    System.out.println("Conversion done");
    System.exit(0);
    Code Ends

    hi,
    i'm also trying to do the same thing (convert rtf to html). i was wondering if your conversion handles tables and if so if you could post the code as i'm having trouble finding out info about rtf's.
    in terms of stripting out the body tags there are a number of different ways of doing this, here's one way>
    myBigHtmlString = your html doc loaded in to a string;
    String[] tagsToStripOutArray = {"<html>","</html>","<body>", "</body>", "etc", "etc"};
    int pos=0;
    for (int x=0; tagsToStripOutArray.length; x++) {
    pos = myBigHtmlString.indexOf(tagsToStripOutArray[x]);
    if (pos != -1){ // if tag exists in string strip it out
    myBigHtmlString = myBigHtmlString.substring(0,pos)+myBigHtmlString.substring(pos+(tagsToStripOutArray[x].length());
    }// end for
    i haven't compiled this so there maybe errors,
    cheers,
    ben

  • .wave to .txt conversion

    I need a squential representation of the ampiltudes of a sound file( .wav of course) at the frequency at which is was recorded(44,100hz). If I am not mistaken the advantage of the wave format is that it is just that a list of integers corresponding to the ampiltude of the sound file at the recording frequency. So my job is read the array of bytes in the sound file and write them to a .txt file so that I can run other programs which I have already gotten.
    I am currently trying to work with the Javax.sound.sampled API.
    My code sorta goes like this:
    public class analyse
    public analyse()
    AudioInputStream stream = AudioSystem.getAudioInputStream(new File("audiofile"));
    DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize()));
    Clip clip = (Clip) AudioSystem.getLine(info);
    WriteArray();
    readArray();
    line.drain().stop();
    public writeArray() {
    int numRead = 0;
    byte[] buf = new byte[line.getBufferSize()];
    while ((numRead = stream.read(buf, 0, buf.length)) >= 0) {
    int offset = 0;
    while (offset < numRead) {
    offset += line.write(buf, offset, numRead-offset);
    That was just the bare bones. However, I've also come across this code while looking thru the API
    AudioInputStream stream = AudioSystem.getAudioInputStream(new File("audiofile"));
    stream.read(byte[] b, int 0, int stream.frameLength()*stream.frameSize());
    this I actually understand better, but I cannot get either to work.
    If anyone could help me with this, I would sorely appreciate it.

    Again.
    Does anybody know of an RTF parser or RTF to TXT converter, written in java, that won't load the whole rtf file in memory before pasrsing it?
    If I use RTFEditorKit, I'll have to load the whole file, which I do not want to do for big files.
    I just wanna load portions and search them for occurences of certain words.
    Any Help?

  • XML-2-TXT conversion

    All,
    We have a small, annoying problem with xml-2-text conversion.  During the conversion, the "&amp;: in the XML file is not translated to "&" (ampersand).
    We encounter this issue with the xml-2-txt convertor of the file adapter of the standalone J2SE adapter.
    Anyone having a simple workaround for this small but annoying issue?
    Kind regards, Guy Crets

    I have not used the J2Se adapter, however I wrote a java mapping program that converts XML2TXT, it is highly experimental. You may use it as the last mapping in the mapping program "chain". The XSLT is at the end.
    I have tested this with
    XML -> fileadapter -> SAP XI javamapping -> http adapter -> MS IIS.
    Good luck /Otto
    Created on 2005-dec-05
    To change the template for this generated file go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    @author 01ottfro Otto Frost Capgemini
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import java.util.HashMap;
    import com.sap.aii.mapping.api. AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    //import java.io.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    //import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    //import java.io.File;
    import java.io.IOException;
    import java.io.ByteArrayInputStream;
    //import java.io.ByteArrayOutputStream;
    import java.io.StringReader;
    //import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.UnsupportedEncodingException;
    import org.w3c.dom.Document;
    //import org.w3c.dom.DOMException;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    //import javax.xml.parsers.*;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.NamedNodeMap;
    public class XML2TEXT implements StreamTransformation {
      private Map           param = null;
      private AbstractTrace  trace = null;
      private StringBuffer sbTrace = new StringBuffer();
      public void setParameter (Map param) {
        this.param = param;
        //if (param == zero) {
        if ((param == null)) {
               this.param = new HashMap();
      public void execute(InputStream in, OutputStream out) {
        try {
          //javax.xml.parsers.DocumentBuilderFactory = "";
           trace = (AbstractTrace)param.get(
             StreamTransformationConstants.MAPPING_TRACE);
           trace.addInfo("Start");
           trace.addInfo(System.getProperty("javax.xml.parsers.DocumentBuilderFactory "));
           InputStreamReader isr = new InputStreamReader(in,"UTF-8");
           in.reset();
           StringBuffer sb2 = new StringBuffer();
           char c;
           int i = isr.read();
           while (i != -1) {
                c = (char) i;
              sb2.append(c);
              i = isr.read();
           String ss = new String(sb2);
           trace.addInfo(ss);
           in.reset();
           String receiverName = (String)param.get(
             StreamTransformationConstants.RECEIVER_NAME);
           //static Document document;
           Document document;
           StringBuffer sb = new StringBuffer();
           StringBuffer sbTrace = new StringBuffer();
           sb.append("");
           sb.append("<?xml version=\"1.0\"?>");
           sb.append("<DOC>");
    //          sb.append("<greeter>An XSLT Programmer</greeter>");
    //          sb.append("<greeting>Hello, World!</greeting>");
           sb.append("<TEXT>x_content_x</TEXT>");
           sb.append("</DOC>");
           //String s = sb.ToString();
           StringReader sr = new StringReader(sb.toString());
           DocumentBuilderFactory dbf = new DocumentBuilderFactory();
           dbf.setCoalescing(true);
           dbf.setExpandEntityReferences(true);
           dbf.setIgnoringComments(true);
           dbf.setIgnoringElementContentWhitespace(false);
           dbf.setNamespaceAware(true);
           dbf.setValidating(true);
           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
           factory.setCoalescing(true);
           factory.setExpandEntityReferences(true);
           factory.setIgnoringComments(true);
           factory.setIgnoringElementContentWhitespace(false);
           factory.setNamespaceAware(true);
           factory.setValidating(false);
           try {
              DocumentBuilder builder = factory.newDocumentBuilder();
             builder.setErrorHandler(
               new org.xml.sax.ErrorHandler() {  // ignore fatal errors (an  exception is guaranteed)
                 public void fatalError(SAXParseException exception)
                 throws SAXException {
                 // treat validation errors as fatal
                 public void error(SAXParseException e)
                 throws SAXParseException {
                   throw e;
                 // dump warnings too
                 public void warning(SAXParseException err)
                 throws SAXParseException {
                   System.out.println("** Warning"
                      + ", line " + err.getLineNumber()
                      + ", uri " + err.getSystemId());
                        trace.addInfo("** Warning"
                        + ", line " + err.getLineNumber()
                        + ", uri " + err.getSystemId());  
                   System.out.println("   " + err.getMessage());
                     trace.addInfo("   " + err.getMessage());
              //document = builder.parse( new File(args[0]) );
              ByteArrayInputStream bais = new
              ByteArrayInputStream(sb.toString().getBytes("UTF-8"));
                //System.out.println (bais.toString());
              //document = builder.parse(bais);
              document = builder.parse(in);
              Element documentRootElement = document.getDocumentElement();
              trace.addInfo("root" + documentRootElement.getNodeValue());
              trace.addInfo("root" + Short.toString(documentRootElement.getNodeType()));
              trace.addInfo("root" + documentRootElement.getNodeName());
    //          Element textElement = (Element) documentRootElement.getFirstChild();
              NodeList nodeList = documentRootElement.getElementsByTagName("TEXT");
            StringBuffer sbText = new StringBuffer();
              for(i = 0; i<nodeList.getLength() ;i++) {
                   Element textElement = (Element) nodeList.item(i);
                   Node text = textElement.getFirstChild();
                   sbText.append(text.getNodeValue());
              nodeList = documentRootElement.getElementsByTagName("CHARSETNAME");
              StringBuffer sbCharset = new StringBuffer();
              for(i = 0; i<nodeList.getLength() ;i++) {
                   Element textElement = (Element) nodeList.item(i);
                   Node text = textElement.getFirstChild();
                   sbCharset.append(text.getNodeValue());
    //          System.out.println(textElement.getNodeValue());
    //          System.out.println(textElement.getNodeType());
    //          System.out.println(textElement.getNodeName());
              trace.addInfo("te" + textElement.getNodeValue());
              short nodeType = textElement.getNodeType();
              trace.addInfo("te" + Short.toString(nodeType));
              trace.addInfo("te" + textElement.getNodeName());
              Node textNode = textElement.getFirstChild();
              Node mt_textdocument = document.getFirstChild();
              Node text = mt_textdocument.getFirstChild();
              Node hashtext = text.getFirstChild();
              textNode = hashtext;
              String s = new String();
              if (textNode != null) {          
                   trace.addInfo(textNode.getNodeValue());
                   trace.addInfo(Short.toString(textNode.getNodeType()));
                   trace.addInfo(textNode.getNodeName());
                  s = new String(textNode.getNodeValue());
              else {
                   s = "ERROR";
                   trace.addInfo(s);
    //          traverse1(document);
    //          trace.addInfo(sbTrace.toString());
    //          OutputStream baos = new ByteArrayOutputStream();
            String s = sbText.toString();
            String charset = sbCharset.toString();
              byte[] bytes = s.getBytes(charset);
    //          baos.write(bytes,0,bytes.length);
            out.write(bytes,0,bytes.length);
           } catch (SAXException sxe) {
               // Error generated during parsing
               Exception  x = sxe;
               if (sxe.getException() != null)
                    x = sxe.getException();
               x.printStackTrace();
           } catch (ParserConfigurationException pce) {
               // Parser with specified options can't be built
               pce.printStackTrace();
           } catch (IOException ioe) {
               // I/O error
               ioe.printStackTrace();
         catch (UnsupportedEncodingException uee) {
              trace.addInfo("UnsupportedEncodingException");
        catch (IOException ioe) {
          // I/O error
          //  ioe.printStackTrace();
           trace.addInfo("IOException");
        finally {
              trace.addInfo("finally");
      public void traverse1(Node node) {
           do {
               System.out.println("Node: name=" + node.getNodeName() +
               ", value=" + node.getNodeValue() + ", type=" +
               node.getNodeType());
               sbTrace.append("Node: name=" + node.getNodeName() +
              ", value=" + node.getNodeValue() + ", type=" +
              node.getNodeType() + "\n");
              trace.addInfo("Node: name=" + node.getNodeName() +
              ", value=" + node.getNodeValue() + ", type=" +
              node.getNodeType() + "\n");
               if (node.getFirstChild() != null) {
                System.out.println("Processing children:");
                sbTrace.append("Processing children:"+"\n");
                trace.addInfo("Processing children:"+"\n");
                traverse1(node.getFirstChild());
           }  while ((node = node.getNextSibling()) != null);
         public void traverse2(Node node) {
              //Get the children of this Node
                NodeList children = node.getChildNodes();
                //go through all the children of the node
                for (int i=0; i<children.getLength(); i++) {
                    //get the next child
                    Node child = children.item(i);
                    //get the type of the child
                    short childType = child.getNodeType();
                    if (childType == Node.ELEMENT_NODE) {
                   //if the child is an Element then print the start and end
                   //tags and recurse the content       
                   String nodeName = child.getNodeName();
                   System.out.print("<" + nodeName + ">");
                   sbTrace.append("<" + nodeName + ">");
                   trace.addInfo("<" + nodeName + ">");
                   traverse2(child);
                   System.out.print("</" + nodeName + ">");
                   sbTrace.append("</" + nodeName + ">");
                   trace.addInfo("</" + nodeName + ">");
                } else if (childType == Node.TEXT_NODE) {
                   //if the child is a Text node just print the text content
                   String data = child.getNodeValue();
                   System.out.print(data);
                   sbTrace.append(data);
                   trace.addInfo(data);
         public void traverse3(Node node, int indent) {
              for (int i = 0; i < indent; i++) {
                System.out.print("   ");
                sbTrace.append("   ");
                trace.addInfo("   ");
              int type = node.getNodeType();
              switch (type) {
              case Node.ATTRIBUTE_NODE:
                System.out.println("ATTRIBUTE_NODE");
                sbTrace.append("ATTRIBUTE_NODE"+"\n");
                trace.addInfo("ATTRIBUTE_NODE"+"\n");
                break;
              case Node.CDATA_SECTION_NODE:
                System.out.println("CDATA_SECTION_NODE");
                sbTrace.append("CDATA_SECTION_NODE"+"\n");
                trace.addInfo("CDATA_SECTION_NODE"+"\n");
                break;
              case Node.COMMENT_NODE:
                System.out.println("COMMENT_NODE");
                sbTrace.append("COMMENT_NODE"+"\n");
                trace.addInfo("COMMENT_NODE"+"\n");
                break;
              case Node.DOCUMENT_FRAGMENT_NODE:
                System.out.println("DOCUMENT_FRAGMENT_NODE");
                sbTrace.append("DOCUMENT_FRAGMENT_NODE"+"\n");
                trace.addInfo("DOCUMENT_FRAGMENT_NODE"+"\n");
                break;
              case Node.DOCUMENT_NODE:
                System.out.println("DOCUMENT_NODE");
                sbTrace.append("DOCUMENT_NODE"+"\n");
                trace.addInfo("DOCUMENT_NODE"+"\n");
                break;
              case Node.DOCUMENT_TYPE_NODE:
                System.out.println("DOCUMENT_TYPE_NODE");
                sbTrace.append("DOCUMENT_TYPE_NODE"+"\n");
                trace.addInfo("DOCUMENT_TYPE_NODE"+"\n");
                break;
              case Node.ELEMENT_NODE:
                System.out.println("ELEMENT_NODE");
                sbTrace.append("ELEMENT_NODE"+"\n");
                trace.addInfo("ELEMENT_NODE"+"\n");
                NamedNodeMap atts = node.getAttributes();
                for (int i = 0; i < atts.getLength(); i++) {
                   Node att = atts.item(i);
                   traverse3(att, indent + 1);
                break;
              case Node.ENTITY_NODE:
                System.out.println("ENTITY_NODE");
                sbTrace.append("ENTITY_NODE"+"\n");
                trace.addInfo("ENTITY_NODE"+"\n");
                break;
              case Node.ENTITY_REFERENCE_NODE:
                System.out.println("ENTITY_REFERENCE_NODE");
                sbTrace.append("ENTITY_REFERENCE_NODE"+"\n");
                trace.addInfo("ENTITY_REFERENCE_NODE"+"\n");
                break;
              case Node.NOTATION_NODE:
                System.out.println("NOTATION_NODE");
                sbTrace.append("NOTATION_NODE"+"\n");
                trace.addInfo("NOTATION_NODE"+"\n");
                break;
              case Node.PROCESSING_INSTRUCTION_NODE:
                System.out.println("PROCESSING_INSTRUCTION_NODE");
                sbTrace.append("PROCESSING_INSTRUCTION_NODE"+"\n");
                trace.addInfo("PROCESSING_INSTRUCTION_NODE"+"\n");
                break;
              case Node.TEXT_NODE:
                System.out.println("TEXT");
                sbTrace.append("TEXT"+"\n");
                trace.addInfo("TEXT"+"\n");
                break;
              default:
                System.out.println("???");
                sbTrace.append("???"+"\n");
                trace.addInfo("???"+"\n");
                break;
              for (Node c = node.getFirstChild(); c != null; c =
              c.getNextSibling()) {
                traverse3(c, indent + 1);
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:trema-com:trema:trema" targetNamespace="urn:trema-com:trema:trema">
         <xsd:element name="MT_TEXTDOCUMENT" type="DT_TEXTDOCUMENT" />
         <xsd:complexType name="DT_TEXTDOCUMENT">
              <xsd:annotation>
                   <xsd:appinfo source="http://sap.com/xi/TextID">
                   70d8cec1675c11da822400132107c3b7
                   </xsd:appinfo>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="TEXT" type="xsd:string">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             cc2dc340659311dab38eeb8f0ace6159
                             </xsd:appinfo>
                        </xsd:annotation>
                   </xsd:element>
                   <xsd:element name="CHARSETNAME" type="xsd:string">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             bf0f424065c211da893ceb8f0ace6159
                             </xsd:appinfo>
                        </xsd:annotation>
                   </xsd:element>
              </xsd:sequence>
         </xsd:complexType>
    </xsd:schema>
    example xml
    <?xml version="1.0" encoding="utf-8"?>
    <MT_TEXTDOCUMENT><TEXT>your text</TEXT><CHARSETNAME>UTF-8</CHARSETNAME></MT_TEXTDOCUMENT>

  • Applescript batch convert .RTF to .TXT with line breaks

    Hey guys, looking for help with an Applescript that can change a .RTF to a .TXT with line breaks.
    I have an Applescript that will go from a .DOC to a plain .TXT but haven't found anything to get from the .RTF to a .TXT wth line breaks.
    I'm doing this for Avid's Script Sync.
    Thanks for the help.

    Ok, you obviously mean something specific by "line breaks" that you're not being clear about.  are you looking for a specific kind of line ending: Mac style carriage return (CR) ending? Windows style carriage return line feed (CR/LF) endings, unix style line feed (LF) endings?  textutil provides LF by default (it's a unix utility after all); if you need a different line ending you'll need to pipe it through tr or modify it via applescript after you've done the conversion

  • RTF to HTML Conversion to include in JSP

    I have an RTF file which I need to display in a JSP page.
    I have converted the file successfully using RTFEditorKit and HTMLEditorKit, and now have a string which is a complete HTML file.
    Unfortunetly I need to show this String in a JSP - this has a title at the top of the page and an exit button at the bottom. I cannot simply print the String as it contains HTML headers and so the page does not display correctly.
    Is there a way to include the HTML string in the jsp successfully?
    I don't want to output the HTML to a file and then include the file or use object or iframe to include the file.
    Is there an easy way perhaps to strip the header tags from the String?
    Or create the HTML string without the header tags at all?
    Thanks

    hi,
    i'm also trying to do the same thing (convert rtf to html). i was wondering if your conversion handles tables and if so if you could post the code as i'm having trouble finding out info about rtf's.
    in terms of stripting out the body tags there are a number of different ways of doing this, here's one way>
    myBigHtmlString = your html doc loaded in to a string;
    String[] tagsToStripOutArray = {"<html>","</html>","<body>", "</body>", "etc", "etc"};
    int pos=0;
    for (int x=0; tagsToStripOutArray.length; x++) {
    pos = myBigHtmlString.indexOf(tagsToStripOutArray[x]);
    if (pos != -1){ // if tag exists in string strip it out
    myBigHtmlString = myBigHtmlString.substring(0,pos)+myBigHtmlString.substring(pos+(tagsToStripOutArray[x].length());
    }// end for
    i haven't compiled this so there maybe errors,
    cheers,
    ben

  • Polish Characters XLS to CSV to TXT conversion issue

    Hi,
    I am trying to convert the XLS file to CSV and then to TXT (UFT8) file but the polish characters are shown as "?" in CSV and TXT file. Any experts help please.
    Thanks,
    Genoo

    Any help please, its quiet urgent.
    Thanks,
    Genoo

  • PDF to TXT Conversion

    I'm using Acrobat Standard 8.1.0.
    I would like to run from Excel VBA a process to convert PDF files into TXT files. The same affect of opening the files in Acrobat and clicking on Save As and changing the filetype to .txt. I've looked through the online SDK and am rather familiar with VBA, etc. I get the following error no matter what syntax I use to try to save the file as anything other than a pdf file. Here's my code and the error:
    Code:
    Dim AcroXApp As Acrobat.AcroApp
    Dim AcroXAVDoc As Acrobat.AcroAVDoc
    Dim AcroXPDDoc As Acrobat.AcroPDDoc
    Dim Filename As String
    Filename = "R:\My Documents\ZBIR006A_8781830 - DRC000004311.pdf"
    Set AcroXApp = CreateObject("AcroExch.App")
    AcroXApp.Show
    Set AcroXAVDoc = CreateObject("AcroExch.AVDoc")
    AcroXAVDoc.Open Filename, "Acrobat"
    Set AcroXPDDoc = AcroXAVDoc.GetPDDoc
    Dim jsObj As Object
    Set jsObj = AcroXPDDoc.GetJSObject
    jsObj.SaveAs "R:\My Documents\pdfTest.txt", "com.adobe.Acrobat.plain-text"
    AcroXAVDoc.Close False
    AcroXApp.Hide
    AcroXApp.Exit
    Error:
    On the jsObj.SaveAs line I get the following error:
    "UnsupportedValueError: Value is unsupported. ===> Parameter cConvID.
    Doc.saveAs:-1:
    I've looked through all of the documentation online and cannot come up with a reason why I'm not able to do this. Please help!!

    I have installed Acrobat 7.0 professional.In VB.NET 2005 i have this code:
    Dim AcroXApp As Acrobat.AcroApp
    Dim AcroXAVDoc As Acrobat.AcroAVDoc
    Dim AcroXPDDoc As Acrobat.AcroPDDoc
    Dim Filename As String
    Filename = "c:\test.pdf"
    AcroXApp = CreateObject("AcroExch.App")
    AcroXApp.Show()
    AcroXAVDoc = CreateObject("AcroExch.AVDoc")
    AcroXAVDoc.Open(Filename, "Acrobat")
    AcroXPDDoc = AcroXAVDoc.GetPDDoc
    Dim jsObj As Object
    jsObj = AcroXPDDoc.GetJSObject
    jsObj.SaveAs("C:\Test.txt", "com.adobe.acrobat.plain-text")
    AcroXAVDoc.Close(False)
    AcroXApp.Hide()
    AcroXApp.Exit()
    Thanks

  • Problem with converting RTF to TXT

    When I convert RTF content to text format with
    JTextPane jtp = new JTextPane();
    jtp.setContentType("text/rtf");
    jtp.setText(original_text);
    Document doc = jtp.getDocument();
    String converted_text = doc.getText(0, doc.getLength());All non-ascii characters are changed to "??????". What should I do about it?

    Does your document follow those rules? I'm not sure if my document follows those rules. My
    document is generated by some other software (like MS
    Word)Okay, then just get an ordinary text editor (WordPad would be okay) and look at the beginning of the file to see just what it looks like.
    And when you read your document into the textcomponent... or into this "original_text" variable...
    are you specifying the file's encoding?
    No, I did not specify the file's encoding. Maybe this
    will solve the problem. But how do I specify the
    encoding? Please kindly advise :)You need a java.io.InputStreamReader to specify the encoding. Check out the API documentation for more information (Java 1.4 uses the term charset instead of encoding, but it's the same concept); your code might look like this:Reader fr = new InputStreamReader(new FileInputStream("zap.rtf"), "yourencoding");

  • CF9 - display .rtf file inline (conversion to something else okay)

    Hello, everyone.
    Just wondering if there is a way to display an .rtf file in a browser?  Every method I've tried, so far, just asks the user to download the .rtf file.
    If I have to convert it to something else (like XML), first, I can do that.  The .rtf file does not reside in the filesystem, it's a binary in a BLOB in an Oracle database.
    Thank you,
    ^_^

    I'll look at the spec, thank you.
    I Googled:
    ColdFusion "convert rtf to xml"
    "convert rtf to xml"
    ColdFusion "display rtf inline"
    ... and a few others that I'm not recalling, right now.  Most of the links I found (99%) were for "FREE SOFTWARE DOWNLOAD", which I can't go anywhere near.
    One of the links was to a forum where someone mentioned what I posted, earlier, about converting to XML, then using some built-in CF XML tag to parse.  Can't find it, now, though.
    ^_^

  • RTF/txt file printing.

    Heya!
    It's been doing my head in trying to figure out how to print JasperReport labels on my Dymo LabelWriter. What i used to do is to export the report to PDF and print it. Issue i had with that is that it ignores font type/family completely. What i noticed is that RTF and txt-files keep the font.
    That threw me out on a journey to figure out how to print those. I've been through countless posts on the web, examples, forum posts, etc. All of them show some weird, useless to me scenarios that i couldn't even modify for my own use.
    What I'm really looking for is this:
    - A way to print .docx, .doc, .rtf or .txt file (physical file on a harddrive) to printer through Java code.
    Is it possible? Perhaps some free libs i didnt notice yet?
    Thanks in advance!

    Now this is "internets" and there is no way to tell the tone, but it just seemed that he went on "for hours" about how dumb i am and how i ignored the content of his post (which i didnt, it just wasnt 100% relevant), while one sentance was enough. Anyway....
    I did get it to print the .txt with BufferedReader (printing RTF was a failure, since it printed all the metadata with it, no surprise there).
    File txtFile = new File("label.txt");
    JRTextExporter txtExporter = new JRTextExporter();
    txtExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    txtExporter.setParameter(JRExporterParameter.OUTPUT_FILE, txtFile);
    txtExporter.setParameter(JRTextExporterParameter.CHARACTER_WIDTH, new Float(6.55));//6.55 //6
    txtExporter.setParameter(JRTextExporterParameter.CHARACTER_HEIGHT, new Float(11.9)); //11//10
    txtExporter.exportReport();
    There is also a JRPdfExporter and JRrtfExporter. PDF worked like a charm, except that it completely ignored the font i set in iReport (when i created the report structure).
    I use BufferedReader with JTextArea to print the contents of my .txt file for now (txtArea.print() ), and it works fine, just needs adjustments on the numbers in the code above. However, i need to nudge the frame a bit in the right direction. At the moment there is like a good 5 cm top and left whitespace to the label itself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Transfer "docx", "rtf", "txt" formats through API(sendDocument method)

    Hello. I tried to send "docx", "rtf" and "txt" files using sendDocument API method but had errors every time. Also there was a try by your soft to convert "rtf" to PDF but with no success and with PDF source code in the final document(the one that a recipient got ). I just wanted to ask if it is possible to send you specified file formats using your API sendDocument method or it is possible only through your website? Thanks )

    Yes, EchoSign supports most of the document file formats via API. If your API call is not going through you must be defining some API parameters wrong.
    Support will need to check your account info to look into the API log and troubleshoot it. You will need to contact the support team to troubleshoot.
    Thanks,
    Jat

  • Opening an RTF in the FInder doesn't start TextEdit

    On the Mac Pro (see sig. for specs.), if I highlight an RTF or TXT file in the Finder and select 'Open' (or double-click the file), the file's folder window moves to the background (as expected), the animated zoom rectangles happen (as expected) but TextEdit doesn't open.
    If I Control-click the file and select 'Open-with...', it shows TextEdit as the default and, if I select it here, it opens the file.
    Once TextEdit is running, 'Open' (and double-click) in the Finder work as they should. But they won't start TextEdit if it's not already running (even though it looks like an application is starting up).
    Any suggestions?
    Thanks in advance,
    Steve = : ^ )

    2 suggestions.
    1.Quit TextEdit Now, have you tried deleting /Users/yourname/Library/Preferences/com.apple.TextEdit.plist Then test.
    2. Clear your LaunchServices caches...
    Launch /Utilities/Terminal and copy & paste this at the command line to rebuild LaunchServices:
    Code:
    <pre class="alt2" style="margin:0px; padding:3px; border:1px inset; width:640px; height:34px; overflow:auto">/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchSe rvices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user</pre>
    Then press return. Wait until terminal returns to the command line. Quit Terminal. After that, log out and back in or restart. Let us know
    -mj

  • TextEdit save as .txt?

    Maybe I'm missing something, but is there any way to have TextEdit save a document as a .txt by default? It's rather annoying to have to rename the extension from .rtf to .txt every time.

    TextEdit->Preferences->New Document->select Plain Text. Works like that in SL and, AFAIK, in Lion.

  • How to save text in txt/xml file?

    Which application can I use to save nonformatted text (or xml) into a txt or xml file? TextEdit seems to apply all sorts of formatting. I can see this when I change the extension from rtf to txt or xml and open the file.

    TextEdit seems to apply all sorts of formatting.
    Not if you will set its preferences to Plain Text instead of Rich Text. Also check the boxes for "ignore rich text commands...."
    Also you can use the free TextWrangler.

Maybe you are looking for

  • 2 Ipods 1 Macbook Itunes account and 1 windows itunes account (same user)

    Ok... I purchased a new Ipod nano for traveling and have it synced to my work laptop. I have a 5th generation Ipod 30g for home and it is synced to the macbook. Both have music downloaded from one account (mine) and I would like to join the 500 some

  • Set sap Component mandatory while creating the support desk message

    Hi,    When create the support desk message from any application sysytem, the sap component get selected automatically but when we create the suppport desk message from the Easy Access the component wiil be blank, so some user create the support mess

  • Reg: Printing multiple lines of line item in a smartform?

    Hi Experts, I have a query regarding printing multliple line items in a smartform. In this form i dont have control on the font size because the client is using some generic type format to print the data in EPSON LQ 590. Here this generic type driver

  • Can I upgrade my Macbook Pro to 16GB RAM

    I am a Graphic Designer and use some very heavy bound software for rendering and running multiple memory munching applications everyday. Lately my macbook pro has been increadibly slow. I have seen allot video on youtube of people upgrading their ram

  • Dreamweaver has added thousands of blank lines to my code

    I installed creative cloud and dreamweaver - I edited a few PHP  / HTML  / javascript  files on my server - now dreamweaver had added thousands of blank lines to my code. It will take days to clean them out and I can't seem to find a "find and replac