Load document from FTP

Following example demonstrates how to process documents from FTP.

public static void run()
        String server = "ftp.example.com";
        String filePath = "sample.doc";
        String outputFilePath = new File(Constants.OutputPath, "SignFromStream//signedSample.doc").getPath();
        try {
            InputStream stream = getFileFromFtp(server,filePath);
            Signature signature = new Signature(stream);
                QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith");
                // sign document to file
                signature.sign("signedSample.doc", options);
            System.out.print("\nSource document signed successfully.\nFile saved ");
    }catch(Exception e){
        throw new GroupDocsSignatureException(e.getMessage());
private static InputStream getFileFromFtp(String server, String filePath) throws Exception
   FTPClient client = new FTPClient();
   return client.retrieveFileStream(filePath);

More resources

GitHub Examples 

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App 

Along with full-featured .NET library we provide simple, but powerful free Apps.
You are welcome to eSign PDF, Word, Excel, PowerPoint documents with free to use online GroupDocs Signature App.