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

  • SEARCH
  • Home
  • 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 8337461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:18:43+00:00 2026-06-09T04:18:43+00:00

I am looking for a fast and efficient way to create pdf from my

  • 0

I am looking for a fast and efficient way to create pdf from my website. The pdf will have images along with some text that I can pass as an html. The pdf could simply be a printed format of the html I pass. Something that is similar to what CutePDF does. Is it possible? How? Please share your thoughts.

  • 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-06-09T04:18:44+00:00Added an answer on June 9, 2026 at 4:18 am

    Really its possible just one week before i did it. I was used java, servlet and jsp to did the same.

    Steps :

    1. Read the html file and have it in string.
    2. Use ITextRenderer for converting html to pdf
    3. set render document from string using setDocumentFromString()
    4. Then create pdf using createPDF() method
      • you can store pdf in specified path or output stream, i have used output stream

    Sample Code :

    Visit http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html
    protected void doProcess(HttpServletRequest request,
            HttpServletResponse response){
        response.setContentType("application/pdf;");
        response.setHeader("Content-Disposition", "attachment; filename=Filenametodownload.pdf");       
        String reportContent = "<html><body><b>This is sample HTML</b></body></html>";
        ServletOutputStream sos =null;
        try {
            sos = response.getOutputStream();
        } catch (IOException e1) {          
            e1.printStackTrace();
        }
        String st = System.getProperty("user.dir");
        // ITextRenderer is only works fine with compailed version of core-renderer.jar 
        //Jar available in http://wo-repository.doit.com.br/content/repositories/thirdparty/org/xhtmlrenderer/core-renderer/R8-final/
        ITextRenderer renderer = new ITextRenderer();   
        //System.out.println(reportContent);
        renderer.setDocumentFromString(reportContent);
        renderer.layout();
        try {
            renderer.createPDF(sos);
        } catch (DocumentException e) {         
            e.printStackTrace();
        }
    
        try {       
            sos.close();
            session.removeAttribute("ReportContent");
        } catch (IOException e) {           
            e.printStackTrace();
        }
    }
    

    Note : include itext.jar and core-renderer.jar

    Try this way u can do… All the best…

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

Sidebar

Related Questions

I am looking for a fast and efficient way to calculate the frequency of
I was looking for some fast and efficient method do merge items in array.
From looking at the way some forum softwares are storing data in a database
I am looking for a fast & efficient way to query the Android contacts
I am looking for fast class for to work with text files and comfortable
I've been looking at fast ways to select a random row from a table
I am looking for a fast queue implementation in Java. I see that LinkedList
I'm looking for a fast, clean, pythonic way to divide a list into exactly
I'm looking for a fast way in C# to find all dates in a
I have been looking into different systems for creating a fast cache in a

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.