Load document from URL
Leave feedback
The following code snippet shows how to convert a document from an URL:
import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.exceptions.GroupDocsConversionException;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;
import java.io.File;
import java.io.InputStream;
import java.net.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());
}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.