Free Support Forum - groupdocs.cloud

GroupDocs Cloud + .NET Core 2.1 + AWS S3


#1

Hi,
We’re are trying to evaluate GroupDocs Viewer Cloud for our application. Our application consists of UI (Angular 7) with API (.NET Core 2.1) and we use aws s3 for our file storage. We have the following scenario questions and would appreciate if you could provide the answers to them.

It looks like the only option for us is to use CURL and not with SDK for cloud as you only have support for .NET Framework. When we look at your CURL operation for Creating View With HTML View Format, (https://docs.groupdocs.cloud/display/viewercloud/Working+With+Viewer+API) we noticed that we need to pass access token and file path

  1. where do we get the access token from?
  2. where does the file path point to? if we use aws s3 for our file storage, we’re not sure how we link that this file path.

Thank you


#2

@hoaflynn

Thanks for your interest in GroupDocs.

Please use following cURL command to get token after free sign up with groupdocs.cloud and get App Key and App SID.

curl "https://api.groupdocs.cloud/connect/token" -X POST -H "content-type: application/x-www-form-urlencoded" --data "grant_type=client_credentials&client_id=xxxx-xxxx-xxxx-xxxx-xxxxxxxx&client_secret=xxxxxxxxxxxxxxxx" -o "token.txt"

Please configure Amazon S3 storage to use it with GroupDocs Cloud REST APIs. You can pass configured storage name in cURL command as StorageName parameter. For File path question, if you do not pass foldername then path points to the root of storage otherwise respective folder. For example, viewerdocs/one-page.docx points to file one-page.docx in the viewerdocs folder.

We will check the options to support .NET Core and will guide you accordingly.


#3

@hoaflynn

We have logged a ticket VIEWERCLOUD-283 for the support of .NET Core support in GroupDocs.Viewer SDK for .NET. We will notify you as soon as it is resolved.


#4

Thanks Ahmad for your quick response. Following your instructions, we were able to obtain an access token and use it to Create View With HTML View Format for a file we have on aws s3 bucket. We ran into a bit of a problem and need further assistance.

When we create the html view by calling the api
(https://docs.groupdocs.cloud/display/viewercloud/Working+With+Viewer+API), we get back the following result:
{“pages”:[{“number”:1,“resources”:[],“path”:“viewer/file_name/p1.html”,“downloadUrl”:“https://api.groupdocs.cloud/v2.0/viewer/storage/file/viewer/file_name/p1.html"}],“attachments”:[],"file”:null}

we then extract the download url to get html rendering by calling the rendering api (https://docs.groupdocs.cloud/display/viewercloud/Rendering+Document+to+Responsive+HTML) using the downloadUrl we get from the previous call as follows:
curl -v “https://api.groupdocs.cloud/v2.0/viewer/storage/file/viewer/file_name/p1.html?embedResources=true&enableResponsiveRendering=true” -X GET -H “accept: application/json” -H “authorization: Bearer access_token” -H “Content-Type: application/json”
we get the following error:
{“Error”:{“Code”:“errorAmazonS3Storage”,“Message”:“AmazonS3 Storage exception: The specified key does not exist. Bucket ‘gfc-filestorage’, FilePath ‘20238/d604e3b8-df10-4cca-b966-ed36c5f1211e/viewer/aha-email_msg/p1.html’”,“Description”:“Operation Failed. The remote server returned an error: (404) Not Found.”,“InnerError”:{“RequestId”:null,“Date”:“2019-04-01T20:46:01.128416Z”}}}* Connection #0 to host api.groupdocs.cloud left intact

My questions are:

  1. Are we following the correct flow here for our application setup (angular 7 + .net core web api + aws s3)?
  2. If yes, what did we do wrong here?

Thanks,


#5

@hoaflynn

We are sorry for your inconvenience. You are following correct path, but file download option is not working as expected. We have logged tickets following tickets for investigation and resolution. We will notify you as soon as these are updated.

VIEWERCLOUD-284: Download error
VIEWERCLOUD-285: Responsive Rendering error


#6

@tilal.ahmad, thank you for your response. We have additional questions below:

  1. Is there a way for us to configure multiple aws buckets in your system grammatically say via an api call?
  2. Is there a way for us to get a preview of the html view (a thumbnail preview of the first html page) using a CURL operation ?
  3. We try the following CURL operation to try to generate an image view

curl -X POST “https://api.groupdocs.cloud/v2.0/viewer/view” -H “accept: application/json” -H “authorization: Bearer access_token” -H “Content-Type: application/json” -d “{ “FileInfo”: { “FilePath”: “aha-email.msg”, “StorageName”: “aws storage”, “Password”: “” },“ImageOptions”:{“ExternalResources”: “true”, “Width”: 20,“Height”: 60, “ExtractText”: true} }”

but we just get back a html view, not sure this is the expected behavior?

Thanks,
Hoa Nguyen.


#7

@hoaflynn

We have included a separate source code of SDK for .NET Core. Hopefully it will help you to use GroupDocs.Viewer Cloud Rest API directly in your code.


#8

@hoaflynn

You can configure multiple aws buckets with different storage names in groupdocs.cloud. But I am afraid currently you can only configure the 3rd Party Storage via GUI not via API call. However, please confirm, if you are interested to use API calls for configuring the storage, then we will log a feature request and investigate it further.

We are looking into it and will update you shortly.


#9

@hoaflynn

We are sorry for the confusion. We have updated the documentation for clarity. You need to use ViewFormat for rendering document to image view.

ViewFormat allows to set rendering format, available values are HTML, JPG, PNG, BMP, PDF. HTML is default value of VIewFormat, so you are getting HTML view. Please use following options for PNG. Hopefully it will help you to accomplish the task.

-d “{ "ViewFormat": "PNG", “FileInfo”: { “FilePath”: “aha-email.msg”, “StorageName”: “aws storage”, “Password”: “” },“ImageOptions”:{“ExternalResources”: “true”, “Width”: 20,“Height”: 60, “ExtractText”: true} }”


#10

Yes, we definitely would like to have the ability to configure aws buckets in GroupDocs on the fly.


#11

I tried your suggestion, it did generated an image but the ImageOptions (width, height) does not seem to take affect.

Thanks


#12

@hoaflynn

We have logged a feature request(6742) in our issue tracking system for further investigation and implementation. We will notify you soon as it is resolved.


#13

@hoaflynn

We are sorry for your inconvenience. While testing the scenario, we have noticed the reported issue and logged a ticket VIEWERCLOUD-305 for further investigation. We will share updates with you soon.


#14

@hoaflynn

Please use following cURL command for image view. Please note “ExternalResources” is HtmlOptions property so the API interprets RenderOptions as HtmlOptions and Width and Height could be ignored, so use ImageOptions and HtmlOptions only with corresponding ViewFormat.

Furthermore, please use “RenderOptions”, because ImageOptions and HtmlOptions are, just type names and should not be used.

curl -X POST "https://api.groupdocs.cloud/v2.0/viewer/view" -H "accept: application/json" -H "authorization: Bearer [ACCESS_TOKEN]" -H "Content-Type: application/json" -d "{ "FileInfo": { "FilePath": "Output/one-page.docx" }, "ViewFormat": "PNG","RenderOptions": { "Width": 100, "Height": 60, "ExtractText": true } }"


#15

Knowing that we can configure aws buckets on GroupDocs on the fly, would definitely help us make the final decision. Thanks.


#16

@hoaflynn

Thank for your feedback. The subjected feature request is pending for analysis. We will be in position to share the further updates with you after initial investigation.