aspose file tools*
The moose likes Servlets and the fly likes related to pdf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "related to pdf" Watch "related to pdf" New topic
Author

related to pdf

rakhi sinha
Ranch Hand

Joined: Mar 26, 2012
Posts: 147
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
You need to ensure that file names are unique for each client, and do so in a thread-safe way.
rakhi sinha
Ranch Hand

Joined: Mar 26, 2012
Posts: 147
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Mar 26, 2012
Posts: 147
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

Joined: Mar 30, 2012
Posts: 124

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

Joined: Mar 26, 2012
Posts: 147
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

Joined: Mar 26, 2012
Posts: 147
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

Joined: Jul 26, 2007
Posts: 10451
    
    8

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?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
rakhi sinha
Ranch Hand

Joined: Mar 26, 2012
Posts: 147
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

Joined: Jul 26, 2007
Posts: 10451
    
    8

So can you now append the number to the file name?
rakhi sinha
Ranch Hand

Joined: Mar 26, 2012
Posts: 147
Maneesh Godbole wrote:So can you now append the number to the file name?

yes i have done it.thanks for your suggestion
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: related to pdf