Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCX emitter images shown either distorted or truncated #2025

Open
hvbtup opened this issue Jan 9, 2025 · 4 comments
Open

DOCX emitter images shown either distorted or truncated #2025

hvbtup opened this issue Jan 9, 2025 · 4 comments
Assignees
Labels
BugFix Change to correct issues

Comments

@hvbtup
Copy link
Contributor

hvbtup commented Jan 9, 2025

In one of my reports, I am using an image item with the following properties:

  • width: not set
  • height: not set
  • proportionalScale: true
  • fitToContainer: true

In the onCreate event of the image, I set the height to 22cm:

this.height = "22cm";

In the PDF emitter, this has the desired effect that the full image is shown and it is not distorted (the aspect ratio is intact), independent of the image's actual image dimensions (eg if it's portrait or landscape). The setting causes a maximum width of the container available width and a maximum height of 22 cm, and the image uses at most this given space.

In my case, the image is more or left quadratic, and the available width is 161.9 mm, so this is rendered with a height of ~ 161mm:
grafik

In the DOCX emitter, the effect is not as desired:
The emitter seems to ignore the combination that proportionalScale and fitToContainer are both true.
The image is rendered truncated:

grafik

I attempted to fix this by also setting the maximum width to 161mm in the onCreate event.
In this case, the image is shown in full (not truncated), but it is distorted:

grafik

If you wonder, why I don't set the height property directly? Well, I have half a dozen of places in the report where an image comment can be shown. Setting the height directly causes a huge empty space in the designer, which makes editing the design a torture.

Note that the images in this report are not fixed, they are stored in the database and their dimensions can differ, some can be portrait, others landscape etc.

@hvbtup
Copy link
Contributor Author

hvbtup commented Jan 9, 2025

Thomas, I hope you don't mind that I assigned this to you. You are the one with the best knowledge about how images are rendered in BIRT.

@speckyspooky
Copy link
Contributor

I will take a look into it if I have a free slot.

@speckyspooky speckyspooky added the BugFix Change to correct issues label Jan 9, 2025
@hvbtup
Copy link
Contributor Author

hvbtup commented Jan 9, 2025

This issue looks tightly related to #1549.

@speckyspooky
Copy link
Contributor

Short result of first tests, I started a retest based on the reports of #1406 which includes a report with "hook"-images and a report with a "butterfly"-image and it looks good.

I tested PDF & DOCX in version BIRT 4.14 & BIRT 4.18.

The result is that both BIRT-versions create the same output for PDF & DOCX.
I can confirm that the option "fit to container" hasn't the correct effect of DOCX like for PDF.
This effect is already given with BIRT 4.14.

I will go ahead with he debuger and the mentioned location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugFix Change to correct issues
Projects
None yet
Development

No branches or pull requests

2 participants