Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

genarate PDf and save it on server

 
Harshal Gurav
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello All,

In My web application,I am creating pdf files using itext. I need to save it on my server folder on below folder

my allication path is http://SampleApp/PDFstore/test.pdf

When i try to given above path in code for genarating pdf, it is not working

Could you please suggest ?
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to take a look at the API for files, IO etc. You don't create a file by passing a URL string to it.

For your specific requirements, you need to save the file to disk using either a relative or absolute path.
 
Tim Moores
Bartender
Posts: 2735
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use a file:/// URL. Note that a web app has no notion of a default directory, so you need to convert your relative path to an absolute path. The servlet API contains methods that can help you do that in the ServletContext interface.
 
Harshal Gurav
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks James and Time,

Tim, Could you please more elaborate your help
The servlet API contains methods that can help you do that in the ServletContext interface.
 
Tim Moores
Bartender
Posts: 2735
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the ServletContext javadocs? Which method may I have had in mind?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic