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

Small Feature Request: Full Page View &/ Chrome Headless #296

Open
yamenzk opened this issue Jun 20, 2024 · 2 comments
Open

Small Feature Request: Full Page View &/ Chrome Headless #296

yamenzk opened this issue Jun 20, 2024 · 2 comments

Comments

@yamenzk
Copy link

yamenzk commented Jun 20, 2024

Hello! Really love the latest work on the designer, thank you so much for the constant improvement. While the designer now is almost WYSIWYG, it still gets a little buggy sometimes specially with page margins, font rendering and style cohesiveness across PDF & Prints.

I found out that rendering with Chrome Headless (for Frappe Cloud version, check my fork) solves 90% of all rendering and printing issues, and maintains the same layout, structure and styling on prints and PDF.

Chrome Headless also opens for endless possibilities, for example, I can @import my own fonts, or run Javascript code before printing to apply some dynamic changes, and much more... The best part, they will still render as good on prints & PDF (Given that the codes were passed as a Jinja HTML Block from the Custom Data section of the designer)

The only part that might be problematic for the designer (I haven't tested yet) is how headers, footers and page numbers render through Chrome Headless because I assume it needs puppeteer/pyppeteer.

I'm not sure if it's feasible to rework the designer to render through Chrome Headless instead of wkhtmltopdf but a hybrid option can be helpful.

If this.full_page_btn.hide() can be removed from print.js the user can benefit from browser printing which works perfectly with the HTML generated and rendered by the designer (and then can print to pdf). We can also have select boxes for every print format to choose which engine renders the print and which engine renders the PDF.

Example: using 'Poppins' from Google Fonts

View from Print Designer Preview / Print / PDF
Screenshot_20240621_013017_Chrome

View from Web (Full Page) / Print & Chrome Headless Generated PDF
Screenshot_20240621_013209_Chrome

@maharshivpatel
Copy link
Collaborator

@yamenzk header footer is the reason i haven't used chrome headless or puppeteer. i had considered it in the past but header footer is restricted in it.

@maharshivpatel
Copy link
Collaborator

@yamenzk browser rendering will not have repeated and or different header / footer

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

No branches or pull requests

2 participants