我正在研究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