Skip to content
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

PDF export: Add option to create one PDF page per fragment #1584

Closed
flying-sheep opened this issue May 9, 2016 · 5 comments
Closed

PDF export: Add option to create one PDF page per fragment #1584

flying-sheep opened this issue May 9, 2016 · 5 comments
Labels

Comments

@flying-sheep
Copy link
Contributor

flying-sheep commented May 9, 2016

This can’t be done using just CSS.

We would need to enumerate the fragments for each slide and determine their order (indices) as normal.

but then, for the CSS export, we would need to do sth. like this:

const fragmentIndices =
    toArray(sortFragments(currentSlide.querySelectorAll('.fragment')))
    .map((f, i) => i)

let lastSlide = currentSlide
for (const i of fragmentIndices) {
    lastSlide = lastSlide.parentNode.insertBefore(
        lastSlide.cloneNode(true),
        lastSlide.nextSibling)

    const fragments = toArray(lastSlide.querySelectorAll('.fragment'))
    for (cost fragment of fragments.slice(0, i+1) {
        fragment.classList.add('.visible')
    }
}
@falexwolf
Copy link

Yes, this would be very helpful to have.

@ghost
Copy link

ghost commented Nov 15, 2016

It would indeed be a very appreciated feature for times when you are forced to export your slides to PDF when you are not given the option to present using your own computer and there is no Internet connection, as is the case for me personally tomorrow. There is a hack posted on the issue tracker to get around this current limitation, but it is far from optimal as it exports every slide as an image.

@ThomasWeinert
Copy link
Contributor

ThomasWeinert commented Aug 15, 2017

I implemented that function into a plugin. Not fully tested yet, so I would be thankful for feedback.

https://github.com/ThomasWeinert/reveal-print

@bnjmnt4n
Copy link
Collaborator

This seems like a pretty good idea, although having to duplicate nodes might cause additional side effects. I think this should belong in a plugin for now: any other opinions?

@hakimel
Copy link
Owner

hakimel commented Jun 11, 2018

This was added in #1955 which has been merged into the dev branch.

I like this as the default behavior since it better mimics how fragments work. That said, there's a config option for disabling it if you want the old behavior.

@hakimel hakimel closed this as completed Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants