Netbeans hibernate pdf report - java

I can't pdf report in netbeans with hibernate connection. I have a jsp page and a submit button which is supposed to read the database with hibernate connection and create pdf report for that. I can handle manually without any problem with jasper reports, ireport etc. So I can see what I want, but I want to do so that when I click on the submit button, it dynamically reads database and then converts the jrxml file to pdf. Also, I don't want it to use beans. Just a simple pdf creation with hibernate. Is that possible? Can anyone help me out with that?

Firstly If you write code or error more accurately we can answer.What is version of hibernate?I tried it with hibernate 3.8 but doesn't work cause jasper report's authors explained thus "We are currently supporting Hibernate 3.3.2.GA. Same version as JasperReports and JasperReports Server. There is also a dedicated library that you can add for compiling code in the "Build Path" preference page.
Unfortunately we currently don't support the co-existence of multiple Hibernate versions.
We will probably work on this in the nearly future." http://community.jaspersoft.com/jaspersoft-studio/issues/3802
Otherwise you can follow these steps;
http://jasperreports.sourceforge.net/sample.reference/hibernate/

Related

How to create table without knowing the number of row?

I'm using JasperReports and facing a problem.
I need to create a PDF file with a table, but without knowing the number of its row.
So I decided to use JasperReports API without using iReport or Jaspersoft Studio to create .jrxml design file.
But, I cannot find any sample that helps me how to write code to use table (or crosstab) in Jasper Reports.
Can you help me?

creating OMR image for folding machine on each page with JasperReports

Our invoicing system needs to print OMR (optical mark recognition) symbol on each page of our invoices so the folding machine knows what to put in the envelope, so that little PNG picture has to be put on each page.
Our invoice is consisted of main report with two subreports created in special .jrxml files. Picture is generated by calling web service with passing page number as a parameter in http request. So, we need to incorporate picture into subreport hoping that subreport will 'know' actual page number when generating document. Error we are getting is:
Error filling print... Could not resolved style(s): pdf
net.sf.jasperreports.engine.JRRuntimeException: Could not resolved style(s): pdf at
net.sf.jasperreports.engine.fill.JRFillObjectFactory.checkUnresolvedReferences(JRFillObjectFactory.java:1610) at
net.sf.jasperreports.engine.fill.JRFillObjectFactory.setStyles(JRFillObjectFactory.java:1537) at
net.sf.jasperreports.engine.fill.JRBaseFiller.loadStyles(JRBaseFiller.java:962) at
net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:835) at
net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:782) at
net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:532) at
net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:63) at
net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:209) at
java.lang.Thread.run(Unknown Source)
We are using JasperReports 3.0.0 - migration to newer version requires lot of changes, so that's for now out of option, in case we need to go to newer version.
solved with putting picture onto band called 'background' of main report. Picture is being shown regularly on each page once.
There is a great application called Mail Markup that will put OMR marks on any document you like. It allows you to configure the OMR marks to your requirements so it is compatible with any folder inserter. You can find out more and download an evaluation here

DataGrid In Java Struts Web Application

After scouring the web I have edited my question from the one below to what it is now.
Ok I seem to understand that I don't need all the capabilities of excel right now. I think i am satisfied having a data grid to display data. Basically i am working on Struts 2 and I wat my jsp page to have an excel like feel and hence looks like even a datagrid is sufficient. I came across This Technology
I am not sure whether I must go ahead and use it. Any other suggestions, alternatives are welcome
The older version of the question
"I have a java web application running on windows currently. I may host it in future in a Linux Server.
My application allows people to upload data. I want to display the data they have uploaded in an excel file and render it in a portion of my webpage.
How do I go about this ?"
Basically you would need to read the excel files, get the data in some kind of java objects, and then show it back to user as a normal HTML page with tables etc..
If you want to show the excel files in such a way that your users are also able to edit these then you need to look into javascript / ajax to make a UI as per your needs.
An easy and open source way of reading the uploaded excel files in java is via Apache POI. It is capable of reading .xls files as well as the newer OOXML .xlsx files.
http://poi.apache.org/spreadsheet/
They have very helpful examples which can get you started within 10 minutes..
http://poi.apache.org/spreadsheet/quick-guide.html
If you can allow data to go to another site, then you can use ZOHO. Their online Excel Editing is reasonably good and you don't really have to do anything much.
Maybe you can try http://www.jxcell.net:
It is a java spreadsheet component which allow you to edit your Excel via web page.

Extract text from PDF (google app engine)

Is there any free Java library for extracting text from PDF, that is compatible with Google Application Engine?
I've read about PDFJet, but it can't read PDF, can it?
Is there perhaps other way how to extract text from PDF? I tried http://www.pdfdownload.org/, unfortunately they don't handle non-English characters correctly.
iText now has a text parsing module (I'm one of the parser authors). See the com.itextpdf.text.pdf.parser.PdfContentReaderTool class for an example of how to use it.
PdfBox does not run on GAE. It uses not-allowed java classes.
(GAE only permits these http://code.google.com/appengine/docs/java/jrewhitelist.html)
I have partially modified a very old version of PdfBox (0.7.3) to be GAE complaiant. Now I'm able to extract text from PDF (whole page or rectangular area). I only modified a minumum part of the pdf text extraction and not the whole PdfBox. :)
The idea was to remove refences to java.awt.retangle & C. using my own "rectangle" class.
More info: http://fhtino.blogspot.com/2010/04/pdfbox-text-extration-gae.html
I modified the latest (1.8.0-Snapshot) version to run on Google AppEngine. Had to disable one Unit-Test, but it runs fine for simple text extraction.
Following the simple try-fail-fix approach i had to modify 5 files in total. Pretty doable.
You'll also have to explicitly use a RandomAccessBuffer, like Fabrizio explained.
For the extra lazy, heres the compiled jar, dependencies for text extraction, and the patch. Note that it might not work for every usecase (i.e. rectangle based extraction). Used it to extract text of a whole page.
https://docs.google.com/folder/d/0B53n_gP2oU6iVjhOOVBNZHk0a0E/edit
I know there is http://pdfbox.apache.org/index.html
Apache PDFBox is an open source Java
PDF library for working with PDF
documents. This project allows
creation of new PDF documents,
manipulation of existing documents and
the ability to extract content from
documents.
but I've never tested it.
Last month, I'd just finished extracting text from pdf file in my project. I used XPDF tool for getting text, and text coordinates, but I used it in Xcode (Objective-C). This tool was open source, written by C++, and able to be encoded in many language. However, I didn't know whether XPdf would be work on your java, or not. Anyway, You can try this tool.

Applet Based Jasper Report!

The thing I am doing is displaying Jasper Report in an JApplet in web browser. Eeverything is working fine except two.
The detail section of my report is not showing up in the applet. I'm sure that there is no issue with the report filling as the values of query fields put in other sections like page header are showing up. Only the detail section is missing. Can anyone give some idae about the cause?
The SAVE button of the JR Viewer in the applet is not working. Any comments?
About the first question, the Detail section (unlike other sections) is related to the Data Query of the entire report. So you should make sure the report query is returning at least one record for the Detail section to appear.
Suggestion, you can export your report to PDF and open it using the browser, I believe this would be better than loading an Applet each time.

Categories