moodysalem / java-phantomjs-wrapper Goto Github PK
View Code? Open in Web Editor NEWA Java wrapper around the PhantomJS binaries including a packaged HTML to PDF render script
License: MIT License
A Java wrapper around the PhantomJS binaries including a packaged HTML to PDF render script
License: MIT License
On invocation:
PhantomJS.render(null,
new URL("http://www.myUrl.com").openStream(),
PaperSize.A4, ViewportDimensions.VIEW_1280_1024,
Margin.ZERO, BannerInfo.EMPTY, BannerInfo.EMPTY, RenderFormat.PDF, 10000L, 100L);
The html is rendered but without css.
What i'm doing wrong?
[WARNING] PhantomJSSetup was unable to clean up temporary directories under: [D:\babun\.babun\cygwin\tmp\java-phantomjs]. Caused by:
java.nio.file.NoSuchFileException: D:\babun\.babun\cygwin\tmp\java-phantomjs\source-c8ec28df-6b5e-403b-9244-b0cdad298dad
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
at java.nio.file.Files.delete(Files.java:1126)
at com.moodysalem.phantomjs.wrapper.PhantomJSSetup$1.run(PhantomJSSetup.java:202)
The shutdown hoop attempts to delete these dirs:
Files.delete(PhantomJSConstants.TEMP_SOURCE_DIR);
Files.delete(PhantomJSConstants.TEMP_SCRIPT_DIR);
Files.delete(PhantomJSConstants.TEMP_RENDER_DIR);
But I'm not using PhantomJS.render(), only PhantomJS.exec(), so the source and render dirs are never created in the first place. And because the deletion of the source dir fails, the scripts dir does not get cleaned up either.
I have a big project I'd like to use your PhantomJS wrapper for that is currently on Java version 7. The maven artifact you distributed seems to be compiled using Java 8 bytecode, hence it doesn't work on a Java 7 JRE.
I noticed the code uses a few Java 8 language features. I forked your repository and created a version that works with Java 7. Would you be willing to create a distributed version for Java 7?
Also, I forked off of the latest version 2 release. The logging change was causing a dependency conflict on my project (I didn't dig too deep into why), but we could potentially create two pull requests to support version 2 and 3 if that works. The effort is pretty minimal.
Thanks!
hi ... javascript files are not loaded in java-phantomjs wrapper.please tell me how to include js files. it has taken <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script> like this.But it does not take <script src="jquery-3.3.3"></script>.How can i fix this .
I can see timeout is not working
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.