Load document from FTP

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Signature MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-signature -- dnx GroupDocs.Signature.Mcp --yes
Folders, licensing and more →

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");
                options.setEncodeType(QrCodeTypes.QR);
                options.setLeft(100);
                options.setTop(100);
 
 
                // 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();
   client.connect(server);
   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 Java 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.