Created
June 23, 2011 20:57
-
-
Save keiono/1043609 to your computer and use it in GitHub Desktop.
Create Empty PDF on OSGi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Rectangle pageSize = PageSize.LETTER; | |
final Document document = new Document(pageSize); | |
OutputStream os = new BufferedOutputStream(new FileOutputStream("itextTest2.pdf")); | |
final PdfWriter writer = PdfWriter.getInstance(document, os); | |
document.open(); | |
final PdfContentByte canvas = writer.getDirectContent(); | |
final float pageWidth = pageSize.getWidth(); | |
final float pageHeight = pageSize.getHeight(); | |
final DefaultFontMapper fontMapper = new DefaultFontMapper(); | |
final Graphics2D g = canvas.createGraphics(pageWidth, pageHeight); | |
g.dispose(); | |
document.close(); | |
os.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment