当前位置: 首页>>代码示例>>Java>>正文


Java PDPage.setRotation方法代码示例

本文整理汇总了Java中org.apache.pdfbox.pdmodel.PDPage.setRotation方法的典型用法代码示例。如果您正苦于以下问题:Java PDPage.setRotation方法的具体用法?Java PDPage.setRotation怎么用?Java PDPage.setRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.pdfbox.pdmodel.PDPage的用法示例。


在下文中一共展示了PDPage.setRotation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAlternateRowsDocument

import org.apache.pdfbox.pdmodel.PDPage; //导入方法依赖的package包/类
@Test
public void createAlternateRowsDocument() throws Exception {
    final PDDocument document = new PDDocument();
    final PDPage page = new PDPage(PDRectangle.A4);
    page.setRotation(90);
    document.addPage(page);
    final PDPageContentStream contentStream = new PDPageContentStream(document, page);
    // TODO replace deprecated method call
    contentStream.concatenate2CTM(0, 1, -1, 0, page.getMediaBox().getWidth(), 0);
    final float startY = page.getMediaBox().getWidth() - 30;

    (new TableDrawer(contentStream, createAndGetTableWithAlternatingColors(), 30, startY)).draw();
    contentStream.close();

    document.save("target/alternateRows.pdf");
    document.close();
}
 
开发者ID:vandeseer,项目名称:easytable,代码行数:18,代码来源:TableDrawerIntegrationTest.java

示例2: rotate180

import org.apache.pdfbox.pdmodel.PDPage; //导入方法依赖的package包/类
public ActionForward rotate180(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
	Document doc = documentDao.getDocument(request.getParameter("document"));

	String docdownload = oscar.OscarProperties.getInstance().getProperty("DOCUMENT_DIR");

	FileInputStream input = new FileInputStream(docdownload + doc.getDocfilename());
	PDFParser parser = new PDFParser(input);
	parser.parse();
	PDDocument pdf = parser.getPDDocument();
	int x = 1;
	for (Object p : pdf.getDocumentCatalog().getAllPages()) {
		PDPage pg = (PDPage)p;
		Integer r = (pg.getRotation() != null ? pg.getRotation() : 0);
		pg.setRotation((r+180)%360);

		ManageDocumentAction.deleteCacheVersion(doc, x);
		x++;
	}

	pdf.save(docdownload + doc.getDocfilename());
	pdf.close();

	input.close();

	return null;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:27,代码来源:SplitDocumentAction.java

示例3: rotate90

import org.apache.pdfbox.pdmodel.PDPage; //导入方法依赖的package包/类
public ActionForward rotate90(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
	Document doc = documentDao.getDocument(request.getParameter("document"));

	String docdownload = oscar.OscarProperties.getInstance().getProperty("DOCUMENT_DIR");

	FileInputStream input = new FileInputStream(docdownload + doc.getDocfilename());
	PDFParser parser = new PDFParser(input);
	parser.parse();
	PDDocument pdf = parser.getPDDocument();
	int x = 1;
	for (Object p : pdf.getDocumentCatalog().getAllPages()) {
		PDPage pg = (PDPage)p;
		Integer r = (pg.getRotation() != null ? pg.getRotation() : 0);
		pg.setRotation((r+90)%360);

		ManageDocumentAction.deleteCacheVersion(doc, x);
		x++;
	}

	pdf.save(docdownload + doc.getDocfilename());
	pdf.close();

	input.close();

	return null;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:27,代码来源:SplitDocumentAction.java

示例4: rotate

import org.apache.pdfbox.pdmodel.PDPage; //导入方法依赖的package包/类
public static void rotate(PDDocument doc, PageSelector pages, int degrees) {
	for(PDPage p : pages)
		p.setRotation(degrees);		
}
 
开发者ID:Raudius,项目名称:PrintDF,代码行数:5,代码来源:BookletRotater.java


注:本文中的org.apache.pdfbox.pdmodel.PDPage.setRotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。