Jump to content

images demo enlarges images with "RealSize" param


tomkast

Recommended Posts

regarding C:\jasperreports-3.6.2\demo\samples\images, when running the pdf sample, it appears that the pdf results for the real size example and real height example (see 2 excerpts below) both are larger than the original image.  attached are the original image and the pdf output of the report.

what we are looking for is a pdf example where the image is left alone in terms of its original pixel dimensions using a PDF exporter.  this way various images can be used, dynamically, and they remain in the original dimensions.

 


Code:
<image scaleImage="RealSize"><reportElement x="0" y="0" width="150" height="40"style="imageBox"/><imageExpression>"dukesign.jpg"</imageExpression></image><image scaleImage="RealHeight"><reportElement x="0" y="0" width="100" height="40"style="imageBox"/><imageExpression>"dukesign.jpg"</imageExpression></image>
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

this works:

Code:
			BufferedImage img = ImageIO.read(new File(wo_image_path));			height = img.getHeight();			width = img.getWidth();						jasperSubDesign = JasperManager.loadXmlDesign(context.getRealPath("/WEB-INF/reports/decoration_sheet_header.jrxml"));			JRDesignImage image = (JRDesignImage)jasperSubDesign.getPageHeader().getElementByKey("wo_image");			image.setX(3);			image.setY(69);			image.setHeight(new Long(height - Math.round(height*.35)).intValue());			image.setWidth(new Long(width - Math.round(width*.35)).intValue());			JasperCompileManager.compileReportToFile(jasperSubDesign, context.getRealPath("/WEB-INF/reports/decoration_sheet_header.jasper"));
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...