我正在研究Adobe Postscript的工具,并试图找到一种方法来生成具有多个方向的文档。多页面方向 - Adobe Postscript的工具
例子:
第1页的方向是纵向,和第2页的方向为横向。
下面我尝试创建一个新页面,然后将页面尺寸设置为与以前相反,以使高度变为宽度,宽度变为高度 - 有效地创建横向视图。然而,这不起作用,我想知道是否有办法做到这一点。
OutputStream out = new java.io.FileOutputStream(outputFile);
out = new java.io.BufferedOutputStream(out);
try {
//Instantiate the EPSDocumentGraphics2D instance
PSDocumentGraphics2D g2d = new PSDocumentGraphics2D(false);
g2d.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());
//Set up the document size
g2d.setupDocument(out, pageWidthPT, pageHeightPT);
g2d.setFont(new Font(font, Font.PLAIN, fontSize));
g2d.drawString(" !", 10, 10);
g2d.nextPage();
g2d.setViewportDimension(pageHeightPT, pageWidthPT);
g2d.drawString("Hello World!", 10, 20);
System.out.println("Creating the document");
g2d.finish();//Cleanup
} finally {
IOUtils.closeQuietly(out);
}
当您尝试使用您提供的代码,会发生什么? – liquidsystem