java GetOriginalPdfDocWithTransformation.java
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java GetOriginalPdfDocWithTransformation.java相关的知识,希望对你有一定的参考价值。
// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java
try {
// Setup GroupDocs.Viewer config
ViewerConfig config = Utilities.getConfiguration();
// Create image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
PdfFileOptions options = new PdfFileOptions();
options.setGuid(fileName);
RotatePageOptions rotateOptions = new RotatePageOptions(1, 90);
imageHandler.rotatePage(fileName, rotateOptions);
// Set apply rotate and reorder transformations
options.setTransformations(Transformation.Rotate);
Watermark watermark = new Watermark("Watermark text.");
watermark.setColor(Color.blue);
watermark.setPosition(WatermarkPosition.Diagonal);
watermark.setWidth(100f);
options.setWatermark(watermark);
// Get file as pdf with transformations
FileContainer container = imageHandler.getPdfFile(options);
// Save file
Utilities.saveAsFile(fileName, container.getStream(), ".pdf");
} catch (Exception exp) {
System.out.println("Exception: " + exp.getMessage());
exp.printStackTrace();
}
以上是关于java GetOriginalPdfDocWithTransformation.java的主要内容,如果未能解决你的问题,请参考以下文章
Java 布尔运算
java [Java] Java常用代码#java
Java - 35 Java 实例
Java While 循环
Java 字符串
Java If ... Else