The following code snippet shows how to convert a document from FTP:
importcom.groupdocs.conversion.Converter;importcom.groupdocs.conversion.exceptions.GroupDocsConversionException;importcom.groupdocs.conversion.options.convert.PdfConvertOptions;importjava.io.InputStream;importjava.net.URL;/**
* This example demonstrates how to convert document downloaded from FTP.
*/publicclassLoadDocumentFromFtp{publicstaticvoidrun(){// Use ftp://user:password@host/path for servers that require authentication.
// The ";type=i" suffix requests binary (image) transfer mode.
StringftpUrl="ftp://ftp.example.com/sample.doc;type=i";StringconvertedFile="C:\\output\\converted.pdf";try(InputStreamstream=newURL(ftpUrl).openStream();Converterconverter=newConverter(()->stream)){PdfConvertOptionsoptions=newPdfConvertOptions();converter.convert(convertedFile,options);}catch(Exceptione){thrownewGroupDocsConversionException(e.getMessage());}System.out.println("\nSource document converted successfully.\nCheck output in "+convertedFile);}}
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.
Ask AI
Ask anything about this page — the answer is based on its content.
Searching the docs and writing an answer…
Something went wrong while getting an answer. Please try again in a moment.