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

Convert to PDF silently #15

Open
tduchateau opened this issue Nov 3, 2014 · 4 comments
Open

Convert to PDF silently #15

tduchateau opened this issue Nov 3, 2014 · 4 comments

Comments

@tduchateau
Copy link

Hi,

I'm currently using deck2pdf on Windows 8.1 to convert Deckjs slides to PDF, and it works great!
I was just wondering if there's a way to use deck2pdf silently, i.e. without displaying a JavaFX window. Is it possible?

Thanks!

Regards,
Thibault.

@mojavelinux
Copy link
Contributor

On a related note, is it possible to convert with an X server, such as inside a Docker container? I haven't tried it yet, but just curious if others have experience.

@mojavelinux
Copy link
Contributor

I was able to get this to work using the Headless mode of Monocle, but the setup is a bit messy atm.

First, I downloaded the Monocle jar from here:

http://search.maven.org/#artifactdetails%7Corg.jfxtras%7Copenjfx-monocle%7C1.8.0_20%7Cjar

Next, I put the jar into the jre/lib/ext folder of the Java 8 installation I am using (oracle64-1.8.0.40-ea-b15). (I'm not sure how to get it to work if it's just on the classpath...it can't seem to find the MonoclePlatformFactory class in that case).

Next, I added the following default JVM options to the deck2pdf launch script in the dist:

DEFAULT_JVM_OPTS="-Dglass.platform=Monocle -Dmonocle.platform=Headless -Dprism.order=sw"

(I suppose we need to add these to the build.gradle file somewhere).

Finally, I ran deck2pdf and verified that it does not show a JavaFX window. It does still report the slides as it is exporting to the console. (I think that information should only show if verbose mode is enabled).

Ideally, we could wrap all this up into a simple --headless option to the application.

You can find more information about monocle in the GitHub repository: https://github.com/TestFX/Monocle

@mojavelinux
Copy link
Contributor

There is a documented way to get Monocle to work without messing with the jre/lib/ext folder on the jfxtras.org homepage (search for Monocle). However, when I tried to implement that, it caused the JVM to crash (using oracle64-1.8.0.45).

A much simpler way, and perhaps the way we can document in the README in the short term) is to invoke the command that calls deck2pdf with xvfb-run. This only works for *nix systems that have xvfb (X virtual frame buffer).

xvfb-run deck2pdf slides.html

@mojavelinux
Copy link
Contributor

For the record, here's a gist that contains the code I was trying to use to implement a headless mode directly in deck2pdf.

https://gist.github.com/mojavelinux/593f5a56381507bca46f

Here are the settings for calling deck2pdf this way (from Gradle):

main = 'me.champeau.deck2pdf.HeadlessMain'
jvmArgs = ['-Djavafx.monocle.headless=true', '-Dprism.order=sw']

As I mentioned, though, this causes a JVM crash in my latest tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants