Created
April 6, 2023 08:16
How to Convert DOCX to XPS using Java. For more information, please follow link: https://kb.conholdate.com/total/java/how-to-convert-docx-to-xps-using-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
import com.groupdocs.conversion.Converter; | |
import com.groupdocs.conversion.licensing.License; | |
import com.groupdocs.conversion.options.convert.ConvertOptions; | |
public class ConvertDOCXtoXPSusingJava | |
{ | |
public static void main(String[] args) { | |
// Set License to avoid the limitations of Conversion library | |
License license = new License(); | |
license.setLicense("GroupDocs.Conversion.lic"); | |
// Import DOCX document | |
Converter converter = new Converter("input.docx"); | |
// Get conversion option for final output document | |
ConvertOptions docxtoxpsconvertoptions = converter.getPossibleConversions("xps") | |
.getSource().getConvertOptions(); | |
// Save the XPS to disk | |
converter.convert("result.xps", docxtoxpsconvertoptions); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment