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 6145663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:49:40+00:00 2026-05-23T18:49:40+00:00

I am trying to create a PDF file using struts 2.Action class location is

  • 0

I am trying to create a PDF file using struts 2.Action class location is as follows.

/home/Jagan/MATCH/Jagan/src/ActionClasses/PDFFile.java

Here workspace starts from

/MATCH

In PDFFile.java.I am writing as given below and it is working fine.

pdfwriter=PdfWriter.getInstance(document,new
FileOutputStream(“/home/Jagan/xyz.pdf”));

But i have to create this under the folder

/home/Jagan/MATCH/Jagan/PDFs

I should not use /home/Jagan/ as it will become hardcode if i have to run this application in other system.

I tried

pdfwriter=PdfWriter.getInstance(document,new
FileOutputStream(“../../../PDFs/xyz.pdf”));

But it is not creating file.Even if it works it is not feasible solution (because “../../../” does not work in windows ).

Please suggest me a good way to specify path for creating file.


Adding to the question.

I have to provide download option for downloading this created file in JSP page.Which struts tag should i use. Please provide me syntax for that

  • 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-23T18:49:41+00:00Added an answer on May 23, 2026 at 6:49 pm

    downloading files has 2 aproaches:
    1. you can return it with outstream result like is explained here
    2. as you are trying to save the file first at filesystem then access it from another url.
    Answer to your question is you should get servletContext.getRealPath(“/WEB-INF”), and after that everything is relative to WEB-INF.

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

Sidebar

Related Questions

Trying to create a PDF file based on an XML and a file using
I am trying to create a pdf file with iTextSharp. My attempt writes the
I'm trying to digitally sign a PDF file using THIS project as an example.
I'm trying to embed a PDF file into a Word document using the OLE
Using Mac OS X API, I'm trying to save a PDF file with a
when I am trying to create the PDF file I got the following Error?
I'm trying to generate a PDF file using AJAX call in Rails3. The following
I'm trying to write metadata to a pdf file using the following python code:
I am trying to create a pdf document in c# using iTextSharp 5.0.6. I
I am trying to create a PDF file of current view. Can anyone please

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.