-
Notifications
You must be signed in to change notification settings - Fork 974
Refactor contributionStatement.js with Aphrodite #7887
Refactor contributionStatement.js with Aphrodite #7887
Conversation
The brave logo PNG file and the verified SVG icon are not displayed on PDF file. Could I know how to display them? Do I have to inline them? |
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.
Hey @luixxiul,
This looks great. I see two things.
(1) Inline images are required for PDF generation, I think.
At least the final rendered HTML will need images inlined as data URIs for a PDF to be generated properly with existing code. You may be able to keep the data URI in a separate file and require
it as you have done with the images here, though.
(2) Page breaks were lost with this change, need 1 line added to CSS (pageBreakAfter: 'always'
incontributionStatement__page
), see below
js/about/contributionStatement.js
Outdated
// ContributionStatementPage | ||
contributionStatement__page: { | ||
display: 'flex', | ||
flexFlow: 'column nowrap' |
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.
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.
Thanks for your feedback @willy-b! I'll ping you again later.
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.
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 think you fixed this in next commit which was force pushed over this and the previous one, but pageBrakeAfter
here (2f16bbd#diff-dfc3cf3000430cbd1575b0223b06163fR630) should be replaced with pageBreakAfter
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.
Silly mistake.. I updated here: 0164a4d#diff-dfc3cf3000430cbd1575b0223b06163fR630
@willy-b Updated. The files were not displayed because |
Glad it's working for you now. One issue: I still don't see the images in the generated PDF with your latest revision. The footer text also continues to have extra characters in it, which seem to be have been fixed in your latest screenshot. Are you sure that screenshot is of 0164a4d? |
Would you try |
Sure. I just re-installed: Still don't see any images in the generated PDF (which I can attach if you like). |
It looks like you're using the Print dialog manually to print to PDF and open the PDF in preview? That actually works for me too. But what about the auto-popup for saving the PDF that is triggered by current code? That does not work (it uses a data URI internally and so the generated PDF lacks images). (Did you turn this off in your local for making the screencapture?) We could replace that with asking user to use Print -> Print to PDF and choose their own filename. |
Actually I haven't seen it for a while, though I'm running on the latest code. Is it disabled?? |
I see the auto-popup save dialog in a fresh build from your commit 0164a4d : As you can see in my screencap, the images are missing from the downloaded PDF (opened from downloads bar). I wonder why you're not seeing the Download PDF auto-popup dialog anymore? If I do a manual File->Print->Print to PDF of the contribution statement HTML page, as you show in your screencap, then the images are preserved for me too. |
I'm on macOS. Is it related with Muon or something? / CC @darkdh @bsclifton |
I think it related to our 57 upgrade. There will be PREVIEW_FAIL error on both windows and macOS. |
Yeah I see it on macOS! |
@willy-b For me, not displaying the pop up is not that bad; in fact I felt quite natural, since I was not forced to save the statement in PDF. I could save, print, copy or just read through the statement of my own will. I could imagine some would say, "please do not display the save pop up window as it is annoying." |
@luixxiul is this ready for review? or are you still working out a few things? |
Except inlining the PNG and SVG files, it's ready for review. If it is impossible to add the external files with printToPDF, I would inline them. / CC @darkdh |
@willy-b would you please work on the fix? thanks! |
@willy-b sorry I missed your last comment before merging. Please feel free to open an issue, not sure which STR to repro error you mentioned |
no worries @cezaraugusto . quick question: does the final version you merged use inline images or not? |
no inline-images. A fix I can think of is to convert images to base64 before rendering, but feel free to apply any method you find best and lmk if you need anything. Thanks for following-up :) |
btw auto-popup doesn't show on macOS |
it has been mentioned here: #7887 (comment) |
okay so we just broke this, just so we could avoid inline images? fair enough. @darkdh is fixing the popup on MacOS, I think. |
It's been fixed in brave/muon@9d32f7f |
ok, so you're going to restore inline images and reopen #8062 to pull them out once we make them unnecessary? |
@willy-b , I think image problem will also be fixed in that commit |
unfortunately it won't. the image issue is not in Muon. it's in our use of a data URI here: 7c32ef1#diff-dfc3cf3000430cbd1575b0223b06163fR120 |
Closes #7883
Auditors:
git rebase -i
to squash commits (if needed).Test Plan: