[英]Change orientation of existing PDF document (portrait/landscape)
是否可以将现有文档的方向从“纵向”更改为“横向”,反之亦然?
我尝试使用iText将页面(纵向模式)复制到新创建的页面(横向模式),但是它不起作用,使用了复制页面的页面方向。
这是我使用的代码:
PdfReader originalFileReader = new PdfReader(src);
Document landscapeDoc = new Document(PageSize.A4.rotate());
PdfCopy copy = new PdfCopy(landscapeDoc, new FileOutputStream("/home/user/landscape.pdf"));
landscapeDoc.open();
for (int i = 1; i <= originalFileReader.getNumberOfPages(); i++) {
copy.addPage(copy.getImportedPage(originalFileReader, i));
}
landscapeDoc.close();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.