Related Article(s):
Last active
January 28, 2023 13:33
-
-
Save GroupDocsGists/7e0d36b77775de925ed754afa409b42a to your computer and use it in GitHub Desktop.
View Word Documents as PDF in Java
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
// How to view Word Documents as PDF in Java | |
import com.groupdocs.viewer.Viewer; | |
import com.groupdocs.viewer.options.PdfViewOptions; | |
... | |
try (Viewer viewer = new Viewer("path/document.docx")) | |
{ | |
viewer.view(new PdfViewOptions("path/Word-Document.pdf")); | |
} |
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
// How to view Word Documents as Protected PDF & Deny Printing in Java | |
import com.groupdocs.viewer.Viewer; | |
import com.groupdocs.viewer.options.PdfViewOptions; | |
import com.groupdocs.viewer.options.Permissions; | |
import com.groupdocs.viewer.options.Security; | |
... | |
Security security = new Security(); | |
security.setDocumentOpenPassword("opening-pass"); | |
security.setPermissionsPassword("permission-pass"); | |
security.setPermissions(Permissions.ALLOW_ALL ^ Permissions.DENY_PRINTING); | |
PdfViewOptions viewOptions = new PdfViewOptions("path/Word-Document.pdf"); | |
viewOptions.setSecurity(security); | |
try (Viewer viewer = new Viewer("path/document.docx")) | |
{ | |
viewer.view(viewOptions); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment