com.openhtmltopdf.test.Graphics2DRendererTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openhtmltopdf-core Show documentation
Show all versions of openhtmltopdf-core Show documentation
Open HTML to PDF is a CSS 2.1 renderer written in Java. This artifact contains the core rendering and layout code.
package com.openhtmltopdf.test;
import com.openhtmltopdf.simple.Graphics2DRenderer;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
public class Graphics2DRendererTest {
public static void main(String[] args) throws Exception {
BufferedImage img = Graphics2DRenderer.renderToImageAutoSize(new File("demos/splash/splash.html").toURL().toExternalForm(),
700, BufferedImage.TYPE_INT_ARGB);
ImageIO.write(img, "png", new File("test.png"));
}
}