I have a java desktop application with information about several entities. There is a "print" button than WHEN pressed various information should be collected and printed.
The question is: How can i select WHAT will be printed ON a specific location on the paper?
A more general question would be: How can i format information to be printed on paper?
I would suggest using something like iText for generating a PDF and print the PDF instead. As a bonus, the output can be saved easily and attached to an e-mail.
You need the Java Print Service - http://java.sun.com/javase/6/docs/technotes/guides/jps/index.html
We've successfully use JasperReports -- really great tool scaling from simple to complex reports. Supports working directly with a list of entities (very convenient), and also RDBMS communication via JDBC and even HQL (Hibernate Query Language). There is also a visual design tool for it called iReport, so one can visually design the look and feel of the report.
Related
I have really low knowledge on Java and JasperReports, barely used those to play around, nothing too serious. A friend of mine has been trying to get someone to develop him an application that will generate PDFs with information from an access database for each of his clients, however, after 6 months and 7 developers who ditched him, he has found none, so he asked me if I could help him to which I said I'd give it a try.
What I have been able to do so far:
So far I've managed to successfully (Everything has been done separately, I have like 8 projects in total so far):
Use Jaspersoft Studio/iReport to create a single PDF with the required client information on each sheet.
Create a separate JasperReports project with a input field to get a pdf with a single client information.
Create a Java App with a JFrame to launch the report generation.
Create a Java App to connect to the access database through ucanaccess and validate the search criteria
Questions:
Now, after a few days on Google up and down I havnt managed to successfully achieve everything that I'd like to achieve, and I'd love if someone could either point me into good noob-proof guides or (if willing) provide a noob-proof answer so I can continue to move on.
Create a Java App where you can choose to generate all client's report or a single report for a specified client (I am assuming this isn't too complicated since it'd just be a matter to embed both Jasper reports into the java app), however I'd need to pass the input value into jasper report field to generate a single report (Not sure if this one was clear enough), and run the query for the data-set based on that field's value.
Ideally though not highly needed, pass yet another variable as a field to set a date range.
Since this is being done on a MS Access Database -*.accdb- (Don't blame me, I've been telling him to move to MySQL/SQL for quite a while now), I'd love to know if its possible to make JasperReports do a query based on a UCanAccess JDBC connection (Tried a few options, none worked).
Finally, I need to generate in the report a date range (Something like: "Between 1/Jan/2014 and 1/Feb/2014")
I feel like I've made a decent amount of progress so far, but since I am no pro on either JasperReports nor Java, I am getting stuck in a point where more knowledge is required to create a more decent and practical piece of software and I'd love if someone could point me into a better direction (Either if something is impossible or just a few links to help me get thru)
-Remeber to add ucanaccess jar and all dependencies jars in the Driver Classpath, while creating the Data Adapter
-You have to set Showschema=true:
e.g.
jdbc:ucanaccess://c:/db/database.accdb;Showschema=true
In this way Jasper Studio will be able to navigate the metadata of your database, and you'll find your tables under the PUBLIC schema.
Then you'll be able to create your reports as usual.
I am trying to write a program that creates an Apple Keynote Slide. I was hoping to find some answers about creating apple's xml format (apxl) from scratch using Java. I have found a few documents pertaining to older versions of Keynote that allow such creation using Java DOM, but as far as the latest version of Keynote goes, I haven't had much luck. (btw I know that the .key file is a package, and that the apxl file is compressed .gz)
I have already read the following documents:
[1] https://developer.apple.com/appleapplications/keynote-apxl.html
[2] http://www.xml.com/pub/a/2004/01/07/keynote.html
... and many others. (stackoverflow will only let me post two links as a new person)
A google search will show you that there's not much documentation past 2004.
My question is, has anyone here successfully written something in Java to create, or add to, an apxl file for use with keynote? If so, could you point me toward the documentation, tutorials, or sample code that you used?
I'm not looking for your code, I just can't find a viable set of instructions wherever I look.
Thanks
My colleague used the next approach to generate big MS .xls/.doc 2003 documents. He had a goal to make reports contained >10^6 rows. He just produced xml and made zip file - as does it MS Word/Excel.
The format of xml can be simply retrieved from sample documents: e.g. if you'd like to know how do text formatting - just create simple documents with it and analyse output files.
Of couse we had very tiny set of abilities, but basic text formatting and layout markups were implemented.
I'm not sure how many features do you need. But you may implement the same xml generation procedures after separate investigation of every formatting feature.
I'm using a library called Jasper to link my Java application to the Sicstus4 software. This is working smoothly but when I make a query to it I need to grab the output in order to show it in a JTextArea. Right now the Sicstus software prints the output to the console, how can I grab it?
Thank you in advance! Joshua.
Well I don't know anything about Sicstus4, but if you're calling it from Java, there are examples here. It looks like you're supposed to get the output from the Map you pass in when you create the query.
I have developed a Java application and now i want to give some simple printing support. Something like printing invoices , some reports etc.
Right now I'm creating that stuff in html, showing it on JEditorPane. but html support is quite poor and I'm really fade up of that thing. Is there any better way of doing such thing?
Any better browser component, or better tool to create such simple reports? (JDK 1.6)
I love JasperReports for that. In combination with iReport (a GUI for creating the reports) is the best I could find for free in Java to do reporting.
You can also generate PDFs files with iText for printing. Although I think it will be easier to use iReports.
JasperReports is a pretty nice reporting tool for Java. It could be a bit heavy weight for what you want.
Another solution is BIRT which is very simple to use : it is an Eclipse project with a visual editor for your reports. The report is built in 3 steps :
create a DataSource
create a DataSet on this DataSource
create your report, based on the DataSet
DynamicReports is an open source reporting tool. You can create reports quickly without needing to use a visual designer. See the examples.
When printing invoices and reports, no doubt you want them to look more than basic - hence your problem. If your swing application has a server-side component, then look at libraries like Jasper and Docmosis to produce decent reports from the server (since heavy-weight server side is typically aok). If you really need a library just for a client app, there's an old library called JViewPro which is pretty yuk to code with, but can let you layout reports in code for displaying and printing and is a single jar (just be careful about memory usage).
I am writing this application in Java, where I have a JTree on the left of the JFrame, and the item selected in the JTree determines what appears on the right. This is similar to Edit --> Preferences in Thunderbird, and several other applications' preferences.
Anyhow the main difference is that in my app the stuff on the right is dynamic, and needs to be generated at run time using input from a file.
What I am after is various ways in which this can be accomplished, code snippets or existing frameworks / libraries if they exist.
The input file needs to be something higher level than the sort of XML generated during Serialization. No output capability is required.
Thanks
The JEasy Framework looks to do exactly what you're asking for.
But here's a whole list of similar projects: http://java-source.net/open-source/xml-user-interface-toolkits
There's a short description for each one and a link to their project page. You'll want to look at a handful of the ones that sound good to you, and then try one or two for yourself.
As of now i think one of the most actively used is Swixml. better support compared to JEasy.
have been using it for some while now, and is very easy to learn too
Perhaps it - http://www.soyatec.com/eface/ - XAML/WPF for Java.