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.Annotation 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-annotation -- dnx GroupDocs.Annotation.Mcp --yes
Folders, licensing and more →

On this page

The following code snippet shows how to annotate document from FTP:

// This example demonstrates loading document from FTP.

String filePath = "sample.pdf";
String server = "localhost";

// Create an instance of Annotator class and create connection and return stream with document
Annotator annotator = new Annotator(getFileFromFtp(server, filePath));
try {
    
    // Create an instance of AreaAnnotation class and set options
    AreaAnnotation area = new AreaAnnotation();
    area.setBox(new Rectangle(100, 100, 100, 100));
    area.setBackgroundColor(65535);
    
    // Add annotation and save to file
    annotator.add(area);
    annotator.save("OutputPath");
} finally {
    if (annotator != null) {
        annotator.dispose();
    }
}

//...

private static InputStream getFileFromFtp(String server, String filePath) throws IOException {
    FTPClient client = new FTPClient();
    client.connect(server);
    InputStream inputStream = client.retrieveFileStream(filePath);
    client.disconnect();

    return inputStream;
}

On this page