• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

related to pdf

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 171
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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???
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic