How to save the same PDF report several times from jasper using java without overriding the existing file in the directory

swaroop k

How do i save same pdf file generated from jasper in java without overriding the existing pdf file like report1, report2, report 3 etc Note: its a java application not for web application, but solutions for both would be helpful.

enter code here

JRDesignQuery newQuery = new JRDesignQuery();
newQuery.setText(sql1);
jd.setQuery(newQuery);
JasperReport jr = JasperCompileManager.compileReport(jd);
JasperPrint jp =  JasperFillManager.fillReport(jr, null,con);
JasperExportManager.exportReportToPdfFile(jp,reportDest);


JasperViewer.viewReport(jp); '
swaroop k

i figured out the best solution for save the same file with a different name without overriding the existing file

added this code before the code.I am appending the date and time to the file and hence files with different time and date will be stored in the same directory for a jasper report.

enter code here
String file = "filename_";



// display time and date using toString()
Date date = new Date(System.currentTimeMillis());

 SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-hh.mm.ss");
String dateString = formatter.format(date);

JasperExportManager.exportReportToPdfFile(jp,reportDest+file+dateString+".pdf");

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to merge two jrxml jasper report into 1 pdf same page

From Dev

Run Jasper report and export as pdf from Java Swing application

From Dev

Pick up a directory by JFilechooser and save Itext Report in .pdf to that directory in Java

From Dev

How to save created file to the same project directory? Java

From Dev

How to save created file to the same project directory? Java

From Dev

How to refer to a .jrtx template file from Jasper Report (.jrxml)?

From Dev

How to "svn ignore" a file, without overriding the existing ignore list

From Dev

How to dynamically hide a column in jasper report using java?

From Dev

Upload the same file several times

From Dev

How to call MATLAB from the command line several times, using the same MATLAB instance every time

From Dev

How to call MATLAB from the command line several times, using the same MATLAB instance every time

From Dev

how can i do download of PDF archive of jasper report using AJAX?

From Dev

How to fill out the forms and save the inputs in this tax report pdf file

From Dev

How to add hyperlink in jasper report using jasper studio 6.03

From Dev

Printing the same character several times without a loop

From Dev

How to set margins to jasper report in java?

From Dev

Extracting tar file without overriding working directory

From Dev

show newly installed font in jasper report from grails in pdf format

From Dev

show newly installed font in jasper report from grails in pdf format

From Dev

How do I zip a SQL Server backup file using Powershell and save in the same directory?

From Dev

How to save the compiled JasperReport as a .jasper in a file

From Dev

How to include C++ header file which is not in the same directory as the current source file without using '..'?

From Dev

How to Save/Overwrite existing Excel file without message

From Dev

Jasper Reports: How to combine two report streams into one PDF output?

From Dev

Rename file to uppercase in the same directory using Java

From Dev

Saving jasper report as pdf on server

From Dev

Jasper Sub Report not shown in PDF

From Dev

Saving jasper report as pdf on server

From Dev

Java: Save an image to a file directory without exiting application

Related Related

  1. 1

    How to merge two jrxml jasper report into 1 pdf same page

  2. 2

    Run Jasper report and export as pdf from Java Swing application

  3. 3

    Pick up a directory by JFilechooser and save Itext Report in .pdf to that directory in Java

  4. 4

    How to save created file to the same project directory? Java

  5. 5

    How to save created file to the same project directory? Java

  6. 6

    How to refer to a .jrtx template file from Jasper Report (.jrxml)?

  7. 7

    How to "svn ignore" a file, without overriding the existing ignore list

  8. 8

    How to dynamically hide a column in jasper report using java?

  9. 9

    Upload the same file several times

  10. 10

    How to call MATLAB from the command line several times, using the same MATLAB instance every time

  11. 11

    How to call MATLAB from the command line several times, using the same MATLAB instance every time

  12. 12

    how can i do download of PDF archive of jasper report using AJAX?

  13. 13

    How to fill out the forms and save the inputs in this tax report pdf file

  14. 14

    How to add hyperlink in jasper report using jasper studio 6.03

  15. 15

    Printing the same character several times without a loop

  16. 16

    How to set margins to jasper report in java?

  17. 17

    Extracting tar file without overriding working directory

  18. 18

    show newly installed font in jasper report from grails in pdf format

  19. 19

    show newly installed font in jasper report from grails in pdf format

  20. 20

    How do I zip a SQL Server backup file using Powershell and save in the same directory?

  21. 21

    How to save the compiled JasperReport as a .jasper in a file

  22. 22

    How to include C++ header file which is not in the same directory as the current source file without using '..'?

  23. 23

    How to Save/Overwrite existing Excel file without message

  24. 24

    Jasper Reports: How to combine two report streams into one PDF output?

  25. 25

    Rename file to uppercase in the same directory using Java

  26. 26

    Saving jasper report as pdf on server

  27. 27

    Jasper Sub Report not shown in PDF

  28. 28

    Saving jasper report as pdf on server

  29. 29

    Java: Save an image to a file directory without exiting application

HotTag

Archive