/groupdocs-viewer-net-amazons3

Amazon S3 IInputDataHandler and ICacheDataHandler providers for GroupDocs.Viewer for .NET

Primary LanguageC#MIT LicenseMIT

[Obsolete] GroupDocs.Viewer .NET AmazonS3

This repository is now obsolete and no longer maintained. New version is available at GroupDocs.Viewer.AmazonS3Storage.

Amazon S3 IInputDataHandler and ICacheDataHandler provider for GroupDocs.Viewer for .NET which allows you to keep files and cache in the cloud.

Installation & Configuration

Install via nuget.org

Install-Package groupdocs-viewer-dotnet-amazons3

If you're hosting your project inside EC2 instance IAM access keys already exist inside instance via environment variables. Please check AWS Access Keys best practices article for more information about keeping your access keys sucure.

For the test purposes you can add IAM access keys to your AppSettings in app.config or web.config. (Do not commit your access keys to the source control).

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="AWSAccessKey" value="***"/>
    <add key="AWSSecretKey" value="***"/>
    <add key="AWSRegion" value="us-west-2" />
  </appSettings>
</configuration>

How to use

var amazonS3Config = new AmazonS3Config { RegionEndpoint = RegionEndpoint.USWest2 };
var amazonS3Client = new AmazonS3Client(amazonS3Config);
var amazonBucketName = "my-bucket";

var amazonS3FileManager = new AmazonS3FileManager(amazonS3Client, amazonBucketName);

var viewerDataHandler = new ViewerDataHandler(amazonS3FileManager);

var viewerConfig = new ViewerConfig
{
    EnableCaching = true
};

var viewerHtmlHandler = new ViewerHtmlHandler(viewerConfig, viewerDataHandler, viewerDataHandler);

var pages = viewerHtmlHandler.GetPages("document.docx");

License

GroupDocs.Viewer .NET AmazonS3 is Open Source software released under the MIT license.