Skip to content

Commit e5e21ab

Browse files
authored
Merge branch 'development' into 998310-MemoryMetrics
2 parents 092a408 + ac47603 commit e5e21ab

File tree

9 files changed

+378
-552
lines changed

9 files changed

+378
-552
lines changed

Document-Processing-toc.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<li>
1818
<a href="/document-processing/ai-coding-assistant/mcp-server">MCP Server</a>
1919
</li>
20+
<li>
21+
<a href="/document-processing/ai-coding-assistant/prompt-library">Prompt Library</a>
22+
</li>
2023
</ul>
2124
</li>
2225
<li>Installation<ul>
@@ -2574,7 +2577,6 @@
25742577
<li><a href="/document-processing/pdf/pdf-library/javascript/Split-Documents">Split PDF</a></li>
25752578
<li><a href="/document-processing/pdf/pdf-library/javascript/Text-Extraction">Text Extraction</a></li>
25762579
<li><a href="/document-processing/pdf/pdf-library/javascript/Redaction">Redaction</a></li>
2577-
<li><a href="/document-processing/pdf/pdf-library/javascript/Supported-and-Unsupported-Features">Supported and Unsupported Features</a></li>
25782580
</ul>
25792581

25802582
</li>

Document-Processing/Excel/Spreadsheet/Blazor/open-and-save.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,117 @@ An Excel file encoded as a Base64 string can be loaded into the Spreadsheet comp
7272
{% endhighlight %}
7373
{% endtabs %}
7474

75+
### Open an Excel file from Google Drive
76+
To load an Excel file from `Google Drive` in the Blazor Spreadsheet, follow the steps below.
77+
78+
**Prerequisites:**
79+
- [Google Cloud project](https://developers.google.com/workspace/guides/create-project) in the Google Cloud Console.
80+
- [Service account](https://cloud.google.com/iam/docs/service-accounts-create) within the GCP project.
81+
- [Service account key](https://cloud.google.com/iam/docs/keys-create-delete) (JSON) available on disk.
82+
- [Google Drive API enabled](https://console.cloud.google.com/apis/library/drive.googleapis.com) for the project.
83+
- [Google Drive account](https://drive.google.com/) with access to the file to download.
84+
- [Google.Apis.Drive.v3](https://www.nuget.org/packages/Google.Apis.Drive.v3) NuGet package installed in your project to access Google Drive API.
85+
86+
**Step 1:** Install required NuGet packages
87+
88+
To use Google Drive with the Blazor Spreadsheet, install the following packages:
89+
90+
- [Google.Apis.Drive.v3](https://www.nuget.org/packages/Google.Apis.Drive.v3) — to access the Google Drive API
91+
- [Syncfusion.Blazor.Spreadsheet](https://www.nuget.org/packages/Syncfusion.Blazor.Spreadsheet) — to use the Syncfusion Blazor Spreadsheet component
92+
93+
**Step 2:** Include the following namespaces in the **Index.razor** file
94+
95+
Import the required namespaces at the top of the file:
96+
97+
```
98+
@using Google.Apis.Auth.OAuth2;
99+
@using Google.Apis.Drive.v3;
100+
@using Google.Apis.Services;
101+
@using Syncfusion.Blazor.Spreadsheet;
102+
@using System.IO;
103+
```
104+
105+
**Step 3:** Download the Excel file, convert to bytes, and prepare for binding
106+
107+
Add the below code example to download the `Google Drive` file using the Drive API, convert the stream to a byte array, and bind it to the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_DataSource) property.
108+
109+
{% tabs %}
110+
{% highlight razor %}
111+
112+
@page "/"
113+
114+
@if (IsSpreadsheetDataLoaded)
115+
{
116+
<SfSpreadsheet DataSource="DataSourceBytes">
117+
<SpreadsheetRibbon></SpreadsheetRibbon>
118+
</SfSpreadsheet>
119+
}
120+
@code{
121+
122+
public byte[] DataSourceBytes { get; set; }
123+
124+
// Flag to indicate whether the spreadsheet data has been loaded and is ready for rendering
125+
public bool IsSpreadsheetDataLoaded { get; set; }
126+
127+
protected override async Task OnInitializedAsync()
128+
{
129+
//Download the document from Google Drive
130+
MemoryStream stream = await GetDocumentFromGoogleDrive();
131+
132+
//Set the position as '0'
133+
stream.Position = 0;
134+
135+
// Convert the MemoryStream to a byte array to be used as the DataSource
136+
DataSourceBytes = stream.ToArray();
137+
138+
// Set the flag to true to indicate that the spreadsheet data is ready
139+
IsSpreadsheetDataLoaded = true;
140+
}
141+
142+
// Download file from Google Drive
143+
public async Task<MemoryStream> GetDocumentFromGoogleDrive()
144+
{
145+
//Define the path to the service account key file
146+
string serviceAccountKeyPath = "Your_service_account_key_path";
147+
148+
//Specify the file ID of the file to download
149+
string fileID = "Your_file_id";
150+
151+
try
152+
{
153+
//Authenticate the Google Drive API access using the service account key
154+
GoogleCredential credential = GoogleCredential.FromFile(serviceAccountKeyPath).CreateScoped(DriveService.ScopeConstants.Drive);
155+
156+
//Create the Google Drive service
157+
DriveService service = new DriveService(new BaseClientService.Initializ()
158+
{
159+
HttpClientInitializer = credential
160+
});
161+
162+
//Create a request to get the file from Google Drive
163+
var request = service.Files.Get(fileID);
164+
165+
//Download the file into a MemoryStream
166+
MemoryStream stream = new MemoryStream();
167+
await request.DownloadAsync(stream);
168+
169+
return stream;
170+
}
171+
catch (Exception ex)
172+
{
173+
Console.WriteLine($"Error retrieving document from Google Drive: {ex.Message}");
174+
throw;
175+
}
176+
}
177+
}
178+
179+
{% endhighlight %}
180+
{% endtabs %}
181+
182+
N> Replace **Your_file_id** with the actual Google Drive file ID, and **Your_service_account_key_path** with the actual path to your service account key JSON file.
183+
184+
N> The **FileID** is the unique identifier for a Google Drive file. For example, if the file URL is: `https://drive.google.com/file/d/abc123xyz456/view?usp=sharing`, then the file ID is `abc123xyz456`.
185+
75186
### Supported file formats
76187
The Spreadsheet component supports opening the following file formats:
77188
* Microsoft Excel Workbook (.xlsx)

Document-Processing/PDF/PDF-Library/javascript/Create-PDF-document-angular.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ Start a new Angular application using the Angular CLI command as follows.
3333
ng new my-app
3434
cd my-app
3535
```
36+
37+
## Installing Syncfusion<sup>&reg;</sup> JavaScript package
38+
39+
All the available JS 2 packages are published in `npmjs.com` registry.
40+
41+
* To install PDF component, use the following command.
42+
43+
```bash
44+
npm install @syncfusion/ej2-pdf --save
45+
```
46+
3647
## Create a PDF document using TypeScript
3748

3849
* Add a simple button to `app.component.html` and attach a click handler that uses the TypeScript PDF API to create a new PDF document.

Document-Processing/PDF/PDF-Library/javascript/Create-PDF-document-asp-net-core.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ This guide explains how to integrate the JavaScript PDF library into an ASP.NET
1616

1717
## Integrate PDF library into an ASP.NET Core application
1818

19-
1. Start Visual Studio and select **Create a new project**.
20-
2. In the **Create a new project** dialog, select **ASP.NET Core Web App**.
19+
Step 1: Start Visual Studio and select **Create a new project**.
20+
Step 2: In the **Create a new project** dialog, select **ASP.NET Core Web App**.
2121
![ASP.NET Core PDF creation1](Getting_started_images/Asp-net-core-creation1.png)
22-
3. In the **Configure your new project** dialog, enter the project name and select **Next**.
22+
Step 3: In the **Configure your new project** dialog, enter the project name and select **Next**.
2323
![ASP.NET Core PDF creation2](Getting_started_images/Asp-net-core-creation2.png)
24-
4. In the **Additional information** dialog, select a .NET LTS version (for example, **.NET 8.0 (Long-term Support)**) and then select **Create**.
24+
Step 4: In the **Additional information** dialog, select a .NET LTS version (for example, **.NET 8.0 (Long-term Support)**) and then select **Create**.
2525
![ASP.NET Core PDF creation3](Getting_started_images/Asp-net-core-creation3.png)
2626

27-
5. **Add script reference** : Add the required scripts using the CDN inside the `<head>` of `~/Views/Shared/_Layout.cshtml` as follows:
27+
Step 5: **Add script reference** : Add the required scripts using the CDN inside the `<head>` of `~/Views/Shared/_Layout.cshtml` as follows:
2828

2929
{% tabs %}
3030
{% highlight c# tabtitle="~/_Layout.cshtml" %}
@@ -38,7 +38,7 @@ This guide explains how to integrate the JavaScript PDF library into an ASP.NET
3838
{% endhighlight %}
3939
{% endtabs %}
4040

41-
6. **Create a PDF document** : Add the script in `~/Views/Home/Index.cshtml` by creating a button and attaching a click event that uses the JavaScript PDF API to generate a PDF document.
41+
Step 6: **Create a PDF document** : Add the script in `~/Views/Home/Index.cshtml` by creating a button and attaching a click event that uses the JavaScript PDF API to generate a PDF document.
4242

4343
{% tabs %}
4444
{% highlight c# tabtitle="~/Index.cshtml" %}
@@ -75,9 +75,9 @@ This guide explains how to integrate the JavaScript PDF library into an ASP.NET
7575
{% endhighlight %}
7676
{% endtabs %}
7777

78-
7. **Build the project** : Click on Build > Build Solution or press Ctrl + Shift + B to build the project.
78+
step 7: **Build the project** : Click on Build > Build Solution or press Ctrl + Shift + B to build the project.
7979

80-
8. **Run the project** : Click the Start button (green arrow) or press F5 to run the app.
80+
Step 8: **Run the project** : Click the Start button (green arrow) or press F5 to run the app.
8181

8282
By executing the program, you will generate the following PDF document.
8383

Document-Processing/PDF/PDF-Library/javascript/Create-PDF-document-asp-net-mvc.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ This guide explains how to integrate the JavaScript PDF library into an ASP.NET
1616

1717
## Integrate PDF library into an ASP.NET MVC application
1818

19-
1. Start Visual Studio and select **Create a new project**.
20-
2. Create a new ASP.NET MVC Web Application project.
19+
Step 1: Start Visual Studio and select **Create a new project**.
20+
Step 2: Create a new ASP.NET MVC Web Application project.
2121
![ASP.NET Core MVC PDF creation1](Getting_started_images/Asp-net-mvc-creation1.png)
22-
3. Choose the target framework.
22+
Step 3: Choose the target framework.
2323
![ASP.NET Core MVC PDF creation2](Getting_started_images/Asp-net-mvc-creation2.png)
24-
4. Select Web Application pattern (MVC) for the project and then select **Create** button.
24+
Step 4: Select Web Application pattern (MVC) for the project and then select **Create** button.
2525
![ASP.NET Core MVC PDF creation3](Getting_started_images/Asp-net-mvc-creation3.png)
2626

27-
5. **Add script reference** : Add the required scripts using the CDN inside the `<head>` of `~/Views/Shared/_Layout.cshtml` as follows:
27+
Step 5: **Add script reference** : Add the required scripts using the CDN inside the `<head>` of `~/Views/Shared/_Layout.cshtml` as follows:
2828

2929
{% tabs %}
3030
{% highlight c# tabtitle="~/_Layout.cshtml" %}
@@ -38,7 +38,7 @@ This guide explains how to integrate the JavaScript PDF library into an ASP.NET
3838
{% endhighlight %}
3939
{% endtabs %}
4040

41-
6. **Create a PDF document** : Add the script in `~/Views/Home/Index.cshtml` by creating a button and attaching a click event that uses the JavaScript PDF API to generate a PDF document.
41+
Step 6: **Create a PDF document** : Add the script in `~/Views/Home/Index.cshtml` by creating a button and attaching a click event that uses the JavaScript PDF API to generate a PDF document.
4242

4343
{% tabs %}
4444
{% highlight c# tabtitle="~/Index.cshtml" %}
@@ -75,9 +75,9 @@ This guide explains how to integrate the JavaScript PDF library into an ASP.NET
7575
{% endhighlight %}
7676
{% endtabs %}
7777

78-
7. **Build the project** : Click on Build > Build Solution or press Ctrl + Shift + B to build the project.
78+
Step 7: **Build the project** : Click on Build > Build Solution or press Ctrl + Shift + B to build the project.
7979

80-
8. **Run the project** : Click the Start button (green arrow) or press F5 to run the app.
80+
Step 8: **Run the project** : Click the Start button (green arrow) or press F5 to run the app.
8181

8282
By executing the program, you will generate the following PDF document.
8383

Document-Processing/PDF/PDF-Library/javascript/Create-PDF-document-javascript.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ The Syncfusion<sup>&reg;</sup> JS 2 for JavaScript (global script) is an ES5 for
1414

1515
## Component Initialization with CDN link for script and style reference
1616

17-
**Step 1:** Create an app folder `my-app` for the JS 2 JavaScript components.
17+
Step 1: Create an app folder `my-app` for the JS 2 JavaScript components.
1818

19-
**Step 2:** The JS 2 component's global scripts and styles are already hosted in the below CDN link formats.
19+
Step 2: The JS 2 component's global scripts and styles are already hosted in the below CDN link formats.
2020

2121
**Syntax:**
2222
> Script: `https://cdn.syncfusion.com/ej2/{Version}/dist/{PACKAGE_NAME}.min.js`
@@ -28,7 +28,7 @@ The Syncfusion<sup>&reg;</sup> JS 2 for JavaScript (global script) is an ES5 for
2828
>
2929
> Styles: [`https://cdn.syncfusion.com/ej2/31.2.15/ej2-base/styles/material.css`](https://cdn.syncfusion.com/ej2/31.2.15/ej2-base/styles/material.css)
3030
31-
**Step 3:** Create a HTML page (index.html) in `my-app` location and add the CDN link references.
31+
Step 3: Create a HTML page (index.html) in `my-app` location and add the CDN link references.
3232

3333
{% tabs %}
3434
{% highlight ts tabtitle="index.html" %}
@@ -42,7 +42,7 @@ The Syncfusion<sup>&reg;</sup> JS 2 for JavaScript (global script) is an ES5 for
4242
{% endhighlight %}
4343
{% endtabs %}
4444

45-
**Step 4:** **Create a PDF document** : Add the script in `index.html` by creating a button and attaching a click event that uses the JavaScript PDF API to generate a PDF document.
45+
Step 4: **Create a PDF document** : Add the script in `index.html` by creating a button and attaching a click event that uses the JavaScript PDF API to generate a PDF document.
4646

4747
{% tabs %}
4848
{% highlight c# tabtitle="~/Index.html" %}

Document-Processing/PDF/PDF-Library/javascript/Overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The following are the key features of this library.
3636

3737
## Supported web platforms
3838

39-
* ASP.NET core
39+
* ASP.NET Core
4040
* ASP.NET MVC
4141
* Angular
4242
* React

0 commit comments

Comments
 (0)