Created
October 31, 2017 08:10
-
-
Save GroupDocsGists/9789ce7039096afd57b9b0e49408f4e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
// Set add print action property | |
PdfFileOptions options = new PdfFileOptions(); | |
options.setTransformations(Transformation.AddPrintAction); | |
// Get file as pdf with print action | |
FileContainer container = imageHandler.getPdfFile(fileName, options); | |
Utilities.saveAsFile(fileName, container.getStream(), ".pdf"); | |
} catch (Exception exp) { | |
System.out.println("Exception: " + exp.getMessage()); | |
exp.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment