Load document from URL

Following code snippet shows how to convert a document from URL:

String url = "https://github.com/groupdocs-conversion/GroupDocs.Conversion-for-Java/blob/master/Examples/Resources/SampleFiles/sample.docx?raw=true";
String outputFile = "c:\\output\\converted.pdf";

try {
    InputStream stream = new URL(url).openStream();
    Converter converter = new Converter(stream);
    PdfConvertOptions options = new PdfConvertOptions();
    converter.convert(outputFile, options);

}catch(Exception e){
    throw new GroupDocsConversionException(e.getMessage());
}

© Aspose Pty Ltd 2001-2022. All Rights Reserved.