• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

related to pdf

 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
currently i am creating a pdf and saving it in resources folder by using following code and then by giving its path i am using it to create digitally signed pdf but i have a problem that is at a same time there may be created more than one pdf so how it is possible to create digitally signed pdf of every pdf
 
Tim Moores
Bartender
Posts: 2675
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to ensure that file names are unique for each client, and do so in a thread-safe way.
 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:You need to ensure that file names are unique for each client, and do so in a thread-safe way.

how we can assign different different file names to different client and how they will be managed ???
 
Tim Moores
Bartender
Posts: 2675
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's up to you - maybe include a unique ID in the file name which indicates the client. Could be the ID of the user record in your database (assuming that's how you manage your users).
 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:That's up to you - maybe include a unique ID in the file name which indicates the client. Could be the ID of the user record in your database (assuming that's how you manage your users).


i am using an unique number no
HttpSession session = req.getSession();
String n = (String)session.getAttribute("no");
res.setContentType("application/pdf");
PdfWriter.getInstance(document, new FileOutputStream(getServletContext().getRealPath("/resources/a.pdf")));
how can we use this string variable n to give name of the pdf....that is i have to give n.pdf so how it is possible?
 
Anurag Verma
Ranch Hand
Posts: 167
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use UUID.randomUUID().toString(), if you want some identification of user as well then you can append username to it separated by underscore or some other character.
 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anurag Verma wrote:use UUID.randomUUID().toString(), if you want some identification of user as well then you can append username to it separated by underscore or some other character.


please can you give an example???
 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anurag Verma wrote:use UUID.randomUUID().toString(), if you want some identification of user as well then you can append username to it separated by underscore or some other character.

thank you vey much i have understood.... but if i want to add no as unique identity then what should i do to append this unique id to name of pdf???
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rakhi sinha wrote:
Anurag Verma wrote:use UUID.randomUUID().toString(), if you want some identification of user as well then you can append username to it separated by underscore or some other character.

thank you vey much i have understood.... but if i want to add no as unique identity then what should i do to append this unique id to name of pdf???

Make it part of the file name.

Do you understand what this line does?

 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:
rakhi sinha wrote:
Anurag Verma wrote:use UUID.randomUUID().toString(), if you want some identification of user as well then you can append username to it separated by underscore or some other character.

thank you vey much i have understood.... but if i want to add no as unique identity then what should i do to append this unique id to name of pdf???

Make it part of the file name.

Do you understand what this line does?

yes i have understood
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So can you now append the number to the file name?
 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:So can you now append the number to the file name?

yes i have done it.thanks for your suggestion
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic