From 2d9309e575feb07a51a93ed1c827f5a323c195c6 Mon Sep 17 00:00:00 2001 From: Build Automaion Date: Sat, 20 Jul 2024 05:00:49 +0530 Subject: [PATCH] Integrated latest changes at 07-20-2024 4:30:08 AM --- .../pdfviewer/open-pdf-file/from-amazon-s3.md | 93 +++++++++++- .../pdfviewer/save-pdf-file/to-amazon-s3.md | 141 +++++++++++++++++- 2 files changed, 229 insertions(+), 5 deletions(-) diff --git a/ej2-vue/pdfviewer/open-pdf-file/from-amazon-s3.md b/ej2-vue/pdfviewer/open-pdf-file/from-amazon-s3.md index ebd6c4c04..241ada21a 100644 --- a/ej2-vue/pdfviewer/open-pdf-file/from-amazon-s3.md +++ b/ej2-vue/pdfviewer/open-pdf-file/from-amazon-s3.md @@ -10,6 +10,95 @@ domainurl: ##DomainURL## # Open PDF file from AWS S3 +PDF Viewer allows to load PDF file from AWS S3 using either the Standalone or Server-backed PDF Viewer. Below are the steps and a sample to demonstrate how to open a PDF from AWS S3. + +## Using Standalone PDF Viewer + +To load a PDF file from AWS S3 in a PDF Viewer, you can follow the steps below. + +**Step 1:** Create a PDF Viewer sample in Vue + +Follow the instructions provided in this [link](https://ej2.syncfusion.com/vue/documentation/pdfviewer/getting-started) to create a simple PDF Viewer sample in Vue. This will set up the basic structure of your PDF Viewer application. + +**Step 2:** Modify the `src/App.vue` File in the Vue Project + +1. Import the required namespaces at the top of the file: + +{% tabs %} +{% highlight html tabtitle="Options API (~/src/App.vue)" %} + + + +{% endhighlight %} +{% endtabs %} + +2. Configures AWS SDK with the region, access key, and secret access key. This configuration allows the application to interact with AWS services like S3. + +N> Replace **Your Region** with the actual Region of your AWS S3 account and **Your Access Key** with the actual Access Key of your AWS S3 account and **Your Security Access Key** with the actual Security Access Key of your AWS S3 account. + +{% tabs %} +{% highlight html tabtitle="Options API (~/src/App.vue)" %} + + + +{% endhighlight %} +{% endtabs %} + +3. Sets the parameters for fetching the PDF document from S3, including the bucket name and file key. Then Uses the getObject method of the S3 instance to retrieve the document. Converts the document data to a Base64 string and loads it into the Syncfusion PDF Viewer then load Base64 string generated into the viewer.load method. + +N> Replace **Your Bucket Name** with the actual Bucket name of your AWS S3 account and **Your Key** with the actual File Key of your AWS S3 account. + + +{% tabs %} +{% highlight html tabtitle="Options API (~/src/App.vue)" %} + + + +{% endhighlight %} +{% endtabs %} + +N> The **npm install aws-sdk** package must be installed in your application to use the previous code example. + +[View sample in GitHub](https://github.com/SyncfusionExamples/open-save-pdf-documents-in-aws-s3/tree/master/Open%20and%20Save%20PDF%20in%20AWS%20S3%20using%20Standalone). + +## Using Server-Backed PDF Viewer + To load a PDF file from AWS S3 in a PDF Viewer, you can follow the steps below **Step 1:** Create a Simple PDF Viewer Sample in Vue @@ -97,7 +186,7 @@ public async Task Load([FromBody] Dictionary json } ``` -6. Open the `appsettings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration +6. Open the `app settings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration ```json { @@ -186,4 +275,4 @@ export default { N> The **AWSSDK.S3** NuGet package must be installed in your application to use the previous code example. -[View sample in GitHub](https://github.com/SyncfusionExamples/open-save-pdf-documents-in-aws-s3) \ No newline at end of file +[View sample in GitHub](https://github.com/SyncfusionExamples/open-save-pdf-documents-in-aws-s3/tree/master/Open%20and%20Save%20PDF%20in%20AWS%20S3%20using%20Server-Backend) \ No newline at end of file diff --git a/ej2-vue/pdfviewer/save-pdf-file/to-amazon-s3.md b/ej2-vue/pdfviewer/save-pdf-file/to-amazon-s3.md index 968ca5759..d3a2b610f 100644 --- a/ej2-vue/pdfviewer/save-pdf-file/to-amazon-s3.md +++ b/ej2-vue/pdfviewer/save-pdf-file/to-amazon-s3.md @@ -8,7 +8,142 @@ documentation: ug domainurl: ##DomainURL## --- -# Save PDF file to AWS S3 +# Save PDF file to AWS S3 + +PDF Viewer allows to save PDF file to AWS S3 using either the Standalone or Server-backed PDF Viewer. Below are the steps and a sample to demonstrate how to save PDF to AWS S3. + +## Using Standalone PDF Viewer + +To load a PDF file from AWS S3 in a PDF Viewer, you can follow the steps below. + +**Step 1:** Create a PDF Viewer sample in Vue + +Follow the instructions provided in this [link](https://ej2.syncfusion.com/vue/documentation/pdfviewer/getting-started) to create a simple PDF Viewer sample in Vue. This will set up the basic structure of your PDF Viewer application. + +**Step 2:** Modify the `src/App.vue` File in the Vue Project + +1. Import the required namespaces at the top of the file: + +{% tabs %} +{% highlight html tabtitle="Options API (~/src/App.vue)" %} + + + +{% endhighlight %} +{% endtabs %} + +2. Configures AWS SDK with the region, access key, and secret access key. This configuration allows the application to interact with AWS services like S3. + +N> Replace **Your Region** with the actual Region of your AWS S3 account and **Your Access Key** with the actual Access Key of your AWS S3 account and **Your Security Access Key** with the actual Security Access Key of your AWS S3 account. + +{% tabs %} +{% highlight html tabtitle="Options API (~/src/App.vue)" %} + + + +{% endhighlight %} +{% endtabs %} + +3. Configure a custom toolbar item for the download function to save a PDF file in Azure Blob Storage. + +{% tabs %} +{% highlight html tabtitle="Options API (~/src/App.vue)" %} + + + + + +{% endhighlight %} +{% endtabs %} + +4. Retrieve the PDF viewer instance and save the current PDF as a Blob. Then, read the Blob using a FileReader to convert it into an ArrayBuffer, and upload the ArrayBuffer to AWS S3 using the putObject method of the S3 instance. + +N> Replace **Your Bucket Name** with the actual Bucket name of your AWS S3 account and **Your Key** with the actual File Key of your AWS S3 account. + +{% tabs %} +{% highlight html tabtitle="Options API (~/src/App.vue)" %} + + + +{% endhighlight %} +{% endtabs %} + +N> The **npm install aws-sdk** package must be installed in your application to use the previous code example. + +[View sample in GitHub](https://github.com/SyncfusionExamples/open-save-pdf-documents-in-aws-s3/tree/master/Open%20and%20Save%20PDF%20in%20AWS%20S3%20using%20Standalone). + +## Using Server-Backed PDF Viewer To save a PDF file to AWS S3, you can follow the steps below @@ -87,7 +222,7 @@ public IActionResult Download([FromBody] Dictionary jsonObject) } ``` -6. Open the `appsettings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration +6. Open the `app settings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration ```json { @@ -176,4 +311,4 @@ export default { N> The **AWSSDK.S3** NuGet package must be installed in your application to use the previous code example. -[View sample in GitHub](https://github.com/SyncfusionExamples/open-save-pdf-documents-in-aws-s3) \ No newline at end of file +[View sample in GitHub](https://github.com/SyncfusionExamples/open-save-pdf-documents-in-aws-s3/tree/master/Open%20and%20Save%20PDF%20in%20AWS%20S3%20using%20Server-Backend) \ No newline at end of file