• 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

Open PDF document

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.

I'm using JasperReports for generate documents, now i want to open the PDFviewer into a JInternalFrame and i don't know.
Right now i'm able to open the Acrobar, and a Browser but not inside my aplication, any ideas?

Thanks,
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any reason you want to embed the pdf reader in your application? You could get a handle on the JasperReportsViewer, and embed that in your application to view the report.
 
Nicolas Bordenave
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Brandon you are right. I can open the JasperReport Viewer instance of the acrobat.
I just make this, but i have the same problem, how can i show the viewer inside my aplication? Also when i close the jasper viewer this close my application. This is my code, any idea?


private void print() {
Connection conn;
try {
conn = DriverManager.getConnection("jdbc dbc B_Test", "", "");

JasperReport report = (JasperReport) JRLoader
.loadObject("Reports/lstUsers.jasper");
JasperPrint jasperPrint = JasperManager.fillReport(report, null,
conn);
JasperManager.printReportToPdfFile(jasperPrint,
"C:\\Nico\\Vision\\Reports\\Users.pdf");

JasperViewer.viewReport(jasperPrint);

} catch (SQLException e) {
e.printStackTrace();
} catch (JRException e) {
e.printStackTrace();
}

}
 
Brandon Broschinsky
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do the following:

Once you have your JasperPrint Object, you could create a JRViewer and pass in your JasperPrint like so:

JRViewer viewer = new JRViewer(jasperPrint);

Since JRViewer extends JPanel you could add this to to your JInternalFrame.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic