Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

New PDF export issue #808

Closed
trws opened this Issue · 24 comments
@trws

I have been using, and loving, reveal.js and the pdf export functionality for a couple of weeks now, but something strange started happening yesterday, I think after a chrome update (I'm currently running Google Chrome version 33.0.1750.117). The issue is that the currently selected slide prints to pdf fine, but several slides before or after it end up blank or with just the background. After some number of slides it starts working as expected again. Just to check and see if it was my local copy somehow being corrupted, I printed the example presentation from the official site, and got this.

https://www.dropbox.com/s/hg4hloglims45sp/reveal.pdf

There are no errors in the javascript log, and everything looks normal except printing. I'm at a loss, any thoughts on how I might debug this?

@hakimel
Owner

Seeing this too, I suspect you're right that this is related to a browser update.

@aitjcize

same problem here!

@fehmer

+1

@krimple

I have this problem - I use my own theme, and I get several blank pages where pages should be. I can sort of print in FireFox but it truncates the text.

@trws

If any of you have Safari available, it seems to at least work. Not ideally mind you, it inserts a blank slide between each slide and the next, but at least it renders them all.

@hakimel
Owner

Tracked this down. It's related to how the pdf stylesheet gets included. A temporary workaround is to replace the following lines in the <head> before printing:

<script>
    document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>

with

<link rel="stylesheet" href="css/print/pdf.css">
@hakimel
Owner

This issue has been fixed in master.

PDF printing in Chrome 33 did not work correctly so long as media="print" was defined on the dynamically inserted PDF stylesheet. The media definition has been removed which should be fine since the styles are only included when the page is loaded with ?print-pdf anyway.

@hakimel hakimel closed this
@aitjcize

Thanks for the quick fix!

@trws

Works for me, thank you.

@krisajenkins krisajenkins referenced this issue from a commit in krisajenkins/org-reveal
@krisajenkins krisajenkins Fixing a bug with export to PDF.
Chrome 33 caused (revealed?) a bug in the PDF export code. This was
fixed in reveal.js issue 808:

 hakimel/reveal.js#808

This commit mirrors that fix for org-reveal.
578d69d
@krisajenkins krisajenkins referenced this issue in yjwen/org-reveal
Closed

Fixing a bug with export to PDF. #44

@rctay rctay referenced this issue from a commit in rctay/pandoc-templates
@rctay rctay revealjs: backport hakimel/reveal.js@08fb6cb to fix printing in Chrom…
…e 33 (hakimel/reveal.js#808)

The fix involves removing the media definition of print on pdf.css, ie.
applying pdf.css in a blanket fashion, so pdf.css has to be inserted via
JavaScript (when ?print-pdf is in the url). Hence the JavaScript.
28922bf
@laughedelic laughedelic referenced this issue from a commit in era7bio/pandoc-revealjs-slides
@laughedelic laughedelic Fixing pdf-export. See hakimel/reveal.js#808 8cb3325
@aaronbloomfield aaronbloomfield referenced this issue from a commit in aaronbloomfield/pdr
@aaronbloomfield aaronbloomfield Updated to the latest reveal.js (1:15 am on 3-19-14), which fixed a b…
…ug (hakimel/reveal.js#808) that prevented printing with the latest Chrome; note that css/themes/default.css was left as was due to the different paths (and it wasn't modified anyway)
6d7b477
@nbren12 nbren12 referenced this issue from a commit in nbren12/org-reveal
@nbren12 nbren12 fixed pdf export issue 5c970d1
@nbren12 nbren12 referenced this issue from a commit in nbren12/org-reveal
@nbren12 nbren12 fixed pdf export issue
I implement the fix in hakimel/reveal.js#808 exactly.
This commit requires the use of a ?print-pdf modifier to the URL as detailed in
the issue above.
a02e083
@nbren12 nbren12 referenced this issue in yjwen/org-reveal
Merged

fixed pdf export issue #48

@davidlt

Still fails on Chrome dev channel (version 35).

@hakimel
Owner

I tried printing lab.hakim.se/reveal-js using Chrome 35.0.1914.0 and that works.

@davidlt

I was testing on Introduction to MATLAB example. lab.hakim.se/reveal-js works.

@Kabouik

Pdf-export of my own slides fails with Chrome 33.0.1750.154 version too. lab.hakim.se/reveal-js seems to work properly here too.

Cannot share my presentation for professional reasons however, so my comment might not help finding the issue, but it's just to confirm there are some issues.

@hakimel
Owner

Those of you who are still having issues, please make sure that the fix I committed above (08fb6cb) has been merged into your local index.html.

@Kabouik

Awesome, it (mostly) works. Thanks and sorry I missed it Hakimel.

I still have issues with div superimposing with stuff, but that's due the way I conceived my slides with animation of elements disappearing and being replaced by others.

Is there any way to create a "pdf slide" for every data-fragment-index value within a section? That would decompose every "animation" in new slides. It would solve such issues, and overall the PDF exports would be closer to the actual reveal.js presentations (fragments would be mimicked).

@dpashkevich

Is there any way to create a "pdf slide" for every data-fragment-index value within a section? That would decompose every "animation" in new slides. It would solve such issues, and overall the PDF exports would be closer to the actual reveal.js presentations (fragments would be mimicked).

Would love to see that too

@kevinkenan kevinkenan referenced this issue in jgm/pandoc
Closed

PDF Save in revealjs broken #1220

@nategood

Printing the example "lab.hakim.se/reveal-js" presentation is broken for me in current latest Chrome (Version 35.0.1916.114 beta), FireFox (29.0.1), and Safari (Version 7.0.2 (9537.74.9)).

I see no styling at all. Just plain un-styled text. In some cases it is so broken that I just get blank pages.

I'm wondering if there isn't a stabler means of printing than relying on print media for something this complicated. I recall hearing @mbostock talking about a project they built at NYT that I believe used PhantomJS among other things to take browser snapshots of each commit in a git repo. Maybe something similar can be done to make a more stable solution? Spitballing here, but the current option seems fairly unreliable.

@dpashkevich
@mbostock

(FWIW, we don’t use PhantomJS; I wrote a Chrome extension which uses captureVisibleTab and produces higher-fidelity screenshots.)

@nategood

Aha! Thanks Dmitry. Not sure how I missed that in the thread.

@willbuck willbuck referenced this issue in slara/generator-reveal
Closed

Font issue #53

@jashmenn

@mbostock Is that extension open-source by chance? I'd love to try it out.

@mbostock

@jashmenn No, sorry; it’s tied to our workflow rather than generalized so it wouldn’t make sense to open-source. But it’s just a few lines of JavaScript to call captureVisibleTab and save the PNG to the downloads folder.

@Kabouik

Any comment on the idea of exporting a PDF page for every value of data-fragment-index? It would result in decomposing animations in distinct slides and thus solve issues like superimpositions and disappearance of fragments, and overall allow the PDF export to better mimick the HTML presentation. I don't know if this idea is being considered, I just suggested it a few months ago, but still face some issues when exporting my presentations in PDF with the current system so just asking again naively!

@nategood
@enovajuan enovajuan referenced this issue from a commit in enovajuan/reveal.js
@hakimel fix pdf print bug in chrome 33 #808 ec2582e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.