-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
Function to export slides to PDF? #168
Comments
I would vote for the |
+1 |
I would love this feature as well! Since xaringan's html is "not so" self-contained, I prefer a pdf from time to time. |
I've just started using the decktape method which works well: system("`npm bin`/decktape remark file.html file.pdf") It would be great if this was built in somehow. Side question: does anyone know how to make decktape use the print CSS class? Perhaps @pat-s @zhouyisu knows? This would let me fully replace manually opening the HTML file in Chrome and printing to pdf. |
I also use decktape to circumvent the glitches that can occur when printing to pdf from the browser. I've decktape installed on the computer and use the following script to convert
|
I started yesterday but it seems a bit complicated. While everything works when using the terminal, all R integrations of docker (stevedock, harbor) or simply the So I went with the simple I think documentation is the key here. Stay tuned! |
If you have a recent version of Google Chrome or Chromium installed, you may try the pagedown package: remotes::install_github('rstudio/pagedown')
pagedown::chrome_print('any-file.html') From my quick testing, MathJax and HTML widgets don't seem to work well. |
* add PBSmodelling to suggests, tidy * glue = suggests * NS * add export_pdf * add test * update .Rproj * re-add license * glue -> sprintf PBSmodelling -> animation * update doc * use roxygen markdown, revert to old DESC structure * delete test * Update xaringan.Rproj * install libmagick on travis * import auto_browse from animation pkg * no defaults for xaringan_path and pdf_path * only one system() call to docker * shorten SO link * remove magick dep from travis * export_pdf -> decktape() * revert roxygen markdown change * update man & NS * remove animation from suggests * fix auto_browse() * also support the local decktape library if it has been installed, so that users don't have to install Docker * add a news item for #177 * note that file could be a URL when not using Docker
A |
hi Yihui,
This is documented https://github.com/astefanutti/decktape (2nd error) and passing the extra args from the command line works(*) for me
(*) I say works, but not quite. The italics text in my slides are missing -- I will come up with a minimal example for this. |
AFAIK the local For example, on Arch I usually need the arg If the default arg added does no harm to other users (we'll see) we can keep it. But I would advise against adding more and more default args that may help other people in the future. In general, I would recommend the docker version of |
Do we have other options besides decktape? the dependencies seem to be too heavy for a simple feature like "exporting to pdf" |
I wrote a simple wrapper function remotes::install_github('rstudio/pagedown')
pagedown::chrome_print('https://slides.yihui.name/xaringan/') Exporting to PDF sounds like a simple feature, but it can be extremely complicated. The complication comes from the fact that it is hard to know when a page is ready to be printed when the page contains JavaScript code, because JavaScript can modify the DOM, and the browser has to wait until the DOM is stable. Decktape must have used certain remark.js events to know when the page has been fully processed by remark.js. |
Thanks - just trying pagedown. It mostly works:
does pretty well, but the italics (e.g. on slide 7) and mathjax are missing from the pdf. This is on mac, viewing the pdf in preview: happy to help test/debug. source of slides are at: https://github.com/sje30/2018-12-07-rmd |
@sje30 I'm not surprised by the result. We need to wait for rstudio/pagedown#30 to be merged for a more stable |
remotes::install_github(c('rstudio/pagedown', 'yihui/xaringan')) Note that at this moment, the PDF is created asynchronously, and it may surprise you that the PDF file comes a few seconds later after |
Thanks; see #193 for a minor typo though (DESCRIPTION has version "0.8." rather than presumably 0.8 |
Fixed now. Thanks! BTW, the issue with |
Thanks. Does it now fix the italics issue I raised? (See above). It doesn't for me when I do this:
|
Did you regenerate that webpage unsing the latest xaringan release so that
it's using the updated CSS?
…On Sat, 9 Feb 2019 at 6:39 am, Stephen Eglen ***@***.***> wrote:
Thanks. Does it now fix the italics issue I raised? (See above). It
doesn't for me when I do this:
pagedown::chrome_print('https://sje30.github.io/talks/2018/rmd-intro.html')
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#168 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACFnTtKc2NuzOSdR4CTGx9wGy59nGKi7ks5vLdJYgaJpZM4W8K9t>
.
|
Thanks, yes, I did an install of pagedown and xaringan. does the italics work for you? The only change I made is on my laptop, I have to add |
sorry, I misunderstood. No, I haven't remade the .html file. Let me try that now! |
It seems you have regenerated the HTML page: sje30/sje30.github.io@e6f3764 I just tested it. The italic text and MathJax expression are no longer missing: |
Thanks for testing it! Yes, I was just in the process of updating and telling you. Thanks for taking the time on this. I appreciate it. |
Hello,
Does anyone know what this could be? I'll appreciate any comment |
@MadNietzsche Please see rstudio/pagedown#68. |
Thanks for this feature-- I annotate slides in class on my ipad so the pdf conversion is very useful! I was wondering if incremental bullet points are supported in any of the pdf conversion tools? It would be awesome if incremental bullets were split across slides when converting to pdf (i.e. the way beamer handles incremental bullets). |
@afranks86 It is possible, but please file a new issue or ask questions in public forums instead of replying to a closed issue. It feels stressful when an issue can never been truly closed... |
FYI, I've been working on a package that builds xaringan slides to multiple output types: html, pdf, pptx, gif, and a couple options for a png of the first slide: |
With all the different tools and confusion going on about this topic, I am wondering if we should add a function that takes care of this.
I we can agree on one tool, its much easier for users to use this function rather than reading all the recommendations in the wiki.
I would vote for
decktape
which produces perfect PDF outputs (no shifts, no misalignments). I use it sincexaringan
exists.There is a hosted docker version that we could use.
However, ofc the user needs to have
docker
installed then.Or we could add a switch in case the user has installed
decktape
locally.Additionally, the function could open the produced PDF after is has been created.
I got a function for personal use but implementing it into the package would inflict some additional work ofc.
Let me know what you think :)
The text was updated successfully, but these errors were encountered: