-
Notifications
You must be signed in to change notification settings - Fork 426
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
Report Sidebar #17
Comments
I am not sure what your project looks like, but to get a sidebar using |
@Zulko I cloned from the report example so my .scss file is exactly like the example. The example-generated PDF file contains the sidebar on every page, but using the .pug in atom (along with the relaxed ./report.pug) it generates a PDF with the sidebar on the first page only. Can you take a quick look at using the example provided for report> |
oh i get it. I'll have a look |
@Zulko Thank you very much! Looking forward to writing a report for my research paper for school. Thanks for your time, cheers! |
It works on my machine (and it is really a feature I use even with other frameworks, like in Python, so I believe it is robust). I'm not sure how to troubleshoot this. If you open the ".htm" file produced, in your browser, do you see the side bar as fixed ? |
@Zulko I tried installing this on my Desktop and still have the same results with the .pdf. As for the .htm page, the sidebar is on the left and doesn't move when scrolling. I'm using Windows 10 with the latest version of NPM. If I manually use puppeteer to print the PDF using the commands below, I still get the same result: `
` |
@Zulko I also just tried installing this on a new Ubuntu Desktop VM with everything updated. Same results are produced for me. |
I have the same issue, and it seems to be related to versions of Puppeteer > 1.0.0 Not sure if it's related to puppeteer or the updated chromium version. |
Thanks @benperiton , this is very bad news, I love that sidebar, and the general idea to "watermark" every page with a constant element. My best guess is that there was a change in the way the most recent versions of Chromium print PDFs. That would be sad. For instance Weasyprint (for python) also considers that "position: fixed" elements should appear on every page. Last resort, I'll freeze pupetteer to 1.0, but I'm not sure if it could clash with other libraries in global installs. |
Having a little play, it seems it is related to
If those are removed, then the 'watermarking' works fine - as in it appears on every page. |
Sounds less desperate than I thought. Thanks for finding that there are rendering differences in the most recent versions of puppeteer, hopefully they can all be fixed by amending the CSS. |
Seems like something changed in Chromium. There's probably a way to fix the rotate transform with some funky css options, but that's not really my strong point so I'll leave that for someone else :) In the meantime, I have it working for me using an older version of Chromium. Puppeteer 1.0.0 Puppeteer 1.2.0 Puppeteer 1.3.0 All Puppeteer versions work as long as the Chromium version is 526987, which in theory should be possible with:
However, that seems to not work correctly: puppeteer/puppeteer#2490 |
@benperiton @Zulko Thank you for looking into it more. Even when installing Puppeteer 1.0.0, I still cannot get the sidebar to be on every page. I tried commenting out those two lines you mentioned as well, and the sidebar side not appear where it normally did, nor did it look good. |
I believe what @benperiton meant is that, when you remove these two lines, despite not looking good (because it is not rotated), the sidebar at least appears on every page . Can you confirm that ? |
@Zulko For me, the sidebar appeared half way between the first page and the second page, but it was centered horizontally at the bottom of the page despite being cut off mostly. Also, the second page only included like 20% of the sidebar, and everything else was cut off. |
Yep. @FlowOverFail So with a fresh clone from here, and a clone of the examples repo, start up
Save it and then open the pdf and at the bottom of each page there is a pink area - that is the sidebar but obviously not rotated. Did you remove the package-lock.json and node_modules, edit the package.json to be Otherwise you can try doing the PUPPETEER_CHROMIUM_REVISION thing and then modifying the puppeteer Luancher.js to accept it. |
@FlowOverFail That is because the styles are set for it being rotated, in order to get it to display properly, you either need to use an older version, or create a new style that doesn't use |
@benperiton I manually installed puppeteer 1.0.0 using NPM via CMD. Are you saying that I'll need to "remove the package-lock.json and node_modules, edit the package.json to be "puppeteer": "1.0.0" then npm install" in order to use the sidebars as they were intended? Is manually installing puppeteer 1.0.0 not sufficient enough? Using NPM list only shows 1.0.0. Edit: I followed your instructions and was able to produce the results I want now. Thank you very much! |
I had a look and it looks to me like a Chromium bug: fixed elements will appear on every page, unless they have a https://bugs.chromium.org/p/chromium/issues/detail?id=839424 |
So it is indeed a bug from Chromium 67. It is unclear how easy it can be fixed on their end, but they proposed a workaround using |
Closing this as the changes in the examples repo removes the problem. |
When using the: ".report-sidebar: p [Text-Here]" I am unable to get the sidebar on the second page of the PDF. I used Git to clone the example and worked straight from there.
Any help would be appreciated, thanks!
The text was updated successfully, but these errors were encountered: