We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert a private S3 file


I had read the api document in Aspose to convert a doc file to a pdf file.

# Specify App SID and App Key
app_sid = "45******-1***-4***-a***-a***********"
app_key = "94******************************"
Aspose::Cloud::Common::AsposeApp.new(app_sid, app_key)
#specify product URI

# set parameters
output_format = "pdf";
file_name = "MyFile.docx"
storage = ""
folder_name = ""

# Instantiate the Convertor class with an DOCX on Aspose Cloud Storage
docxConvertor = Aspose::Cloud::Words::Converter.new(file_name)
# Convert the file to PDF format and save it to local machine
docxConvertor.convert(output_format, storage, folder_name)

But the private file in S3 contains many parameters like AWSAccessKey, how can I pass it into the file name? And also, after the converting, how to config the folder to S3 destination?
Please give me the advise for this problem. Thanks!

Hi Khoa,
You first need to configure Amazon S3 storage with Aspose and then you can use the storage name you have specified during configuration. Please check https://docs.aspose.cloud/words/developer-guide/ for more details.
Also, folder_name parameter in the above example will contain folder path where your input file is. In case of S3, this path should start with the name of your S3 bucket so you will have to pass at least your bucket name if the file is at the root. Please check https://docs.aspose.cloud/words/convert/ for more details.
You will get output file in the response body. If you want to save output file to S3 storage, you can pass one more parameter i.e. outPath in the request URI e.g. words/{fileName}?format={format}&storage={storage}&folder={folder}&outPath={outPath}
Best Regards,