Announcement

Collapse
No announcement yet.

Convert RTF to PDF - REALLY

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert RTF to PDF - REALLY

    I have read numerous short threads with "is it possible" or "I would try this" - but no-one has said -- Here is how you convert an HL7 message that contains RTF encoded data in OBX 5 and deliver a PDF in the message to its destination.

    Please respond with either instructions or a location to find instructions - if you have "first hand knowledge"

    Have both Mirth 2.3.1 and Mirth 3.2.0 in Linux environment.

    Thanks

  • #2
    You can use FileUtil to convert the RTF to plain text. Then use a Document Writer to create a PDF from said text, and store it as an attachment. Then in a subsequent destination, include the attachment token created by the Document Writer in OBX.5 or wherever you need it. Should be fairly simple to do.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      Now I didn't found a way that can convert RTF to PDF directly.
      But it also can be achieved in other way.
      Firstly, you have to convert RTF to text. Then copy it to a Word file, and last, it's easy to convert a Word to PDF with a PDF converter.

      Comment


      • #4
        Originally posted by eastken View Post
        Now I didn't found a way that can convert RTF to PDF directly.
        But it also can be achieved in other way.
        Firstly, you have to convert RTF to text. Then copy it to a Word file, and last, it's easy to convert a Word to PDF with a PDF converter.
        You can use the libreOffice command line interface to do this. By the way, you can use JOD Converter to manage the conversion process.

        Comment


        • #5
          Problem while converting RTF to Text

          I have used the source code of RTFEditorKit to convert RTF to Plane text as shown below:

          FileInputStream stream = new FileInputStream(args[0]);

          RTFEditorKit kit = new RTFEditorKit();
          Document doc = kit.createDefaultDocument();
          kit.read(stream, doc, 0);

          String plainText = doc.getText(0, doc.getLength());
          System.out.println("text" + plainText);


          **** But in RTF document, i have faced an issue as unable to parse the TRID assigned in the body content. I am unable to fetch and place the content on specific TRID location.

          **** I have created fetching in java using RTFEditorKit.

          Comment

          Working...
          X