[英]Why isn't PDFBox printing a document using landscape orientation?
我在打印橫向文檔時(doc.width > doc.height)
問題(doc.width > doc.height)
。 我對肖像沒有問題。 我正在使用PDFBox 1.8.2庫。 即使我像在此博客中手動設置橫向模式,它也會以縱向打印文檔。 在PDFBox項目中,有幾個關於此問題的已關閉的JIRA錯誤 。 如何打印橫向?
注意:我添加了額外的PDF庫標記來標記這些庫的用戶,以查看這些庫中是否存在此問題。
博客文章中的代碼:
Version : PdfBox-1.7.1
PDDocument doc = PDDocument.load(psStream,true);
if (printService != null) {
PrinterJob pj = PrinterJob.getPrinterJob();
pj.defaultPage();
pj.setCopies(Integer.parseInt(finalnumberOfCopies));
pj.setPrintService(printService);
pj.setPageable(new MyPDPageable(doc,pj));
// don't use doc.silentPrint(pj) but pj.print() ...
pj.print();
}
grepcode.com上的這個例子對我有用 。 總而言之,它首先將縱向頁面旋轉90度以獲得橫向方向,然后使用concatenate2CTM方法來類似地旋轉contentStream。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.