Skip to content

Commit 4a04c76

Browse files
Merge pull request #3236 from Syncfusion-Content/hotfix/hotfix-v26.2.4
DOCINFRA-2341_merged_using_automation
2 parents bd0e9db + 658adba commit 4a04c76

File tree

10 files changed

+540
-24
lines changed

10 files changed

+540
-24
lines changed
2.67 KB
Loading

ej2-asp-core-mvc/barcode/qrcodegenerator.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,29 +88,46 @@ The dimension of the QR Code can be changed using the height and width propertie
8888
{% endif %}
8989

9090

91+
## Enhancing QR Codes with Icons
9192

92-
## Customizing the text
93+
The EJ2 Barcode Generator allows you to add a [`logo`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.BarcodeGenerator.QRCodeGenerator.html#Syncfusion_EJ2_BarcodeGenerator_QRCodeGenerator_Logo) or icon to your QR codes, enhancing their visual appeal, clarity, and even security. Adding a recognizable icon can make it easier for users to identify the source and help prevent tampering.
9394

94-
In QR Code generators, you can customize the QR Code text by using display text property.
95+
### Supported Image Sources
96+
97+
The `imageSource` property of the `QRCodeLogo` class supports the following image sources:
98+
99+
- **Local image path**: Specify the path to the image file relative to your project's root directory (e.g., `images/syncfusion.png`) or as an absolute path (e.g., `/assets/icons/logo.svg`).
100+
- **Remote image URL**: Provide the web address of the image file (e.g., `https://example.com/image.jpg`).
101+
- **Base64 encoded image data**: Embed the image data directly in the code using a Base64-encoded string (e.g., `data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...`).
102+
103+
### Logo Dimensions
104+
105+
The `width` and `height` properties of the `QRCodeLogo` class define the dimensions of the logo in pixels. If not specified, both default to 30% of the QR code’s size. The maximum allowed size is 30% of the QR code’s dimensions to ensure optimal readability.
106+
107+
**Note:** Always test the readability of your QR code after adding a logo. Depending on the logo size and QR code content, you might need to adjust the [`errorCorrectionLevel`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.BarcodeGenerator.ErrorCorrectionLevel.html) property of the `QRCodeGenerator` to `"Medium"` or `"High"` for better reliability.
108+
109+
The following image illustrates QR code with logo:
110+
111+
![logo](images/logo.png)
95112

96113
{% if page.publishingplatform == "aspnet-core" %}
97114

98115
{% tabs %}
99116
{% highlight cshtml tabtitle="CSHTML" %}
100-
{% include code-snippet/barcode/qrcode/text/tagHelper %}
117+
{% include code-snippet/barcode/qrcode/logo/tagHelper %}
101118
{% endhighlight %}
102119
{% endtabs %}
103120

104121
{% elsif page.publishingplatform == "aspnet-mvc" %}
105122

106123
{% tabs %}
107124
{% highlight razor tabtitle="CSHTML" %}
108-
{% include code-snippet/barcode/qrcode/text/razor %}
125+
{% include code-snippet/barcode/qrcode/logo/razor %}
109126
{% endhighlight %}
110-
{% highlight c# tabtitle="Text.cs" %}
111-
{% include code-snippet/barcode/qrcode/text/text.cs %}
127+
{% highlight c# tabtitle="Logo.cs" %}
128+
{% include code-snippet/barcode/qrcode/logo/logo.cs %}
112129
{% endhighlight %}
113130
{% endtabs %}
114131
{% endif %}
115132

116-
N> [View Sample in GitHub](https://github.com/SyncfusionExamples/ASP-NET-Core-UG-Examples/tree/main/Barcode/QRCodeandDataMatrixSample).
133+
N> [View Sample in GitHub](https://github.com/SyncfusionExamples/ASP-NET-Core-UG-Examples/tree/main/Barcode/QRCodeandDataMatrixSample).
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
using System.Web;
4+
using System.Web.Mvc;
5+
using Syncfusion.EJ2.BarcodeGenerator;
6+
7+
namespace EJ2CoreSampleBrowser.Controllers.Barcode
8+
{
9+
public partial class BarcodeController : Controller
10+
{
11+
12+
public ActionResult qrcode()
13+
{
14+
15+
return View();
16+
}
17+
}
18+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@(Html.EJS().QRCodeGenerator("container").
2+
Width("200px").
3+
mode=("SVG").
4+
Height("150px").
5+
logo(s => s.imageSource("https://www.syncfusion.com/web-stories/wp-content/uploads/sites/2/2022/02/cropped-Syncfusion-logo.png")).
6+
Value("SYNCFUSION").Render() )
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<ejs-qrcodegenerator id="container" width="200px" height="150px" mode="SVG" value="Syncfusion">
2+
<e-qrcodegenerator-logo imageSource="https://www.syncfusion.com/web-stories/wp-content/uploads/sites/2/2022/02/cropped-Syncfusion-logo.png"></e-qrcodegenerator-logo>
3+
</ejs-qrcodegenerator>

ej2-asp-core-mvc/pdfviewer/EJ2_ASP.MVC/form-filling.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: post
3-
title: Form Filling in ##Platform_Name## Pdfviewer Component
3+
title: Form Filling in ##Platform_Name## Pdfviewer Component | Syncfusion
44
description: Learn here all about Form Filling in Syncfusion ##Platform_Name## Pdfviewer component of Syncfusion Essential JS 2 and more.
55
platform: ej2-asp-core-mvc
66
control: PDF Viewer
@@ -9,7 +9,7 @@ documentation: ug
99
---
1010

1111

12-
# Form Filling
12+
# Form Filling in the ASP.NET MVC PDF Viewer component
1313

1414
PDF Viewer component allows you to display the form fields available in the PDF document. By using this, you can edit and download the form fields.
1515

@@ -23,7 +23,7 @@ The form fields displayed in the PDF Viewer are:
2323
* Signature Field
2424
* List box
2525

26-
![FormFilling](../../pdfviewer/images/formfilling.png)
26+
![FormFilling](./images/formfilling.png)
2727

2828
## Disabling form fields
2929

@@ -52,21 +52,21 @@ Signature can be added to the Signature field by using the following steps:
5252

5353
* Click the Signature Field in the PDF document. The signature panel will appear.
5454

55-
![SignatureField](../../pdfviewer/images/signaturefield.png)
55+
![SignatureField](./images/signaturefield.png)
5656

5757
* Draw the signature in the signature panel.
5858

59-
![SignaturePanel](../../pdfviewer/images/signature.png)
59+
![SignaturePanel](./images/signature.png)
6060

6161
* Click the **CREATE** button, the drawn signature will be added in the signature field.
6262

63-
![Signature](../../pdfviewer/images/sign.png)
63+
![Signature](./images/sign.png)
6464

6565
## Delete the signature inside the signature field
6666

6767
You can also delete the signature in the signature field by using Delete Option in the annotation toolbar.
6868

69-
![DeleteSign](../../pdfviewer/images/deletesign.png)
69+
![DeleteSign](./images/deletesign.png)
7070

7171
## Import and export form fields
7272

ej2-asp-core-mvc/pdfviewer/EJ2_ASP.MVC/open-pdf-file/from-azure-blob-storage.md

Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: post
3-
title: Azure Blob Storage in ##Platform_Name## PDF Viewer Component
3+
title: Open PDF from Azure Blob Storage in ##Platform_Name## PdfViewer | Syncfusion
44
description: Learn here all about how to Open PDF files from Azure Blob Storage in ASP.NET MVC PDF Viewer component of Syncfusion Essential JS 2 and more.
55
platform: ej2-asp-core-mvc
66
control: PDF Viewer
@@ -10,6 +10,95 @@ documentation: ug
1010

1111
# Open PDF file from Azure Blob Storage
1212

13+
PDF Viewer allows to load PDF file from Azure Blob Storage using either the Standalone or Server-backed PDF Viewer. Below are the steps and a sample to demonstrate how to open a PDF from Azure Blob Storage.
14+
15+
## Using Standalone PDF Viewer
16+
17+
To load a PDF file from Azure Blob Storage in a PDF Viewer, you can follow the steps below
18+
19+
**Step 1:** Create the Azure Blob Storage account
20+
21+
Log in to the Azure Portal. Create a new Storage Account with preferred settings. Note access keys during the setup. Within the Storage Account, create a Blob Container following the steps in this [link](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-create?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json&tabs=azure-portal).
22+
23+
**Step 2:** Create PDF Viewer Sample in ASP.NET MVC
24+
25+
Follow instructions provided in the Syncfusion PDF Viewer Getting Started [Guide](https://ej2.syncfusion.com/aspnetmvc/documentation/pdfviewer/getting-started-with-server-backed#integrate-pdf-viewer-into-an-aspnet-mvc-application) to create a simple PDF Viewer sample in ASP.NET MVC.
26+
27+
**Step 3:** Modify the `Views/Home/index.cshtml` File in the Project
28+
29+
1. Add the following properties to the `Views/Home/index.cshtml`, and assign the values from the configuration to the corresponding properties
30+
31+
N> Replace **Your account name in Azure** with the actual account name for your Azure Blob Storage account and **Your container name in Azure** with the actual container name and **Your Blob name in Azure** with the actual container name.
32+
33+
```csharp
34+
var accountName = "*Your account name in Azure*";
35+
var containerName = "*Your container name in Azure*";
36+
var blobName = "*Your Blob name in Azure*";
37+
```
38+
39+
2. Constructs the URL to the PDF in Azure Blob Storage. Calls fetchAndConvertToBase64 to fetch the PDF and convert it to a base64 string. Then Loads the base64 string into the PDF Viewer.
40+
41+
```csharp
42+
function loadDocument() {
43+
var url = 'https://' + accountName + '.blob.core.windows.net/' + containerName + '/' + blobName;
44+
fetchAndConvertToBase64(url).then(function(base64String) {
45+
if (base64String) {
46+
setTimeout(function() {
47+
viewer.load("data:application/pdf;base64," + base64String);
48+
}, 2000);
49+
} else {
50+
console.error('Failed to fetch and convert file to base64.');
51+
}
52+
}).catch(function(error) {
53+
console.error('Error:', error);
54+
});
55+
}
56+
```
57+
58+
3. Then it retrieves the PDF file from the given URL and converts the fetched Blob to a base64 string using blobToBase64.
59+
60+
```csharp
61+
function fetchAndConvertToBase64(url) {
62+
return new Promise(function(resolve, reject) {
63+
fetch(url).then(function(response) {
64+
if (!response.ok) {
65+
throw new Error('HTTP error! Status: ' + response.status);
66+
}
67+
return response.blob();
68+
}).then(function(blob) {
69+
blobToBase64(blob).then(function(base64String) {
70+
resolve(base64String);
71+
});
72+
}).catch(function(error) {
73+
console.error('Error fetching file:', error);
74+
reject(null);
75+
});
76+
});
77+
}
78+
```
79+
80+
4. Uses FileReader to convert a Blob to a base64 string. Resolves the promise with the base64 string or rejects it in case of an error.
81+
82+
```csharp
83+
function blobToBase64(blob) {
84+
return new Promise(function(resolve, reject) {
85+
var reader = new FileReader();
86+
reader.onload = function() {
87+
var base64String = reader.result ? reader.result.toString().split(',')[1] : '';
88+
resolve(base64String);
89+
};
90+
reader.onerror = function(error) {
91+
reject(error);
92+
};
93+
reader.readAsDataURL(blob);
94+
});
95+
}
96+
```
97+
98+
[View sample in GitHub](https://github.com/SyncfusionExamples/open-save-pdf-documents-in-azure-blob-storage/tree/master/Open%20and%20Save%20PDF%20in%20Azure%20Blob%20Storage%20using%20Standalone).
99+
100+
## Using Server-Backed PDF Viewer
101+
13102
To load a PDF file from Azure Blob Storage in a PDF Viewer, you can follow the steps below
14103

15104
**Step 1:** Create the Azure Blob Storage account
@@ -95,4 +184,4 @@ Set the `documentPath` property of the PDF viewer component to the desired name
95184

96185
N> The **Azure.Storage.Blobs** NuGet package must be installed in your application to use the previous code example.
97186

98-
[View sample in GitHub](https://github.com/SyncfusionExamples/open-save-pdf-documents-in-azure-blob-storage).
187+
[View sample in GitHub](https://github.com/SyncfusionExamples/open-save-pdf-documents-in-azure-blob-storage/tree/master/Open%20and%20Save%20PDF%20in%20Azure%20Blob%20Storage%20using%20Server-Backend).

0 commit comments

Comments
 (0)