-
Notifications
You must be signed in to change notification settings - Fork 315
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
Modify PrintPage to use new BrewRenderer methods #3464
Modify PrintPage to use new BrewRenderer methods #3464
Conversation
will review this as soon as i get my hands on a computer |
@@ -152,7 +162,7 @@ const BrewRenderer = (props)=>{ | |||
renderedPages[props.currentEditorPage] = renderPage(rawPages[props.currentEditorPage], props.currentEditorPage); | |||
|
|||
_.forEach(rawPages, (page, index)=>{ | |||
if((isInView(index) || !renderedPages[index]) && typeof window !== 'undefined'){ | |||
if((props.renderAllPages || isInView(index) || !renderedPages[index]) && typeof window !== 'undefined'){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that using !props.frame
as a check to render a page was particularly opaque, so I have introduced a new prop renderAllPages
to make it clearer that all pages will be rendered from the Print Page.
Serious question, why did we agree on keeping this instead of printing from |
I'm not sure I understand the question. Printing is possible from both /edit and /share via the "get PDF" button. Printing HTML to PDF prints the entire page, so you need to somehow generate a separate window/frame. As far as I know you can't just send a single element to the printer. |
Printing HTML to PDF prints the entire page, so you need to somehow generate a separate window/frame. As far as I know you can't just send a single element to the printer. try this: In the brew style tab:
In the dev tools console:
|
Well if that works, that would simplify things a lot. Does it still work with variables across pages? Work with Legacy brews? I'm ok doing that if we can eliminate the whole |
First one for sure, second haven't tried, should work fine |
Issue #2742 tracks printing without print page |
Wow, I don't remember that issue at all, but I guess I was there. Looks like the main concern was keeping existing |
As I recall, the print function didn't trigger a full render so PPR would break the print. I think that's no longer an issue with the changes to Brew Renderer, so the logic may no longer apply. |
Yeah, looks like the |
I am pulling new PR together for this now. |
Closing in favor of #3491 Thanks @G-Ambatte ! |
This PR resolves #3435.
This PR modifies the Print Page to use the BrewRenderer to render the pages for printing. This ensures that the Print Page output will always match the Share and Edit Page visual outputs - previously it used a duplicated section of code that was not updated when the BrewRenderer was changed.
Some modifications have also been made to the BrewRenderer, including the option to not render inside an iFrame (defaults to iFrame on), and a method to indicate to Print Page when the print event should fire (i.e. on completion of document rendering).
iFrame rendering would be preferable but while it is possible to create functions to print the iFrame content directly, I have been unable to get printing via Ctrl+P or selecting Print from the browser menu to work correctly. For this reason, the brew renders outside of a frame on Print Page.