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

Feat/pdf export resize #62

Closed
wants to merge 2 commits into from
Closed

Feat/pdf export resize #62

wants to merge 2 commits into from

Conversation

margalva
Copy link
Collaborator

Add to the export pdf capability the feature to set width and height on all items so that two images will fit into a single page. Logos will not be resized. If footer templates are present, they're used in the export.

…o two fits in a page. Do not apply that to the Logo template. Needed for Fluent export
@margalva margalva requested a review from viseshrp September 29, 2023 17:22
# Logo template so the Logo image doesn't get resized.
# Ideally you want to walk the tree from root_report down and find the Logo
# templates only there. In practice, that's too time consuming so just
# modify all Logo templates in the database and then reset them.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@margalva
So modifying ALL Logo templates is much more expensive than walking the root report. The get_objects call can be pretty expensive. I would just check the concerned report only. Modifying all Logo templates in the database seems unnecessary.
Also I am not completely sure about the need for this kind of a hack and maybe I can be more helpful if I do, but the overall approach seems pretty hacky to me. For example - things like checking for the string "Logo" and assuming it is nothing but a Logo image, the hardcoded values for width and height 800x600, etc. If this heavily customized based on Fluent's requests as mentioned in the comment above, I would come up with a generic fix and avoid this one.
But nonetheless, I think @randallfrank , the original author of this, must have a look. There should be a cleaner way, eg. via Qt itself possibly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@viseshrp see your team messages for a more detailed discussion of this hack.
Yes this is a hack to quickly fix an issue they currently have - no reason to make a more extensive change since we're going to change all of this functionality soon anyway. Qt addresses this issue via using the footers, which Fluent is going to introduce via adding footer templates, but that alone isn't enough if they don't fix the image sizes.
I tested the Logo modifications vs. searching the Logo template explicitly in the whole tree and building the tree is way more expensive, considering how complex their final template is. See first commit with the tree building function, it takes significantly longer than getting all the Logo templates out as it involves recursively using the get_objects call.

@margalva margalva closed this Oct 5, 2023
@margalva
Copy link
Collaborator Author

margalva commented Oct 5, 2023

Change pushed on Fluent's side

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

Successfully merging this pull request may close these issues.

2 participants