| Summary: | [Improve Report Layout Capabilities] Incorrect image size in generated pdf | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Ming Gu <gumingbj> | ||||||||||
| Component: | BIRT | Assignee: | Birt-Report-inbox <Birt-Report-inbox> | ||||||||||
| Status: | VERIFIED DUPLICATE | QA Contact: | Tianli Zhang <tzhang> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P1 | CC: | bxu, gumingbj, henning, hustlg, huxd, jonathanerlich, wangjunl, wenfeng.fwd, wyan | ||||||||||
| Version: | 2.2.1 | Keywords: | plan | ||||||||||
| Target Milestone: | 2.5.0 M5 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Windows XP | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Ming Gu
Created attachment 107699 [details]
report project and pdf files generated by BIRT2.2.0 and BIRT2.2.1
Created attachment 107704 [details]
birt 2.2.1 output
birt 2.2.1 output
Created attachment 107706 [details]
birt 2.2.2 output
I had checked out three version (2.2.0, 2.2.2 and 2.2.2)of birt, and previewed this report. it's the same for birt 2.2.0, but different in 2.2.1. Please refer to my attachment. it seems the master page was changed in your second case, and it is generated in 2.2.2 instead of 2.2.1. In birt 2.2.0, when the image size exceeds the page body size, it will be scaled to fit the page. so it looks smaller in 2.2.0 than 2.2.1. You can insert a large image to check this feature. but this behavior is not correct, BIRT should never change the user's setting. This bug had been fixed in 2.2.1. when the image size exceeds page size, it will be clipped. Now i try to explain why this image looks bigger in PDF than in html. In html, browser always use the screen resolution to display the image. In PDF, birt2.2.x use 72 DPI to generate PDF file. So if the screen resolution is 72 DPI, it looks the same. if the screen resolution is 96 or 120 DPI, it looks bigger in pdf. User want the same size in PDF and html, there are two choice: 1. set an absolute size (in, cm, pt etc) for image. 2. set resolution in PDF render option (This feature is not supported in birt2.2.x, need add a patch to support.) what is your suggestion? Thanks About the feature in 2.2.0 that "when the image size exceeds the page body size, it will be scaled to fit the page", this is good feature to us, not sure why you think its a bug? Can we pull that feature back? Or at least, provide some options and allow users to make their own decision? And, is it feasible for BIRT to use current screen resolution when generating PDF? That's more reasonable than hard coded resolution. we can not use current screen resolution. For example, if user deploys report engine to a server and preview PDF report in another client, then birt use the screen resolution of server to generate PDF report. For the feature of scaling large image, please refer to bug #240805 (In reply to comment #6) > we can not use current screen resolution. For example, if user deploys report > engine to a server and preview PDF report in another client, then birt use the > screen resolution of server to generate PDF report. > For the feature of scaling large image, please refer to bug #240805 If the image is an image tag in the HTML text report item, how to set the max size property? Are we going to have the DPI issue if the max size setting uses px as unit? For 2.2.x, how about change the default dpi to 120 and also add a dpi setting for the pdf emitter plugin? (In reply to comment #5) > About the feature in 2.2.0 that "when the image size exceeds the page body > size, it will be scaled to fit the page", this is good feature to us, not sure > why you think its a bug? It is a bug since the image tag has size attributes, so BIRT engine would calculate the image size based on the size setting in the report. The issue is the DPI used to calculate the size needs to be adjusted. size = px / dpi. For image report item (not html text item), birt can support scale to container to avoid clipping of image. But since this is an image in a generic html text item, the scaling needs to be applied to the entire html div, which is not currently supported. One possible solution is to add a setting of fit-to-container property on the entire html text item, if this setting is set to true, images in the html item will be scale to fit in the container width/size. I suggest we add this feature in 2.5. >If the image is an image tag in the HTML text report item, how to set the max >size property? Are we going to have the DPI issue if the max size setting >uses px as unit? whatever you did in BIRT 2.2.0 seems work fine, could you please do the smaething? >For 2.2.x, how about change the default dpi to 120 and also add a dpi setting >for the pdf emitter plugin? We don't mind adding an extra setting at all. Please at least restore the working behaviour in 2.2.0 back into 2.2.2, making it an option is OK. This is a blocking bug for our application, i.e. show stopper. After discussing, we will make the following changes: Add a render option to control the image layout behaviour. The default behavour is the same with 2.2.0, when image size exceeds the container size, it will be scaled to container size. And user also can change this option to make the image clipped. Thanks very much for the proposed change and really appreciated all the help and support from you in dealing with the PDF issues. As Gang Liu and I exchnage the proposal on this issue, a patch that can be applied to 2.2.2 which restores the same behaviour as in 2.2.0 with a new settting/option will be fine. Thanks very much for you help. Created attachment 109113 [details]
patch for birt 2.2.2
add a patch on birt2.2.2 for this issue. The patch will restore the behavior of 2.2.0, image will be scaled if exceeding container size *** Bug 240468 has been marked as a duplicate of this bug. *** We should support a new property max-width on image item in next release. none: if image size exceeds container width, the image will be clipped. 100%: if image size exceeds container width, the image will be scaled to fit container. Hi Gang Liu, Thanks very much for the patch and really apprciate your help, and we'll apply it and test it out with our application. set to 2.5 for remain task. Hi Gang Liu, This patch works, and if the image width beyond the page width, the image width in pdf file can fit the page width. But there is another issue: if an image height beyonds the page height, the image will be truncated in generated pdf file. BIRT seems zoom the image to fit the page width, but if the height of the zoomed image beyond the page height, the image height will not fit the page height. Could you provided a patch to make the image height fit page height as image width. Reassign to model team to add max-width property for image item first *** This bug has been marked as a duplicate of bug 240805 *** Verified. Is there a patch for 2.3.0 too? Where can i find the new property on BIRT 2.5? i couldn't find it. Thanks Select image and go to Property Editor->Advanced you will find the Fit to container property. |