• 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

how to generate n number of pdf in java

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to generate n number of pdf here n will be some limit according to requirement so ultimately I have to generate more than 1 pdf same time with once running the code I Have some values associated with id i want to print those values with respective id's in pdf format, values can be in database or in some variable , can anyone suggest me which way i should go... i have some ideas either i can save those values in database and can make a single xml file from database of all records and then divide each node with different different pdf or directly get the values from database and generate the pdf so please anyone suggest me ideas and ways also if you can refer some links then most welcome please try to help me here.....
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you be more specific about what you're asking? You say that you need to create several PDF files, but it isn't clear what part is missing. Creating PDFs in general? Creating more than one PDF? Organizing the data? Something else?

I'd think that the issue of data storage is separate from the issue of creating PDFs form the data. You should store the data in whatever way makes the most sense for the application as a whole.

Also, why are you mentioning XML? Does your way of generating PDFs rely on XML input?
 
walter bakshi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sir my question is very clear i have to generate n number of pdf here n will be the limit which i will fix accordingly,and pdf will have one id and salary associated with that id so every id will change
according to limit and then salary will also change according to that id so means every pdf will have unique data so tell me how to create n number of pdf... give me any link.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, the question is not clear to me. Since you emphasise that you want to create "n PDFs", I assume that you know how to create a single PDF. But if you know how to create one PDF, I'm at a loss to understand why you can't do the same process n times in a row, or what the importance of the changing ID or salary is (since there is no point in creating the exact same PDF n times, that would be just two of the changing data items that differ between PDFs).

And I still have no idea what XML has to do with this, or what difference it makes how the data is stored. You need to put more effort into explaining the situation that leads to your questions.
 
walter bakshi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sir actually i was thinking that can i go with xml way.... so i asked is it possible that we can take data from database and convert whole records into xml and then break every node of xml into one pdf so on the basis number of node we can generate pdf so leave this one if you can give any idea on this then fine otherwise leave it and my aim is i have to create pdf for salary slip that i told you so salary slip will be having one id associated with employee and their salary so a single pdf will have only single id with respective salary this is my task , i can generate pdf normally but dont know how to put n number of loops because i have tried using this way i tell the url
http://www.vogella.com/tutorials/JavaPDF/article.html
and i tell you my full task so you can guide me in better way ..... sir my task is i will be having one excel sheet in that three things will be there employee id, name and no of days that he came to offfice
and now database will have same id associated with same name as in excel sheet and in database some other fields will be there like his salary details per day and all so by getting data from excel sheet
we have to go in database serach respective employee and get his details and calculate on the basis of no of days and all and save that salary and send id and salary to pdf then finally to their mails i hope this time you will understand well and thanks sir for your response and interest
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's quite hard to follow what you're saying, since you don't use any punctuation, or uppercase/lowercase. This is a forum, not a text message - you need to make it easy for others to understand what you write.

i can generate pdf normally but dont know how to put n number of loops


Why not? If you can do

why can't you do

?

I think you're confusing yourself by mixing everything into the same problem. For creating a PDF, it is entirely irrelevant whether the data is stored in an Excel file, or a DB, or in some completely different way. As long as your solution for creating PDFs depends on how the data is stored, you haven't properly separated concerns logically.

As to XML, I don't see how that's useful if you want to use iText. If the data is highly regular, creating XML and then generating PDF by using an XSL-FO stylesheet might be an option (via the Apache FOP library), but it doesn't sound like that would be the case here.

Regarding that article: Be aware that it uses a version of iText that is licensed under the Affero GPL. Using that license it's very easy to come into a situation where you are forced to distribute the source code to your application to anyone using it. If you're not sure what this means, then you need to run it by your corporate legal department.
 
walter bakshi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks sir for your suggestion i will work on it and will share the results..
 
walter bakshi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello sir i am redefining the question i have table in that some rows are available all are unique i want to generate pdf on the basis of rows availability so different different pdf should get generate according
to rows value and limit will be the records value so tell me how can i generate multiple pdf in this way.....? and i am using this link
http://mrbool.com/how-to-create-and-export-pdf-files-in-java/27343

but in this link they are putting all rows in same pdf so i want in diff diff pdf
 
Rancher
Posts: 3742
16
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:It's quite hard to follow what you're saying, since you don't use any punctuation, or uppercase/lowercase. This is a forum, not a text message - you need to make it easy for others to understand what you write.

 
walter bakshi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello sir
I am trying again to explain situation the main task of the work is , I have to generate n number of pdf

Now i am telling what data i want.... See i have one table in which some columns are there with some values , so suppose in that table 7 rows are available so i have to generate 7 pdf at a time by reading data from database
and on the basis of rows availability we will fix the no of pdf which we have to generate in one pdf we will have only one rows data in another second pdf we will have another second row data like this so on...

and i am using this concept to storing rows value into pdf which is given on this link .. http://mrbool.com/how-to-create-and-export-pdf-files-in-java/27343
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's more or less what I understood you to ask. So I repeat my previous question:

Ulf Dittmer wrote:Since you emphasise that you want to create "n PDFs", I assume that you know how to create a single PDF. But if you know how to create one PDF, I'm at a loss to understand why you can't do the same process n times in a row, or what the importance of the changing ID or salary is (since there is no point in creating the exact same PDF n times, that would be just two of the changing data items that differ between PDFs).



To be precise:

1) Do you know how to generate one PDF in the way you want? Yes or no?

2) If the answer to #1 is "Yes", but prevents you from creating more than one?

3) If the answer to #1 is "No", are you asking how to create any PDF?

3a) If the answer to #3 is "Yes" , you have already discovered iText (which I already commented on) - what prevents you from using that?

3b) If the answer to #3 is "No", what are you asking?
 
walter bakshi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sir i was not knowing how to create the pdf but getting some link from google i am able to create pdf and i mentioned you that link but i think you have not check the link
sir please go through the link in that way i am able to create pdf but i have to create n pdf which i have mentioned you in my last comment now i am giving you code in which i am able to create pdf



so i am trying to create pdf but what is happening here only last row coming printed and only one pdf because same name problem , how to save the pdf with different different name so then cant be over riden
please go through my code you will understand...
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

walter bakshi wrote:only one pdf because same name problem , how to save the pdf with different different name so then cant be over riden


You will have to introduce a variable into your file name - perhaps the value of q.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i think you have not check the link. sir please go through the link


Indeed I have not, and I am not going to. You should to be able to describe any problem you have here in the space of a forum post.

Joanne gave you a hint, so I'll assume the problem is solved. If it is not, tell us in detail what is still missing, what you have tried to solve it, and how that has or has not worked out.
 
reply
    Bookmark Topic Watch Topic
  • New Topic