GroupDocsGists
10/24/2017 - 1:08 PM

renderdocaspdf.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.setTransformations(Transformation.AddPrintAction);
	
	// Get file as pdf
	FileContainer container = imageHandler.getPdfFile(fileName, options);

	// Save file
	Utilities.saveAsFile(fileName, container.getStream(), ".pdf");

} catch (Exception exp) {
	System.out.println("Exception: " + exp.getMessage());
	exp.printStackTrace();
}