-
Notifications
You must be signed in to change notification settings - Fork 80
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
Issues generating to pdf or saving the table as image #67
Comments
Hi, thanks for the report and examples. I believe the problem is that webshot (via PhantomJS) doesn't support some CSS features that reactable uses -- in particular, flexbox for layout. A beta version of PhantomJS may have supported it, but it looks like that version was abandoned when PhantomJS was discontinued. See ariya/phantomjs#14793 Unfortunately, I don't think there's a good solution other than to wait for webshot2, which uses a more modern browser engine. Using the development version of webshot2, here's the screenshot I get for the example table above: library(webshot2)
webshot(html, "car_table.png") I don't know if webshot2 is ready to use in rmarkdown though - probably not yet. So if possible, I'd recommend using a different table package with better PDF support. edit: Alternatively, you could save an HTML document to PDF with your browser, but you might run into some of the background color issues described in #18. |
Thanks for the answer @glin, I've tried to used webshot2, but I couldn't make it work. Instead, my solution was to use Selenium to take a screenshot of the page. But this approach generated another problem: a lot of whitespace below the table (my table is short). The workaround for that was installing ImageMagick in my PC and calling the command line: "C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\convert" screenshot.png -trim output.png. You need to use the full path because there are other convert programs in windows. I'm not sure this solution will work on the more complex table, but so far, so good. Regarding using a different package, I will stick with reactable. The final result it's much better than the others. Thanks, |
Hi,
Thanks for the awsome package. I'm excited in produce some reports with this tool, but I'm facing some problems in generate pdf from a rmarkdown file with reactable. After getting a lot of errors, I decided to create a simple file to test it.
But the table generated in the PDF from this simple example was shrunk. This is the same behaviour I got when I try to generate an image with webshot package.
This is the simple example:
This is the pdf generated:
Test-reactable-pdf .pdf
In the code bellow I also tried to generate an image from the reactable:
** This is the image with the same issue **
I also copied the Twitter Followers Demo, but I can't even knit to pdf. I got the error below:
Thanks
Eduardo
The text was updated successfully, but these errors were encountered: