• 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

Need Suggestion for following sceneario

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Guys,

I need suggestion for the following scenario
1) There are X number of word Documents saved in a hard disk
2) In Web application upon some action
2.1) the logged in user details has to be fetched from database
2.2) the User details(userId,UserName,Desigantion (hardly some 9 informations)) has to be filled in one of the documents, which has been mentioned in the Step 1.
3) Generate the PDF with the modified content and send it to browser for download.

Solutions
1) Load All the documents into memory as a String or StringBuffer format while application server start up & replace(fill userid, userName and some information) the String or String Buffer & Generate the PDF
2) Load only the requested or specific document as a String or StringBuffer format & replace the String or String Buffer & Generate the PDF
3) Take the contents of word as constants of String Objects and create java program for generating the PDF.


I Think the first two approach will give OutOfMemoryException if everything gets loaded into memory, The Third approach will be performance impact because of more String operations.

how to do it in efficient way.


Thanks & Regards
S.Sathiya

 
Ranch Hand
Posts: 497
2
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello sakthi
It is not allowed in the forums offer design suggestions. As an architect you have to consider all available options to resolve the situation, make your choice and justify why.
Regard
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As an aside, you wouldn't use StringBuffer in a new app. You'd use StringBuilder instead. (If it even needs to be a string - look at CLOBs and ascii streams)
 
What's a year in metric? Do you know this metric stuff tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic