Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1027525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:15:10+00:00 2026-05-16T12:15:10+00:00

We are building an application which partially interacts with other system. We are pulling

  • 0

We are building an application which partially interacts with other system. We are pulling some data from the other system which is returned as RTF document. But we have to prevent users from editing this file, so we thought about converting it with iText into PDF. Code snippet:

        // moving the rtf data into input stream to be used in RTF parser
        ByteArrayInputStream rtfInputStream = new ByteArrayInputStream(rtfStream.toByteArray());

        // set headers
        resp.setHeader("Cache-Control", "no-store");
        resp.addHeader("Content-Type", "application/pdf");
        resp.addHeader("Content-Disposition", "inline; filename=Karta.pdf");
        resp.setStatus(HttpServletResponse.SC_OK);


        // pdf output stream
        ByteArrayOutputStream pdfStream = new ByteArrayOutputStream();

        Document pdfDoc = new Document();

        PdfWriter pdfWriter = PdfWriter.getInstance(pdfDoc, pdfStream);

        pdfDoc.open();

        RtfParser rtfParser = new RtfParser(null);

        rtfParser.convertRtfDocument(rtfInputStream, pdfDoc);
        pdfDoc.close();

        pdfWriter.close();

        resp.getOutputStream().write(pdfStream.toByteArray());

        rtfInputStream.close();
        pdfStream.close();
        is.close();

Pdf is created but font sizes are wrong, styling is wrong and encoding is wrong. Maybe You had similar problems and You worked something out? Maybe there are better solutions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:15:10+00:00Added an answer on May 16, 2026 at 12:15 pm

    Itext is abandoning RTF according to this post.
    One good solution I have used is JODCoverter Library. It leverages OpenOffice and I was able to convert several thousand RTF documents to PDF in the past.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 515k
  • Answers 515k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Go to Project Properties and select an icon. May 16, 2026 at 6:28 pm
  • Editorial Team
    Editorial Team added an answer You call to .animate() is a bit off, the options… May 16, 2026 at 6:28 pm
  • Editorial Team
    Editorial Team added an answer Your IDE has probably generated a sample web.xml file, which… May 16, 2026 at 6:28 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm building an application which needs to filter some mouse clicks system-wide. That is,
I am now building an application which should store and handle large amounts of
I'm building a J2EE application in which I want to allows plugins. I'm fairly
I am building a PHP comet based application. Which web server should I use
In the course of building a rails application to help small hotels' manage bookings,
I have a mindmp file from a target's application crash. Is it possible for
I have a WPF UserControl. The code behind file declares some RoutedUICommand objects which
I am building a MVC 2 application with SubSonic 3 - I have tried
I am building an application having to do with game achievements, and I want
I'm building an application using OpenJPA 2.0.0, Jersey 1.3, and JUnit 4.8.1. I've set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.