JasperReports page size scaling - jasper-reports

Does anyone know if there is a tool out there for scaling a JasperReports report up or down to fit different page sizes? The scenario is say I create & layout all my reports in the LETTER size. I want to be able to change to say size A4 on the fly and have all the elements adjust accordingly in width & X position.
Right now I'm writing my own code to do the scaling but I wanted to put this out there in case somebody knows of a tool or something in the JasperReports framework that I can use.
UPDATE
I created an open source project for JasperReport scaling: https://github.com/flex-rental-solutions/jasper-reports-scaler
It's still fairly primitive but we use it in our app successfully. I'd be delighted to see it grow from community support.

open the report with xml or text editor and add these two lines:
<Page width> 210mm </Page width>
<Page Hieght> 297mm </Page Hieght>
after this line:
`<Page>`

Related

Jasper HTML output width issue

This report is generated with jasper reporting tool with REST API. Report data is showing in an HTML page with an iframe. After loading data to the iframe, report HTML view showing a lot of white spaces in the right and left side. I have tried with increasing the iframe width in CSS. But this is not affecting the report. Is it possible to adjust white spaces from jasper report itself? I am using page size as A4 landscape.
I have attached the image:
Hi,
I have attached the image once again, You can see the Blank spaces on left and right side. How to remove this?. i have attached the jrxml link also. please help.
https://files.fm/u/56nnrd9z
Hi,
I have attached the Jrxml code link once again, please check it.
https://drive.google.com/file/d/1P9aeNW7YTIndNDyv8jkCwO_RQGf32iZu/view?usp=sharing
Various settings affect the output width of HTML reports, including:
Size unit (POINT vs PIXEL)
Zoom ratio
Page margins
For example:
final SimpleHtmlReportConfiguration configuration = new SimpleHtmlReportConfiguration();
configuration.setIgnorePageMargins(true);
configuration.setSizeUnit(POINT);
// Or try this instead of setSizeUnit(POINT)...
//configuration.setZoomRatio(2.0f);
final HtmlExporter exporter = new HtmlExporter();
exporter.setConfiguration(configuration);
If there are images in the report, consider using SVG format to avoid pixelation.
Additional information about these settings is at:
https://community.jaspersoft.com/jasperreports-library/issues/4483
https://community.jaspersoft.com/jasperreports-server/issues/6577
From the JasperSoft community site, you can set the zoom ratio in a JRXML file, described as follows:
You should be able to set a default zoom value by setting this property at report level:
<property name="net.sf.jasperreports.viewer.zoom" value="FitWidth" />
Other possible values:
ActualSize
FitHeight
FitPage
integers (e.g., 2 for 200%)
decimals (e.g., 0.5 for 50%)

IReports does not print length more than 297mm

I using ireport 4.0.1. I made a receipt print which is more than 297mm but it cuts at exactly at 297mm all the time. Rest of the data are not getting printed. But when i save it as a pdf i could see all the data. I tried with different kinds of printers (Eg: Epson TM20 -Receipt printer) but no positive changes :( I am using "ignored pagination" in my jrxml file. Could someone help me solving it ?
Set your design properties to more then your desired size.
Set your margins to be smaller.
Experiment with the orientation.
As for your printer itself- it should have the exact same settings and property aspects as these.
Note that it is most definetly a setup and size issue and more then likely NOT your printers.
Here is an image of the properties menu in iReport and to open it go to WINDOW on the top bar and click PALETTE.
Your report need to have a report footer and the height is equal to the A4 size.
It fixed my 2 years problem with receipt printing

Dynamically sizing/stretching tables in JasperSoft Studio

I have just recently begun using JasperSoft studio for a project I am on with very tight deadlines. Due to these constraints I was not able to spend my time researching the "correct" way to lay out a jasper report. Now I am stuck with really large bands that contain tables which tend to overlap the other content in said band.
So my question is this, what is the best way to create/modify these tables so that when the dataset in them expands that they don't overflow ontop of the other data in the current band?
I have found that if I create a new band and put the table inside that band it seems to size dynamically, however I cannot seem to find a nice way to create new bands either. My report currently has over 100 bands and whenever I create a new one I have to click the "move up" button ~100 to put the band in place and the re-arrange the other parts around it.
I have tried modifying the band's layout to "Vertical layout" instead of "Free Layout", but that was less than successful hosing the band's formatting and the data elements wouldn't display properly.
So my question is this, what is the best way to create/modify these
tables so that when the dataset in them expands that they don't
overflow ontop of the other data in the current band?
I'd say the best way would be to avoid using tables, and using the bands themselves instead. You could use groups to create "sub" headers and footers, and you can also manage to duplicate these headers and footers so that you can improve your layout. If create a new report based on a template or look at the examples provided in the Jasper Reports library pack, you may notice that the bands are used either as "row" or as "header"/"footer".
My report currently has over 100 bands and whenever I create a new one I have to click the "move up" button ~100 to put the band in place and the re-arrange the other parts around it.
And remember, a subreport is your friend in times like this. Again it can help you to organize your report and even provide more flexibility to your layout.
Finally, I believe that grouping so many bands with so many tables in the same report may cause you a big trouble (well, you have already noticed some issues). So maybe taking a bit of time to study more the "bands" system and the "subreport" component may help you. The Jaspersoft Studio documentation on the report structure is a good start.
I believe that dealing with Jasper Reports is basically dealing with these two components (bands and subreports).

Crystal report (or SSRS) flowing text around image

I want to have this layout in Crystal Reports:
How can I do this? If it cant be done in CR or SSRS, is there any other alternatives?
I don't believe this can be done with Crystal Reports. I'm not as familiar with SSRS, but after looking through the field options I don't believe it can be done with it either. In general field locations are set static in reporting solutions.
I think this would be best done with html/css or even XSL. I don't know the scope of the issue, but I'd assume that you should be able to output an html or xml file from your application which could be opened with a web browser. For html you should be able to use the align or even float attributes or text-align in css to accomplish this.
I hope this helps.
If you want to have multiple columns of static text in Crystal Reports, then you'd just have to get creative with multiple text boxes, i.e. create 2 text boxes side-by-side and add text to each one until it looks right.
If you want to have 2 columns of data, here's how:
Keep it simple and start with a blank report.
Add your fields of interest to the details section. Resize them so that they only use the first 4 inches of space.
Go into your Section Expert->Details and turn on the Format with Multiple Columns option.
A new tab will appear called Layout. For this example, let's set the Width to 4 inches and leave the Gaps at 0.
Preview your report. If you have enough data in your dataset, it will automatically flood over to the right side of your screen.
It'll take a few minutes of fidgeting with the measurements to get everything looking the way you want. You can even have more than 2 columns if you set the Detail Width small enough.
Also, there is also an option in the Layout menu called "Format Groups with multiple column". It's hard to describe in text, but play with this if you have any grouping levels.

The generated report in DOCX format has invalid margins

I'm using JasperReports to generate a word (docx) document but I have a problem when I want to try to print the doc. The exporter messes up the margins of the page. Does anyone know how to prevent that from happening.
I know how to set the margin in iReport, but it just makes the data generate further from the page borders, but the margins in word which can be adjusted at the top of the page is laying right at the edge.
Has anyone had this problem?
Are you able to specify the page size? Its possible that using this in combination with the margin settings will help the export problem.
If you are not too heavily invested in your Jasper solution, Docmosis and JODReports let you layout the document visually using Word or Writer then render the report in various formats. This may save you time in the long run, but all reporting systems have quirks. Hope you find a solution, especially when your output is not PDF.