diff --git a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/Converting-HTML-to-PDF.md b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/Converting-HTML-to-PDF.md
index 756947697..9d5775c35 100644
--- a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/Converting-HTML-to-PDF.md
+++ b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/Converting-HTML-to-PDF.md
@@ -16,14 +16,14 @@ Syncfusion® HTML-to-PDF converter will work seamlessly in various
* Converts any [webpage to PDF](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#url-to-pdf).
* Converts any raw [HTML string to PDF](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#html-string-to-pdf).
* Converts [HTML form to fillable PDF form](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#html-form-to-pdf-form).
-* Automatically creates [Table of Contents](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#table-of-contents).
+* Automatically creates [Table of Contents](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#table-of-contents-with-custom-style).
* Automatically creates [bookmark hierarchy](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#bookmarks).
* Converts only a [part of the web page to PDF](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#partial-webpage-to-pdf).
-* Supports PDF header and PDF footer.
+* Supports PDF [header and PDF footer](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#header-and-footer).
* Repeats HTML table header and footer in PDF.
* Supports HTML5, CSS3, SVG, and Web fonts.
* Converts any [HTML to an image](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#url-to-image).
-* Converts any [SVG to image](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#url-to-image).
+* Converts any [SVG to image](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#svg-file-to-image).
* Supports accessing HTML pages using both [HTTP POST and GET](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#http-get-and-post).
* Supports [cookies-based form authentication](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#form-authentication).
* Thread safe.
diff --git a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/NuGet-Packages-Required.md b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/NuGet-Packages-Required.md
index 55439dfed..cfd5f00b6 100644
--- a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/NuGet-Packages-Required.md
+++ b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/NuGet-Packages-Required.md
@@ -20,7 +20,7 @@ N> The HTML to PDF converter library internally uses the Blink rendering engine
-(.NET Core, .NET 5, .NET 6 and .NET 8) Windows
+Windows (.NET Core, .NET8, and .NET9)
{{'[Syncfusion.HtmlToPdfConverter.Net.Windows.nupkg](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Windows/)'| markdownify }}
@@ -28,7 +28,7 @@ N> The HTML to PDF converter library internally uses the Blink rendering engine
-(.NET Core, .NET 5, .NET 6 and .NET 8) Linux
+Linux (.NET Core, .NET8, and .NET9)
{{'[Syncfusion.HtmlToPdfConverter.Net.Linux.nupkg](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Linux/)'| markdownify }}
@@ -36,7 +36,7 @@ N> The HTML to PDF converter library internally uses the Blink rendering engine
-(.NET Core, .NET 5, .NET 6 and .NET 8) Mac
+Mac (.NET Core, .NET8, and .NET9)
{{'[Syncfusion.HtmlToPdfConverter.Net.Mac.nupkg](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Mac/)'| markdownify }}
@@ -44,7 +44,7 @@ N> The HTML to PDF converter library internally uses the Blink rendering engine
-(.NET Core, .NET 5, .NET 6 and .NET 8) Aws
+AWS (.NET Core, .NET8, and .NET9)
{{'[Syncfusion.HtmlToPdfConverter.Net.Aws.nupkg](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Aws/)'| markdownify }}
diff --git a/Document-Processing/PDF/Conversions/HTML-To-PDF/overview.md b/Document-Processing/PDF/Conversions/HTML-To-PDF/overview.md
index 70695a8e2..be164c484 100644
--- a/Document-Processing/PDF/Conversions/HTML-To-PDF/overview.md
+++ b/Document-Processing/PDF/Conversions/HTML-To-PDF/overview.md
@@ -16,16 +16,15 @@ Syncfusion® HTML-to-PDF converter will work seamlessly in various
* Converts any [webpage to PDF](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#url-to-pdf).
* Converts any raw [HTML string to PDF](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#html-string-to-pdf).
* Converts [HTML form to fillable PDF form](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#html-form-to-pdf-form).
-* Automatically creates [Table of Contents](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#table-of-contents).
+* Automatically creates [Table of Contents](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#table-of-contents-with-custom-style).
* Automatically creates [bookmark hierarchy](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#bookmarks).
* Converts only a [part of the web page to PDF](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#partial-webpage-to-pdf).
-* Supports PDF header and PDF footer.
+* Supports PDF [header and PDF footer](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#header-and-footer).
* Repeats HTML table header and footer in PDF.
* Supports HTML5, CSS3, SVG, and Web fonts.
* Converts any [HTML to an image](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#url-to-image).
-* Converts any [SVG to image](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#url-to-image).
-* Supports accessing HTML pages using both [HTTP POST and GET](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#http-get-and-post) methods.
-* Supports [HTTP cookies](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#form-authentication).
+* Converts any [SVG to image](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#svg-file-to-image).
+* Supports accessing HTML pages using both [HTTP POST and GET](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#http-get-and-post).
* Supports [cookies-based form authentication](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#form-authentication).
* Thread safe.
* Supports internal and external [hyperlinks](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features#hyperlinks).
diff --git a/Document-Processing/PDF/PDF-Library/NET/Create-PDF-document-in-AKS-Environment.md b/Document-Processing/PDF/PDF-Library/NET/Create-PDF-document-in-AKS-Environment.md
index 441d88179..3e3f3047e 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Create-PDF-document-in-AKS-Environment.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Create-PDF-document-in-AKS-Environment.md
@@ -23,22 +23,21 @@ Step 3: Click **Create** button.
Step 4: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).

-
Step 5: A default action method named Index will be present in *HomeController.cs*. Right click on Index method and select Go To View where you will be directed to its associated view page *Index.cshtml*. Add a new button in the *Index.cshtml* as shown below.
{% tabs %}
{% highlight c# tabtitle="C#" %}
- @{
- Html.BeginForm("CreatePDFDocument", "Home", FormMethod.Get);
- {
-
}
+ Html.EndForm();
+}
{% endhighlight %}
@@ -50,10 +49,10 @@ Step 6: Include the following namespaces in *HomeController.cs*.
{% highlight c# tabtitle="C#" %}
- using Syncfusion.Pdf.Graphics;
- using Syncfusion.Pdf;
- using System.Diagnostics;
- using Syncfusion.Drawing;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using System.Diagnostics;
+using Syncfusion.Drawing;
{% endhighlight %}
@@ -65,7 +64,7 @@ Step 7: Add a new action method named CreatePDFDocument in HomeController.cs fil
{% highlight c# tabtitle="C#" %}
- public IActionResult CreatePDFDocument()
+public IActionResult CreatePDFDocument()
{
//Create a new PDF document.
PdfDocument document = new PdfDocument();
@@ -165,7 +164,7 @@ Step 2: You need to gather the credentials in order to interact with the cluster
{% highlight c# tabtitle="C#" %}
- az aks get-credentials --resource-group CreatePdfDocument --name aks-uk-demo-msdn
+az aks get-credentials --resource-group CreatePdfDocument --name aks-uk-demo-msdn
{% endhighlight %}
@@ -175,7 +174,7 @@ Step 3: You can review the credentials with the following command:
{% tabs %}
{% highlight c# tabtitle="C#" %}
- cat .kube/config
+cat .kube/config
{% endhighlight %}
@@ -187,7 +186,7 @@ Step 4: Now in the Cloud Shell, create a new file called deploy.yaml as follows:
{% tabs %}
{% highlight c# tabtitle="C#" %}
- code deploy.yaml
+code deploy.yaml
{% endhighlight %}
@@ -236,7 +235,7 @@ Step 6: Once you save and close the code editor, it’s finally time to apply th
{% tabs %}
{% highlight c# tabtitle="C#" %}
- kubectl apply -f deploy.yaml
+kubectl apply -f deploy.yaml
{% endhighlight %}
@@ -250,10 +249,10 @@ Step 8: You can run the following commands:
{% tabs %}
{% highlight c# tabtitle="C#" %}
- kubectl get pods
- kubectl get nodes
- kubectl get service
- kubectl describe deployment
+kubectl get pods
+kubectl get nodes
+kubectl get service
+kubectl describe deployment
{% endhighlight %}
{% endtabs %}
@@ -262,7 +261,7 @@ or
{% tabs %}
{% highlight c# tabtitle="C#" %}
- kubectl get all
+kubectl get all
{% endhighlight %}
{% endtabs %}
@@ -286,8 +285,8 @@ If you want to clean up the cluster, you can run the following commands:
{% tabs %}
{% highlight c# tabtitle="C#" %}
- kubectl delete -f deploy.yaml
- kubectl delete svc asp-docker-app --namespace=default
+kubectl delete -f deploy.yaml
+kubectl delete svc asp-docker-app --namespace=default
{% endhighlight %}
{% endtabs %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Create-PDF-file-in-AWS-Elastic-Beanstalk.md b/Document-Processing/PDF/PDF-Library/NET/Create-PDF-file-in-AWS-Elastic-Beanstalk.md
index dfcdabdfb..91599fc0b 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Create-PDF-file-in-AWS-Elastic-Beanstalk.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Create-PDF-file-in-AWS-Elastic-Beanstalk.md
@@ -29,11 +29,11 @@ Step 4: A default controller named HomeController.cs gets added to create the AS
{% tabs %}
{% highlight c# tabtitle="C#" %}
- using Syncfusion.Pdf;
- using Syncfusion.Pdf.Graphics;
- using Syncfusion.Pdf.Grid;
- using Syncfusion.Pdf.Parsing;
- using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Grid;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Drawing;
{% endhighlight %}
{% endtabs %}
@@ -43,18 +43,18 @@ Step 5: Add a new button in index.cshtml as follows
{% tabs %}
{% highlight c# tabtitle="C#" %}
- @{
- Html.BeginForm("CreatePDF", "Home", FormMethod.Get);
- {
-
+}
+Html.EndForm();
}
{% endhighlight %}
@@ -65,43 +65,43 @@ Step 6: Add a new action method named CreatePDF in HomeController.cs file and in
{% tabs %}
{% highlight c# tabtitle="C#" %}
- public IActionResult CreatePDF()
- {
- //Open an existing PDF document.
- FileStream fileStream = new FileStream("Data/Input.pdf", FileMode.Open, FileAccess.Read);
- PdfLoadedDocument document = new PdfLoadedDocument(fileStream);
-
- //Get the first page from a document.
- PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;
-
- //Create PDF graphics for the page.
- PdfGraphics graphics = page.Graphics;
-
- //Create a PdfGrid.
- PdfGrid pdfGrid = new PdfGrid();
- //Add values to the list.
- List
-(.NET Core, .NET 5, .NET 6 and .NET 8) Windows
+Windows (.NET Core, .NET8, and .NET9)
{{'[Syncfusion.HtmlToPdfConverter.Net.Windows.nupkg](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Windows/)'| markdownify }}
@@ -207,7 +207,7 @@ N> The HTML to PDF converter library internally uses the Blink rendering engine
-(.NET Core, .NET 5, .NET 6 and .NET 8) Linux
+Linux (.NET Core, .NET8, and .NET9)
{{'[Syncfusion.HtmlToPdfConverter.Net.Linux.nupkg](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Linux/)'| markdownify }}
@@ -215,7 +215,7 @@ N> The HTML to PDF converter library internally uses the Blink rendering engine
-(.NET Core, .NET 5, .NET 6 and .NET 8) Mac
+Mac (.NET Core, .NET8, and .NET9)
{{'[Syncfusion.HtmlToPdfConverter.Net.Mac.nupkg](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Mac/)'| markdownify }}
@@ -223,7 +223,7 @@ N> The HTML to PDF converter library internally uses the Blink rendering engine
-(.NET Core, .NET 5, .NET 6 and .NET 8) Aws
+AWS (.NET Core, .NET8, and .NET9)
{{'[Syncfusion.HtmlToPdfConverter.Net.Aws.nupkg](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Aws/)'| markdownify }}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-AWS-S3.md b/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-AWS-S3.md
index c13f68075..a1338eb22 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-AWS-S3.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-AWS-S3.md
@@ -1,15 +1,14 @@
---
title: Open PDF file from AWS S3 | Syncfusion
-description: This page describes how to Open PDF file from file AWS S3 in C# using Syncfusion .NET PDF library.
+description: This page provides a detailed guide on how to open a PDF file stored in an AWS S3 bucket using C# and the Syncfusion .NET PDF library.
platform: document-processing
control: PDF
documentation: UG
---
-# Open PDF file from AWS S3
+# Open PDF from AWS S3
To load a PDF file from AWS S3, you can follow the steps below
-
Step 1: Create a simple console application

@@ -18,47 +17,45 @@ Step 3: Install the [AWSSDK.S3](https://www.nuget.org/packages/AWSSDK.S3) NuGet

-
Step 4: Include the following namespaces in the Program.cs file.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- using Amazon;
- using Amazon.S3;
- using Amazon.S3.Transfer;
+using Amazon;
+using Amazon.S3;
+using Amazon.S3.Transfer;
{% endhighlight %}
{% endtabs %}
-
Step 5: Add the below code example to load a PDF from AWS S3.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- // Set your AWS credentials and region
- string accessKey = "YOUR_ACCESS_KEY";
- string secretKey = "YOUR_SECRET_KEY";
- RegionEndpoint region = RegionEndpoint.YOUR_REGION; // Change to your desired region
-
- // Specify the bucket name and object key
- string bucketName = "YOUR_BUCKET_NAME";
- string objectKey = "YOUR_OBJECT_KEY";
-
- string localFilePath = "Output.pdf";
- // Download the PDF from S3
- //MemoryStream pdfStream = DownloadFromS3(accessKey, secretKey, region, bucketName, objectKey);
- using (var s3Client = new AmazonS3Client(accessKey, secretKey, region))
- {
- using (var transferUtility = new TransferUtility(s3Client))
- {
- transferUtility.Download(localFilePath, bucketName, objectKey);
- }
+// Set your AWS credentials and region
+string accessKey = "YOUR_ACCESS_KEY";
+string secretKey = "YOUR_SECRET_KEY";
+RegionEndpoint region = RegionEndpoint.YOUR_REGION; // Change to your desired region
+
+// Specify the bucket name and object key
+string bucketName = "YOUR_BUCKET_NAME";
+string objectKey = "YOUR_OBJECT_KEY";
+
+string localFilePath = "Output.pdf";
+// Download the PDF from S3
+//MemoryStream pdfStream = DownloadFromS3(accessKey, secretKey, region, bucketName, objectKey);
+using (var s3Client = new AmazonS3Client(accessKey, secretKey, region))
+{
+ using (var transferUtility = new TransferUtility(s3Client))
+ {
+ transferUtility.Download(localFilePath, bucketName, objectKey);
}
+}
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-azure-blob-storage.md b/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-azure-blob-storage.md
index cdcf6c0da..02013f46b 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-azure-blob-storage.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-azure-blob-storage.md
@@ -5,7 +5,7 @@ platform: document-processing
control: PDF
documentation: UG
---
-# Open PDF file from Azure Blob storage
+# Open PDF from Azure Blob storage
To load a PDF file from Azure blob storage, you can follow the steps below
@@ -25,38 +25,37 @@ Step 4: Include the following namespaces in the Program.cs file.
{% highlight c# tabtitle="C# [Cross-platform]" %}
- using Microsoft.Azure.Storage;
- using Microsoft.Azure.Storage.Blob;
+using Microsoft.Azure.Storage;
+using Microsoft.Azure.Storage.Blob;
{% endhighlight %}
{% endtabs %}
-
Step 5: Add the below code example to load a PDF from Azure blob storage.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- // Parse the connection string to your Azure Storage Account.
- CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
+// Parse the connection string to your Azure Storage Account.
+CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
- // Create a client to interact with Blob storage.
- CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
+// Create a client to interact with Blob storage.
+CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
- // Get a reference to the container name.
- CloudBlobContainer container = blobClient.GetContainerReference(containerName);
+// Get a reference to the container name.
+CloudBlobContainer container = blobClient.GetContainerReference(containerName);
- // Get a reference to the block blob name.
- CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobName);
+// Get a reference to the block blob name.
+CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobName);
- // Open a file stream to save the downloaded blob content.
- using (var fileStream = File.OpenWrite("sample.pdf"))
- {
- // Download the blob's content to the file stream.
- blockBlob.DownloadToStream(fileStream);
- }
+// Open a file stream to save the downloaded blob content.
+using (var fileStream = File.OpenWrite("sample.pdf"))
+{
+ // Download the blob's content to the file stream.
+ blockBlob.DownloadToStream(fileStream);
+}
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-dropbox-cloud-file-storage.md b/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-dropbox-cloud-file-storage.md
index 4fe84327c..f0627de28 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-dropbox-cloud-file-storage.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-dropbox-cloud-file-storage.md
@@ -5,17 +5,14 @@ platform: document-processing
control: PDF
documentation: UG
---
-# Open PDF file from Dropbox cloud file storage
+# Open PDF from Dropbox cloud file storage
To Open a PDF file from Dropbox cloud file storage, you can follow the steps below
Step 1: Create a Dropbox API
-
To create a Dropbox API App, you should follow the official documentation provided by Dropbox [link](https://www.dropbox.com/developers/documentation/dotnet#tutorial). The process involves visiting the Dropbox Developer website and using their App Console to set up your API app. This app will allow you to interact with Dropbox programmatically, enabling secure access to files and data.
-
-
Step 2: Create a simple console application

@@ -29,42 +26,42 @@ Step 4: Include the following namespaces in the Program.cs file.
{% highlight c# tabtitle="C# [Cross-platform]" %}
- using Dropbox.Api;
+using Dropbox.Api;
{% endhighlight %}
{% endtabs %}
-Step 5: Add the below code example to load a PDF ifrom Dropbox cloud file storage.
+Step 5: Add the below code example to load a PDF from Dropbox cloud file storage.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- // Define the access token for authentication with the Dropbox API
- var accessToken = "YOUR_ACCESS_TOKEN";// Replace with your actual access token
+// Define the access token for authentication with the Dropbox API
+var accessToken = "YOUR_ACCESS_TOKEN";// Replace with your actual access token
- // Define the file path in Dropbox where the PDF file is located
- var filePathInDropbox = "/path/to/save/Sample.pdf"; // Replace with the actual file path in Dropbox
- // Create a new DropboxClient instance using the provided access token
- using (var dbx = new DropboxClient(accessToken))
+// Define the file path in Dropbox where the PDF file is located
+var filePathInDropbox = "/path/to/save/Sample.pdf"; // Replace with the actual file path in Dropbox
+// Create a new DropboxClient instance using the provided access token
+using (var dbx = new DropboxClient(accessToken))
+{
+ // Start a download request for the specified file in Dropbox
+ using (var response = await dbx.Files.DownloadAsync(filePathInDropbox))
{
- // Start a download request for the specified file in Dropbox
- using (var response = await dbx.Files.DownloadAsync(filePathInDropbox))
+ // Get the content of the downloaded file as a stream
+ var content = await response.GetContentAsStreamAsync();
+ // Create a new file stream to save the downloaded content locally
+ using (var fileStream = File.Create("Output.pdf"))
{
- // Get the content of the downloaded file as a stream
- var content = await response.GetContentAsStreamAsync();
- // Create a new file stream to save the downloaded content locally
- using (var fileStream = File.Create("Output.pdf"))
- {
- // Copy the content stream to the file stream
- content.CopyTo(fileStream);
- // Close the file stream once the content is copied
- fileStream.Close();
- }
+ // Copy the content stream to the file stream
+ content.CopyTo(fileStream);
+ // Close the file stream once the content is copied
+ fileStream.Close();
}
}
+}
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-google-cloud-storage.md b/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-google-cloud-storage.md
index 9c93ae372..5c2a70da6 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-google-cloud-storage.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-google-cloud-storage.md
@@ -5,11 +5,10 @@ platform: document-processing
control: PDF
documentation: UG
---
-# Open PDF file from Google Cloud storage
+# Open PDF from Google Cloud storage
To Open a PDF file from Google cloud storage, you can follow the steps below
-
Step 1: Create a simple console application

@@ -18,15 +17,14 @@ Step 3: Install the [Google.Cloud.Storage.V1](https://www.nuget.org/packages/Goo

-
Step 4: Include the following namespaces in the Program.cs file.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- using Google.Cloud.Storage.V1;
- using Google.Apis.Auth.OAuth2;
+using Google.Cloud.Storage.V1;
+using Google.Apis.Auth.OAuth2;
{% endhighlight %}
@@ -39,23 +37,23 @@ Step 5: Add the below code example to create a simple PDF and save in Google clo
{% highlight c# tabtitle="C# [Cross-platform]" %}
- // Create a byte array
- byte[] pdfBytes;
- // Load the credentials file
- GoogleCredential credential = GoogleCredential.FromFile("credentials.json");
- // Create a storage client
- StorageClient storage = StorageClient.Create(credential);
- // Download the PDF from Google Cloud Storage
- using (MemoryStream stream = new MemoryStream())
- {
- storage.DownloadObject("bucket50247", "Sample.pdf", stream);
- pdfBytes = stream.ToArray();
- }
-
- string filePath = "Sample.pdf";
-
- // Write the byte array to a PDF file
- File.WriteAllBytes(filePath, pdfBytes);
+// Create a byte array
+byte[] pdfBytes;
+// Load the credentials file
+GoogleCredential credential = GoogleCredential.FromFile("credentials.json");
+// Create a storage client
+StorageClient storage = StorageClient.Create(credential);
+// Download the PDF from Google Cloud Storage
+using (MemoryStream stream = new MemoryStream())
+{
+ storage.DownloadObject("bucket50247", "Sample.pdf", stream);
+ pdfBytes = stream.ToArray();
+}
+
+string filePath = "Sample.pdf";
+
+// Write the byte array to a PDF file
+File.WriteAllBytes(filePath, pdfBytes);
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-google-drive.md b/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-google-drive.md
index c41da9125..a3584a132 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-google-drive.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Open-pdf-files/From-google-drive.md
@@ -5,7 +5,7 @@ platform: document-processing
control: PDF
documentation: UG
---
-# Open PDF file from Google Drive
+# Open PDF from Google Drive
To Open a PDF file from Google Drive, you can follow the steps below
@@ -21,72 +21,70 @@ Step 3: Install the [Google.Apis.Drive.v3](https://www.nuget.org/packages/Google

-
Step 4: Include the following namespaces in the Program.cs file.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- using Google.Apis.Auth.OAuth2;
- using Google.Apis.Drive.v3;
- using Google.Apis.Services;
- using Google.Apis.Util.Store;
+using Google.Apis.Auth.OAuth2;
+using Google.Apis.Drive.v3;
+using Google.Apis.Services;
+using Google.Apis.Util.Store;
{% endhighlight %}
{% endtabs %}
-
Step 5: Add the below code example to open a PDF from google drive.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- UserCredential credential;
- string[] Scopes = { DriveService.Scope.DriveReadonly };
- string ApplicationName = "YourAppName";
-
- using (var stream1 = new FileStream("credentials.json", FileMode.Open, FileAccess.Read))
- {
- string credPath = "token.json";
- credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
- GoogleClientSecrets.Load(stream1).Secrets,
- Scopes,
- "user",
- CancellationToken.None,
- new FileDataStore(credPath, true)).Result;
- }
-
- // Step 2: Create Drive API service
- var service = new DriveService(new BaseClientService.Initializer()
- {
- HttpClientInitializer = credential,
- ApplicationName = ApplicationName,
- });
-
- // Step 3: Specify the file ID of the PDF you want to open
- string fileId = "YOUR_FILE_ID"; // Replace with the actual file ID YOUR_FILE_ID
-
- // Step 4: Download the PDF file from Google Drive
- var request = service.Files.Get(fileId);
- var stream = new MemoryStream();
- request.Download(stream);
-
- // Step 5: Open the PDF with Syncfusion
- //PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
-
- // Use the loadedDocument for further processing (e.g., extracting text or images)
-
- // Remember to dispose of the loadedDocument when you're done
- //loadedDocument.Close(true);
-
- // Step 5: Save the PDF locally
- using (FileStream fileStream = new FileStream("output.pdf", FileMode.Create, FileAccess.Write))
- {
- stream.WriteTo(fileStream);
- }
+UserCredential credential;
+string[] Scopes = { DriveService.Scope.DriveReadonly };
+string ApplicationName = "YourAppName";
+
+using (var stream1 = new FileStream("credentials.json", FileMode.Open, FileAccess.Read))
+{
+ string credPath = "token.json";
+ credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
+ GoogleClientSecrets.Load(stream1).Secrets,
+ Scopes,
+ "user",
+ CancellationToken.None,
+ new FileDataStore(credPath, true)).Result;
+}
+
+// Step 2: Create Drive API service
+var service = new DriveService(new BaseClientService.Initializer()
+{
+ HttpClientInitializer = credential,
+ ApplicationName = ApplicationName,
+});
+
+// Step 3: Specify the file ID of the PDF you want to open
+string fileId = "YOUR_FILE_ID"; // Replace with the actual file ID YOUR_FILE_ID
+
+// Step 4: Download the PDF file from Google Drive
+var request = service.Files.Get(fileId);
+var stream = new MemoryStream();
+request.Download(stream);
+
+// Step 5: Open the PDF with Syncfusion
+//PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
+
+// Use the loadedDocument for further processing (e.g., extracting text or images)
+
+// Remember to dispose of the loadedDocument when you're done
+//loadedDocument.Close(true);
+
+// Step 5: Save the PDF locally
+using (FileStream fileStream = new FileStream("output.pdf", FileMode.Create, FileAccess.Write))
+{
+ stream.WriteTo(fileStream);
+}
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-AWS-S3.md b/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-AWS-S3.md
index 671681c49..ef9fe58e7 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-AWS-S3.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-AWS-S3.md
@@ -1,15 +1,14 @@
---
title: Save PDF file to AWS S3 | Syncfusion
-description: This page describes how to save PDF file to file AWS S3 in C# using Syncfusion .NET PDF library.
+description: This page describes how to save PDF file to file AWS S3 bucket in C# using Syncfusion .NET PDF library.
platform: document-processing
control: PDF
documentation: UG
---
-# Save PDF file to AWS S3
+# Save PDF to an AWS S3 bucket
To save a PDF file to AWS S3, you can follow the steps below
-
Step 1: Create a simple console application

@@ -20,34 +19,32 @@ Step 2: Install the [Syncfusion.Pdf.Net.Core ](https://www.nuget.org/packages/Sy

-
Step 3: Include the following namespaces in the Program.cs file.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- using Syncfusion.Pdf.Graphics;
- using Syncfusion.Pdf;
- using Amazon.S3;
- using Syncfusion.Drawing;
- using Amazon.S3.Transfer;
- using Amazon;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using Amazon.S3;
+using Syncfusion.Drawing;
+using Amazon.S3.Transfer;
+using Amazon;
{% endhighlight %}
{% endtabs %}
-
Step 4: Add the below code example to create a simple PDF and save in AWS S3.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- // Create a new PDF document
- using (PdfDocument document = new PdfDocument())
- {
+// Create a new PDF document
+using (PdfDocument document = new PdfDocument())
+{
// Add a page to the document
PdfPage page = document.Pages.Add();
@@ -85,11 +82,6 @@ Step 4: Add the below code example to create a simple PDF and save in AWS S3.
}
}
}
-
-
-
-
-
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-azure-blob-storage.md b/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-azure-blob-storage.md
index cdc1c6655..2176fa1ad 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-azure-blob-storage.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-azure-blob-storage.md
@@ -5,11 +5,10 @@ platform: document-processing
control: PDF
documentation: UG
---
-# Save PDF file to Azure Blob storage
+# Save PDF to Azure Blob storage
To save a PDF file to Azure blob storage, you can follow the steps below
-
Step 1: Create a simple console application

@@ -26,11 +25,11 @@ Step 4: Include the following namespaces in the Program.cs file.
{% highlight c# tabtitle="C# [Cross-platform]" %}
- using Syncfusion.Pdf;
- using Syncfusion.Pdf.Graphics;
- using Syncfusion.Drawing;
- using Microsoft.Azure.Storage;
- using Microsoft.Azure.Storage.Blob;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+using Microsoft.Azure.Storage;
+using Microsoft.Azure.Storage.Blob;
{% endhighlight %}
@@ -43,40 +42,40 @@ Step 5: Add the below code example to create a simple PDF and save in Azure blob
{% highlight c# tabtitle="C# [Cross-platform]" %}
- // Create a new PDF document
- using (PdfDocument doc = new PdfDocument())
- {
- // Add a page to the document.
- PdfPage page = doc.Pages.Add();
- // Get the graphics object for drawing on the page.
- PdfGraphics graphics = page.Graphics;
- // Create a font to use for drawing text
- PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
- // Draw the text.
- graphics.DrawString("Hello, World!", font, PdfBrushes.Black, new PointF(10, 10));
- // Create a memory stream to save the PDF document.
- MemoryStream stream = new MemoryStream();
- doc.Save(stream);
- // Write the contents of the memory stream to a file named "sample.pdf".
- File.WriteAllBytes("sample.pdf", stream.ToArray());
- // Close the document
- doc.Close(true);
- }
- // Parse the connection string for the Azure Storage Account.
- CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
- // Create a client for accessing Blob storage.
- CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
- // Get a reference to the container name.
- CloudBlobContainer container = blobClient.GetContainerReference(containerName);
- container.CreateIfNotExists();
- // Get a reference to the block blob name.
- CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobName);
- // Open the local file "sample.pdf" for reading
- using (var fileStream = File.OpenRead("sample.pdf"))
- {
- // Upload the contents of the local file to the Azure Blob Storage
- blockBlob.UploadFromStream(fileStream);
- }
+// Create a new PDF document
+using (PdfDocument doc = new PdfDocument())
+{
+ // Add a page to the document.
+ PdfPage page = doc.Pages.Add();
+ // Get the graphics object for drawing on the page.
+ PdfGraphics graphics = page.Graphics;
+ // Create a font to use for drawing text
+ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
+ // Draw the text.
+ graphics.DrawString("Hello, World!", font, PdfBrushes.Black, new PointF(10, 10));
+ // Create a memory stream to save the PDF document.
+ MemoryStream stream = new MemoryStream();
+ doc.Save(stream);
+ // Write the contents of the memory stream to a file named "sample.pdf".
+ File.WriteAllBytes("sample.pdf", stream.ToArray());
+ // Close the document
+ doc.Close(true);
+}
+// Parse the connection string for the Azure Storage Account.
+CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
+// Create a client for accessing Blob storage.
+CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
+// Get a reference to the container name.
+CloudBlobContainer container = blobClient.GetContainerReference(containerName);
+container.CreateIfNotExists();
+// Get a reference to the block blob name.
+CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobName);
+// Open the local file "sample.pdf" for reading
+using (var fileStream = File.OpenRead("sample.pdf"))
+{
+ // Upload the contents of the local file to the Azure Blob Storage
+ blockBlob.UploadFromStream(fileStream);
+}
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-dropbox-cloud-file-storage.md b/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-dropbox-cloud-file-storage.md
index 7db51e8f9..b1bd65c33 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-dropbox-cloud-file-storage.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-dropbox-cloud-file-storage.md
@@ -5,17 +5,14 @@ platform: document-processing
control: PDF
documentation: UG
---
-# Save PDF file to Dropbox cloud file storage
+# Save PDF to Dropbox cloud file storage
To save a PDF file to Dropbox cloud file storage, you can follow the steps below
Step 1: Create a Dropbox API
-
To create a Dropbox API App, you should follow the official documentation provided by Dropbox [link](https://www.dropbox.com/developers/documentation/dotnet#tutorial). The process involves visiting the Dropbox Developer website and using their App Console to set up your API app. This app will allow you to interact with Dropbox programmatically, enabling secure access to files and data.
-
-
Step 2: Create a simple console application

@@ -30,48 +27,47 @@ Step 4: Include the following namespaces in the Program.cs file.
{% highlight c# tabtitle="C# [Cross-platform]" %}
- using Syncfusion.Pdf.Graphics;
- using Syncfusion.Pdf;
- using Dropbox.Api;
- using Dropbox.Api.Files;
- using Syncfusion.Drawing;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using Dropbox.Api;
+using Dropbox.Api.Files;
+using Syncfusion.Drawing;
{% endhighlight %}
{% endtabs %}
-
Step 5: Add the below code example to create a simple PDF and save in Dropbox cloud file storage.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- // Create a new PDF document.
- PdfDocument doc = new PdfDocument();
- // Add a new page to the document.
- PdfPage page = doc.Pages.Add();
- // Get the graphics object for the page to draw on.
- PdfGraphics graphics = page.Graphics;
- // Create a font for drawing text.
- PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
- // Draw the text
- graphics.DrawString("Hello, World!", font, PdfBrushes.Black, new PointF(10, 10));
- // Save the PDF to a memory stream.
- MemoryStream stream = new MemoryStream();
- doc.Save(stream);
- // Close the PDF document.
- doc.Close(true);
- var accessToken = "YOUR_ACCESS_TOKEN";// Replace with your actual access token
- // Initialize a DropboxClient with the provided access token.
- using (var dbx = new DropboxClient(accessToken))
- {
- // Upload the PDF to Dropbox.
- var uploadResult = await dbx.Files.UploadAsync(
+// Create a new PDF document.
+PdfDocument doc = new PdfDocument();
+// Add a new page to the document.
+PdfPage page = doc.Pages.Add();
+// Get the graphics object for the page to draw on.
+PdfGraphics graphics = page.Graphics;
+// Create a font for drawing text.
+PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
+// Draw the text
+graphics.DrawString("Hello, World!", font, PdfBrushes.Black, new PointF(10, 10));
+// Save the PDF to a memory stream.
+MemoryStream stream = new MemoryStream();
+doc.Save(stream);
+// Close the PDF document.
+doc.Close(true);
+var accessToken = "YOUR_ACCESS_TOKEN";// Replace with your actual access token
+// Initialize a DropboxClient with the provided access token.
+using (var dbx = new DropboxClient(accessToken))
+{
+ // Upload the PDF to Dropbox.
+ var uploadResult = await dbx.Files.UploadAsync(
"/path/to/save/Sample.pdf",
WriteMode.Overwrite.Instance,
body: new MemoryStream(stream.ToArray()));
- }
+}
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-google-cloud-storage.md b/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-google-cloud-storage.md
index 3b6573552..cce3938fb 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-google-cloud-storage.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-google-cloud-storage.md
@@ -5,11 +5,10 @@ platform: document-processing
control: PDF
documentation: UG
---
-# Save PDF file to Google Cloud storage
+# Save PDF to Google Cloud storage
To save a PDF file to Google cloud storage, you can follow the steps below
-
Step 1: Create a simple console application

@@ -19,57 +18,53 @@ Step 3: Install the [Syncfusion.Pdf.Net.Core ](https://www.nuget.org/packages/Sy

-
Step 4: Include the following namespaces in the Program.cs file.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- using Syncfusion.Pdf;
- using Google.Cloud.Storage.V1;
- using Syncfusion.Pdf.Graphics;
- using Google.Apis.Auth.OAuth2;
- using Syncfusion.Drawing;
- using System.IO;
+using Syncfusion.Pdf;
+using Google.Cloud.Storage.V1;
+using Syncfusion.Pdf.Graphics;
+using Google.Apis.Auth.OAuth2;
+using Syncfusion.Drawing;
+using System.IO;
{% endhighlight %}
{% endtabs %}
-
Step 5: Add the below code example to create a simple PDF and save in Google cloud storage.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- // Step 1: Create a PDF document
- PdfDocument document = new PdfDocument();
-
- // Step 2: Add a page
- PdfPage page = document.Pages.Add();
-
- // Step 3: Add content to the page (e.g., text, images, etc.)
- PdfGraphics graphics = page.Graphics;
- graphics.DrawString("Hello, World!", new PdfStandardFont(PdfFontFamily.Helvetica, 12), PdfBrushes.Black, new PointF(10, 10));
+// Step 1: Create a PDF document
+PdfDocument document = new PdfDocument();
- // Step 4: Save the PDF to a memory stream
- MemoryStream stream = new MemoryStream();
- document.Save(stream);
- document.Close(true);
+// Step 2: Add a page
+PdfPage page = document.Pages.Add();
- // Step 5: Upload the PDF to Google Cloud Storage
- // Load the credentials file
- GoogleCredential credential = GoogleCredential.FromFile("credentials.json");//Replace with your actual credentials.json
+// Step 3: Add content to the page (e.g., text, images, etc.)
+PdfGraphics graphics = page.Graphics;
+graphics.DrawString("Hello, World!", new PdfStandardFont(PdfFontFamily.Helvetica, 12), PdfBrushes.Black, new PointF(10, 10));
- // Create a storage client
- StorageClient storage = StorageClient.Create(credential);
+// Step 4: Save the PDF to a memory stream
+MemoryStream stream = new MemoryStream();
+document.Save(stream);
+document.Close(true);
- // Upload the PDF to the specified bucket and object name
- storage.UploadObject("bucketName", "Sample.pdf", null, stream);//
+// Step 5: Upload the PDF to Google Cloud Storage
+// Load the credentials file
+GoogleCredential credential = GoogleCredential.FromFile("credentials.json");//Replace with your actual credentials.json
+// Create a storage client
+StorageClient storage = StorageClient.Create(credential);
+// Upload the PDF to the specified bucket and object name
+storage.UploadObject("bucketName", "Sample.pdf", null, stream);//
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-google-drive.md b/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-google-drive.md
index c8c288478..974927405 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-google-drive.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Save-pdf-files/To-google-drive.md
@@ -5,7 +5,7 @@ platform: document-processing
control: PDF
documentation: UG
---
-# Save PDF file to Google Drive
+# Save PDF to Google Drive
To save a PDF file to Google Drive, you can follow the steps below
@@ -22,88 +22,85 @@ Step 3: Install the [Syncfusion.Pdf.Net.Core ](https://www.nuget.org/packages/Sy

-
Step 4: Include the following namespaces in the Program.cs file.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- using Syncfusion.Pdf;
- using Syncfusion.Pdf.Graphics;
- using Google.Apis.Auth.OAuth2;
- using Google.Apis.Drive.v3;
- using Google.Apis.Services;
- using Google.Apis.Util.Store;
- using File = Google.Apis.Drive.v3.Data.File;
- using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Google.Apis.Auth.OAuth2;
+using Google.Apis.Drive.v3;
+using Google.Apis.Services;
+using Google.Apis.Util.Store;
+using File = Google.Apis.Drive.v3.Data.File;
+using Syncfusion.Drawing;
{% endhighlight %}
{% endtabs %}
-
Step 5: Add the below code example to create a simple PDF and save in google drive.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
- // Create a new PDF document
- PdfDocument document = new PdfDocument();
- // Add a new page to the document
- PdfPage page = document.Pages.Add();
- // Get graphics object for the page
- PdfGraphics graphics = page.Graphics;
- // Draw text on the page
- graphics.DrawString("Hello, World!", new PdfStandardFont(PdfFontFamily.Helvetica, 12), PdfBrushes.Black, new PointF(10, 10));
- // Create a memory stream to save the PDF document
- MemoryStream stream = new MemoryStream();
- // Save the document to the memory stream
- document.Save(stream);
- // Close the document
- document.Close(true);
-
- // Load Google Drive API credentials from a file
- UserCredential credential;
- string[] Scopes = { DriveService.Scope.Drive };
- string ApplicationName = "YourAppName";
-
- using (var stream1 = new FileStream("credentials.json", FileMode.Open, FileAccess.Read))//Replace with your actual credentials.json
- {
- string credPath = "token.json";
- // Authorize the Google Drive API access
- credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
- GoogleClientSecrets.Load(stream1).Secrets,
- Scopes,
- "user",
- CancellationToken.None,
- new FileDataStore(credPath, true)).Result;
- }
- // Create a new instance of Google Drive service
- var service = new DriveService(new BaseClientService.Initializer()
- {
- HttpClientInitializer = credential,
- ApplicationName = ApplicationName,
- });
-
-
- // Create metadata for the file to be uploaded
- var fileMetadata = new File()
- {
- Name = "Sample1.pdf", // Name of the file in Google Drive
- MimeType = "application/pdf",
- };
- FilesResource.CreateMediaUpload request;
-
- // Create a memory stream from the PDF document
- using (var fs = new MemoryStream(stream.ToArray()))
- {
- // Create an upload request for Google Drive
- request = service.Files.Create(fileMetadata, fs, "application/pdf");
- // Upload the file
- request.Upload();
- }
+// Create a new PDF document
+PdfDocument document = new PdfDocument();
+// Add a new page to the document
+PdfPage page = document.Pages.Add();
+// Get graphics object for the page
+PdfGraphics graphics = page.Graphics;
+// Draw text on the page
+graphics.DrawString("Hello, World!", new PdfStandardFont(PdfFontFamily.Helvetica, 12), PdfBrushes.Black, new PointF(10, 10));
+// Create a memory stream to save the PDF document
+MemoryStream stream = new MemoryStream();
+// Save the document to the memory stream
+document.Save(stream);
+// Close the document
+document.Close(true);
+
+// Load Google Drive API credentials from a file
+UserCredential credential;
+string[] Scopes = { DriveService.Scope.Drive };
+string ApplicationName = "YourAppName";
+
+using (var stream1 = new FileStream("credentials.json", FileMode.Open, FileAccess.Read))//Replace with your actual credentials.json
+{
+ string credPath = "token.json";
+ // Authorize the Google Drive API access
+ credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
+ GoogleClientSecrets.Load(stream1).Secrets,
+ Scopes,
+ "user",
+ CancellationToken.None,
+ new FileDataStore(credPath, true)).Result;
+}
+// Create a new instance of Google Drive service
+var service = new DriveService(new BaseClientService.Initializer()
+{
+ HttpClientInitializer = credential,
+ ApplicationName = ApplicationName,
+});
+
+// Create metadata for the file to be uploaded
+var fileMetadata = new File()
+{
+ Name = "Sample1.pdf", // Name of the file in Google Drive
+ MimeType = "application/pdf",
+};
+FilesResource.CreateMediaUpload request;
+
+// Create a memory stream from the PDF document
+using (var fs = new MemoryStream(stream.ToArray()))
+{
+ // Create an upload request for Google Drive
+ request = service.Files.Create(fileMetadata, fs, "application/pdf");
+ // Upload the file
+ request.Upload();
+}
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/AWS-Textract.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/AWS-Textract.md
index 61912e2a3..4a0a5d953 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/AWS-Textract.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/AWS-Textract.md
@@ -40,8 +40,7 @@ Step 4: Use the following code sample to perform OCR on a PDF document using [Pe
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Region.pdf", FileMode.Open);
- PdfLoadedDocument lDoc = new PdfLoadedDocument(stream);
+ PdfLoadedDocument lDoc = new PdfLoadedDocument("Input.pdf");
//Set the OCR language.
processor.Settings.Language = Languages.English;
//Initialize the AWS Textract external OCR engine.
@@ -49,14 +48,11 @@ using (OCRProcessor processor = new OCRProcessor())
processor.ExternalEngine = azureOcrEngine;
//Perform OCR with input document.
string text = processor.PerformOCR(lDoc);
- //Create file stream.
- FileStream fileStream = new FileStream("Output.pdf", FileMode.CreateNew);
+
//Save the document into stream.
- lDoc.Save(fileStream);
+ lDoc.Save("Output.pdf");
//Close the document.
lDoc.Close();
- stream.Dispose();
- fileStream.Dispose();
}
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Azure-Kubernetes-Service.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Azure-Kubernetes-Service.md
index d832804f4..8479c43f0 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Azure-Kubernetes-Service.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Azure-Kubernetes-Service.md
@@ -93,10 +93,9 @@ public ActionResult PerformOCR()
lDoc.Close();
//Set the position as '0'
stream.Position = 0;
- //Download the PDF document in the browser
- FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/pdf");
- fileStreamResult.FileDownloadName = "Sample.pdf";
- return fileStreamResult;
+
+ // Return file result
+ return File(stream.ToArray(), "application/pdf", "Sample.pdf");
}
}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Azure-Vision.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Azure-Vision.md
index c2a02c3a4..3e0dcd603 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Azure-Vision.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Azure-Vision.md
@@ -40,8 +40,7 @@ Step 4: Use the following code sample to perform OCR on a PDF document using [Pe
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument lDoc = new PdfLoadedDocument(stream);
+ PdfLoadedDocument lDoc = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Initialize the Azure vision OCR external engine.
@@ -49,15 +48,11 @@ using (OCRProcessor processor = new OCRProcessor())
processor.ExternalEngine = azureOcrEngine;
//Perform OCR.
processor.PerformOCR(lDoc);
- //Create file stream.
- FileStream outputStream = new FileStream("OCR.pdf", FileMode.CreateNew);
+
//Save the document into stream.
- lDoc.Save(outputStream);
- //If the position is not set to '0' then the PDF will be empty.
- outputStream.Position = 0;
+ lDoc.Save("Output.pdf");
//Close the document.
lDoc.Close(true);
- outputStream.Close();
}
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Features.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Features.md
index 76588446a..a03afe40b 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Features.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Features.md
@@ -17,22 +17,20 @@ To perform OCR for an entire PDF document using [PerformOCR](https://help.syncfu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/OCR/.NET/Perform-OCR-for-the-entire-PDF-document/Perform-OCR-for-the-entire-PDF-document/Program.cs, 300" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -41,20 +39,19 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
'Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document)
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+ 'Save the PDF document.
+ document.Save("Output.pdf)
'Close the document
document.Close(True)
End Using
@@ -75,12 +72,14 @@ To perform OCR on a particular region or several regions of a PDF page with the
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/OCR/.NET/Perform-OCR-on-particular-region-of-PDF-document/Perform-OCR-on-particular-region-of-PDF-document/Program.cs, 300" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
@@ -101,12 +100,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf");
//Close the document.
document.Close(true);
}
@@ -115,11 +110,14 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
@@ -140,11 +138,8 @@ Using processor As OCRProcessor = New OCRProcessor()
'Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document)
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+ 'Save the PDF document.
+ document.Save("Output.pdf)
'Close the document.
document.Close(True)
End Using
@@ -167,12 +162,14 @@ The following code sample demonstrates the OCR processor with Tesseract version
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
@@ -181,12 +178,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document, tessdata (Language packs) and enabling isMemoryOptimized property.
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -195,11 +188,13 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor with tesseract binaries folder path.
Using processor As OCRProcessor = New OCRProcessor("TesseractBinaries/3.05/")
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
@@ -208,11 +203,9 @@ Using processor As OCRProcessor = New OCRProcessor("TesseractBinaries/3.05/")
'Perform OCR with input document, tessdata (Language packs) and enabling isMemoryOptimized property.
processor.PerformOCR(document)
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -233,12 +226,14 @@ The following code sample explains the OCR processor with Tesseract version 4.0
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
@@ -247,12 +242,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document, tessdata (Language packs) and enabling isMemoryOptimized property.
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -261,11 +252,13 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor with tesseract binaries folder path.
Using processor As OCRProcessor = New OCRProcessor("TesseractBinaries/4.0/")
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
@@ -273,12 +266,9 @@ Using processor As OCRProcessor = New OCRProcessor("TesseractBinaries/4.0/")
processor.Settings.TesseractVersion = TesseractVersion.Version4_0
'Perform OCR with input document, tessdata (Language packs) and enabling isMemoryOptimized property.
processor.PerformOCR(document)
-
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -295,6 +285,9 @@ The below code example illustrates how to perform OCR on image file using [Perfo
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/OCR/.NET/Perform-OCR-on-image-file/Perform-OCR-on-image-file/Program.cs, 300" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
@@ -310,6 +303,9 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load the input image.
@@ -332,6 +328,9 @@ You can get the OCRed Unicode text from an image file by using the ``UnicodeFont
{% highlight c# tabtitle="ASP.NET Core" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
@@ -376,23 +375,21 @@ N> Memory optimization for performing OCR on large PDF documents is not supporte
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Perform OCR with input document, tessdata (Language packs) and enable isMemoryOptimized property.
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -400,23 +397,21 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
'Perform OCR with input document, tessdata (Language packs) and enable isMemoryOptimized property.
processor.PerformOCR(document)
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
-
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -433,12 +428,14 @@ You can get the OCRed text from the rotated page of PDF document using the [Page
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Set OCR page auto detection rotation.
@@ -446,12 +443,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -460,12 +453,14 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
'Set OCR page auto detection rotation.
@@ -473,11 +468,8 @@ Using processor As OCRProcessor = New OCRProcessor()
'Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document)
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+ 'Save the PDF document to file stream.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
@@ -499,13 +491,15 @@ For more details, refer to the following code sample.
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
// Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
// Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
- PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(stream);
+ PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument("Input.pdf");
// Set the path to the tessdata folder.
processor.TessDataPath = @"/path/to/tessdata-fast/or/tessdata-best";
@@ -513,12 +507,8 @@ using (OCRProcessor processor = new OCRProcessor())
// Perform OCR on the loaded PDF document.
processor.PerformOCR(pdfLoadedDocument);
- // Create a file stream to save the processed PDF document.
- using (FileStream outputFileStream = new FileStream(@"Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- // Save the processed PDF document to the specified file stream.
- pdfLoadedDocument.Save(outputFileStream);
- }
+ // Save the processed PDF document.
+ pdfLoadedDocument.Save("Output.pdf");
// Close the loaded PDF document.
pdfLoadedDocument.Close(true);
}
@@ -527,12 +517,14 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
' Initialize the OCR processor.
Using processor As New OCRProcessor()
' Load an existing PDF document.
- Dim stream As New FileStream("Input.pdf", FileMode.Open, FileAccess.Read)
- Dim pdfLoadedDocument As New PdfLoadedDocument(stream)
+ Dim pdfLoadedDocument As New PdfLoadedDocument("Input.pdf")
' Set the path to the tessdata folder.
processor.TessDataPath = "/path/to/tessdata-fast/or/tessdata-best"
@@ -540,11 +532,8 @@ Using processor As New OCRProcessor()
' Perform OCR on the loaded PDF document.
processor.PerformOCR(pdfLoadedDocument)
- ' Create a file stream to save the processed PDF document.
- Using outputFileStream As New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- ' Save the processed PDF document to the specified file stream.
- pdfLoadedDocument.Save(outputFileStream)
- End Using
+ ' Save the processed PDF document.
+ pdfLoadedDocument.Save("Output.pdf")
' Close the loaded PDF document.
pdfLoadedDocument.Close(True)
@@ -563,12 +552,14 @@ You can get the OCRed text and its bounds from a scanned PDF document by using t
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
@@ -585,12 +576,8 @@ using (OCRProcessor processor = new OCRProcessor())
RectangleF bounds = line.Rectangle;
}
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -599,12 +586,14 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
'Create the layout result.
@@ -619,11 +608,8 @@ Using processor As OCRProcessor = New OCRProcessor()
Dim bounds As RectangleF = line.Rectangle
Next
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -652,12 +638,14 @@ The following code sample demonstrates the OCR processor with native call suppor
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Set tesseract OCR Engine.
@@ -665,12 +653,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document, tessdata (Language packs) and enabling isMemoryOptimized property.
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -679,24 +663,23 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
'Set tesseract OCR Engine.
processor.Settings.TesseractVersion = TesseractVersion.Version3_02
'Perform OCR with input document, tessdata (Language packs) and enabling isMemoryOptimized property.
processor.PerformOCR(document)
-
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -715,12 +698,14 @@ The following code sample demonstrates the OCR processor with native call suppor
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Set tesseract OCR Engine.
@@ -730,12 +715,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document, tessdata (Language packs) and enabling isMemoryOptimized property.
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -744,12 +725,14 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor with tesseract binaries folder path.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
'Set tesseract OCR Engine.
@@ -759,11 +742,8 @@ Using processor As OCRProcessor = New OCRProcessor()
'Perform OCR with input document, tessdata (Language packs) and enabling isMemoryOptimized property.
processor.PerformOCR(document)
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -785,24 +765,22 @@ While performing OCR on an existing scanned PDF document, the OCR Processor will
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Set custom temp file path location.
processor.Settings.TempFolder = "D:/Temp/";
//Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -811,24 +789,23 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
'Set custom temp file path location.
processor.Settings.TempFolder = "D:/Temp/"
'Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document)
-
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -910,12 +887,14 @@ N> The page segmentation mode is supported only in the Tesseract version 4.0 and
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//** For .NET Framework only **.
@@ -925,12 +904,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -939,12 +914,14 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
' ** For .NET Framework only **.
@@ -953,12 +930,9 @@ Using processor As OCRProcessor = New OCRProcessor()
processor.Settings.PageSegment = PageSegMode.AutoOsd
'Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document)
-
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -975,12 +949,14 @@ The [OCREngineMode](https://help.syncfusion.com/cr/document-processing/Syncfusio
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Set tesseract version. ** For .NET Framework only. **
@@ -990,12 +966,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -1004,12 +976,14 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
'Set tesseract version. ** For .NET Framework only. **
@@ -1018,12 +992,9 @@ Using processor As OCRProcessor = New OCRProcessor()
processor.Settings.OCREngineMode = OCREngineMode.LSTMOnly
'Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document)
-
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -1042,12 +1013,14 @@ The [WhiteList](https://help.syncfusion.com/cr/document-processing/Syncfusion.OC
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Set tesseract version. ** For .NET Framework only. **
@@ -1059,12 +1032,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -1073,12 +1042,14 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
'Set tesseract version. ** For .NET Framework only. **
@@ -1089,12 +1060,9 @@ Using processor As OCRProcessor = New OCRProcessor()
processor.Settings.WhiteList = "PDF"
'Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document)
-
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -1109,12 +1077,15 @@ The [BlackList](https://help.syncfusion.com/cr/document-processing/Syncfusion.OC
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Set tesseract version. ** For .NET Framework only. **
@@ -1126,12 +1097,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -1139,12 +1106,14 @@ using (OCRProcessor processor = new OCRProcessor())
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
'Load an existing PDF document.
- Dim stream As FileStream = New FileStream("Input.pdf", FileMode.Open)
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream)
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Set OCR language.
processor.Settings.Language = Languages.English
'Set tesseract version. ** For .NET Framework only. **
@@ -1156,11 +1125,8 @@ Using processor As OCRProcessor = New OCRProcessor()
'Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document)
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+ 'Save the PDF document.
+ document.Save("Output.pdf")
'Close the document.
document.Close(True)
End Using
@@ -1181,6 +1147,9 @@ The following code sample illustrates how to OCR an image to a PDF document:
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/OCR/.NET/OCR_Image_to_PDF/OCR_Image_to_PDF/Program.cs, 300" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
@@ -1197,12 +1166,8 @@ using (OCRProcessor processor = new OCRProcessor())
//Process OCR by providing the bitmap image.
PdfDocument document = processor.PerformOCR(imageStream);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream(@"Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document to file stream.
+ document.Save("Output.pdf");
//Close the document.
document.Close(true);
}
@@ -1210,6 +1175,9 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor.
Using processor As OCRProcessor = New OCRProcessor()
@@ -1226,11 +1194,8 @@ Using processor As OCRProcessor = New OCRProcessor()
'Process OCR by providing the bitmap image.
Dim document As PdfDocument = processor.PerformOCR(imageStream)
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+ 'Save the PDF document.
+ document.Save("Output.pdf))
'Close the document.
document.Close(True)
End Using
@@ -1248,12 +1213,14 @@ You can perform OCR on Images with Unicode characters. To preserve the Unicode c
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/OCR/.NET/Perform-OCR-an-image-and-convert-it-to-a-PDF-document/Perform-OCR-an-image-and-convert-it-to-a-PDF-document/Program.cs, 300" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.
using (OCRProcessor processor = new OCRProcessor())
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language.
processor.Settings.Language = Languages.English;
//Sets Unicode font to preserve the Unicode characters in a PDF document.
@@ -1262,24 +1229,14 @@ using (OCRProcessor processor = new OCRProcessor())
//Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document);
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
{% endhighlight %}
-{% highlight c# tabtitle="C# [Cross-platform]" %}
-
-//By default unicode characters can be extracted from image file in .NET Framework applications like WF, WPF, ASP.NET and ASP.NET MVC.
-
-{% endhighlight %}
-
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
//By default unicode characters can be extracted from image file in .NET Framework applications like WF, WPF, ASP.NET and ASP.NET MVC.
@@ -1315,6 +1272,9 @@ Refer to the following code sample to set the performance of the OCR.
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor
OCRProcessor processor = new OCRProcessor();
@@ -1325,6 +1285,9 @@ processor.Settings.Performance = Performance.Fast;
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor
Dim processor As New OCRProcessor()
@@ -1345,23 +1308,21 @@ N> You can get the TesseractBinaries or TessData files from the NuGet package ru
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor by providing the path of the tesseract binaries (SyncfusionTesseract.dll and liblept168.dll)
using (OCRProcessor processor = new OCRProcessor(@"TesseractBinaries\"))
{
//Load an existing PDF document.
- FileStream stream = new FileStream("Input.pdf", FileMode.Open);
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set OCR language to process.
processor.Settings.Language = Languages.English;
//Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document, @"TessData\");
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
//Close the document.
document.Close(true);
}
@@ -1370,6 +1331,9 @@ using (OCRProcessor processor = new OCRProcessor(@"TesseractBinaries\"))
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor
Using processor As OCRProcessor = New OCRProcessor("TesseractBinaries\")
'Load an existing PDF document.
@@ -1380,11 +1344,8 @@ Using processor As OCRProcessor = New OCRProcessor("TesseractBinaries\")
'Perform OCR with input document and tessdata (Language packs).
processor.PerformOCR(document, "TessData\")
- 'Create file stream.
- Using outputFileStream As FileStream = New FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)
- 'Save the PDF document to file stream.
- document.Save(outputFileStream)
- End Using
+ 'Save the PDF document.
+ document.Save("Output.pdf))
'Close the document.
document.Close(True)
End Using
@@ -1401,13 +1362,14 @@ To get the Image rotation angle, you can rotate the image with 4 angles (0,90,18
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/OCR/.NET/Get-image-rotation-angle-from-OCR/Get-image-rotation-angle-from-OCR/Program.cs, 300" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
+
//Initialize the OCR processor.@
using (OCRProcessor processor = new OCRProcessor())
{
- //Get the stream from an image file.
- FileStream stream = new FileStream(@"D:\Input.pdf", FileMode.Open);
- //Set the OCR language to process.
- PdfLoadedDocument document = new PdfLoadedDocument(stream);
+ //Load an existing PDF document.
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Set the OCR language.
processor.Settings.Language = Languages.English;
//Set the Unicode font to preserve the Unicode characters in a PDF document.
@@ -1425,25 +1387,21 @@ using (OCRProcessor processor = new OCRProcessor())
}
}
}
- //Create file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
- }
+ //Save the PDF document.
+ document.Save("Output.pdf);
}
-
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
'Initialize the OCR processor
Using processor As OCRProcessor = New OCRProcessor()
- 'Get the stream from an image file.
- Dim stream As FileStream = New FileStream(@"D:\Input.pdf", FileMode.Open);
- 'Set the OCR language to process.
- Dim document As PdfLoadedDocument = New PdfLoadedDocument(stream);
+ 'Load an existing PDF document..
+ Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf");
'Set the OCR language.
processor.Settings.Language = Languages.English;
'Set the Unicode font to preserve the Unicode characters in a PDF document.
@@ -1479,64 +1437,58 @@ We have support to improve the image quality while performing OCR for an image o
{% tabs %}
-{% highlight c# tabtitle="C# [Cross-platform]" %}
+{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/OCR/.NET/Perform-OCR-ImageEnhancement/OCR_ImageEnhancement/Program.cs, 300" %}
+
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
- //Initialize the OCR processor.
- using (OCRProcessor processor = new OCRProcessor())
- {
- //Load an existing PDF document.
- FileStream stream = new FileStream("../../../document.pdf", FileMode.Open);
- PdfLoadedDocument lDoc = new PdfLoadedDocument(stream);
- //Set the OCR language.
- processor.Settings.Language = Languages.English;
- processor.ImageProcessor = new ImageProcessor();
- //Perform OCR with input document.
- string text = processor.PerformOCR(lDoc);
- //Create file stream.
- FileStream fileStream = new FileStream("../../../OCR.pdf", FileMode.CreateNew);
- //Save the document into stream.
- lDoc.Save(fileStream);
- //Close the document.
- lDoc.Close(true);
- stream.Dispose();
- fileStream.Dispose();
- }
+//Initialize the OCR processor.
+using (OCRProcessor processor = new OCRProcessor())
+{
+ //Load an existing PDF document.
+ PdfLoadedDocument lDoc = new PdfLoadedDocument("Input.pdf");
+ //Set the OCR language.
+ processor.Settings.Language = Languages.English;
+ processor.ImageProcessor = new ImageProcessor();
+ //Perform OCR with input document.
+ string text = processor.PerformOCR(lDoc);
+
+ //Save the document.
+ lDoc.Save("Output.pdf");
+ //Close the document.
+ lDoc.Close(true);
+}
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
- ' Initialize the OCR processor.
- Using processor As New OCRProcessor()
- ' Load an existing PDF document.
- Dim stream As New FileStream("../../../document.pdf", FileMode.Open)
- Dim lDoc As New PdfLoadedDocument(stream)
-
- ' Set the OCR language.
- processor.Settings.Language = Languages.English
- processor.ImageProcessor = New ImageProcessor()
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
+' Initialize the OCR processor.
+Using processor As New OCRProcessor()
+ ' Load an existing PDF document.
+ Dim lDoc As New PdfLoadedDocument("Input.pdf")
- ' Perform OCR with input document.
- Dim text As String = processor.PerformOCR(lDoc)
+ ' Set the OCR language.
+ processor.Settings.Language = Languages.English
+ processor.ImageProcessor = New ImageProcessor()
- ' Create file stream.
- Dim fileStream As New FileStream("../../../OCR.pdf", FileMode.CreateNew)
+ ' Perform OCR with input document.
+ Dim text As String = processor.PerformOCR(lDoc)
- ' Save the document into stream.
- lDoc.Save(fileStream)
+ ' Save the document into stream.
+ lDoc.Save("Output.pdf")
- ' Close the document.
- lDoc.Close(true)
- stream.Dispose()
- fileStream.Dispose()
- End Using
+ ' Close the document.
+ lDoc.Close(True)
+End Using
{% endhighlight %}
{% endtabs %}
-
-
N> Note: In this sample, we are using the SixLabors.ImageSharp library to improve the image quality. You can any image processing library as per your requirement.
You can downloaded a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/OCR/.NET/Perform-OCR-ImageEnhancement).
@@ -1561,52 +1513,10 @@ Here is a basic example of using Syncfusion® OCR processor with m
{% tabs %}
-{% highlight c# tabtitle="C# [Cross-platform]" %}
-
- // Initialize the OCR processor within a using block to ensure resources are properly disposed
- using (OCRProcessor ocrProcessor = new OCRProcessor())
- {
- // Set the Unicode font for the OCR processor using a TrueType font file
- ocrProcessor.UnicodeFont = new Syncfusion.Pdf.Graphics.PdfTrueTypeFont(
- new FileStream("arialuni.ttf", FileMode.Open), // Path to the TrueType font file
- 12 // Font size
- );
-
- // Open the PDF file to be processed
- FileStream fileStream = new FileStream("Input.pdf", FileMode.Open);
-
- // Load the PDF document from the file stream
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileStream);
+{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/OCR/.NET/OCR-with-multiple-langauages/OCR%20with%20multiple%20languages/Program.cs, 300" %}
- // Configure OCR settings
- OCRSettings ocrSettings = new OCRSettings();
-
- // Specify the languages to be used for OCR
- ocrSettings.Language = "eng+deu+ara+ell+fra"; // English, German, Arabic, Greek, French
-
- // Apply the OCR settings to the OCR processor
- ocrProcessor.Settings = ocrSettings;
-
- // Perform OCR on the loaded PDF document, providing the path to the tessdata directory
- ocrProcessor.PerformOCR(loadedDocument, "tessdata");
-
- // Create a file stream to save the OCR-processed PDF
- FileStream outputFileStream = new FileStream("OCR_Output.pdf", FileMode.Create);
-
- // Save the OCR-processed document to the file stream
- loadedDocument.Save(outputFileStream);
-
- // Close the loaded document and commit changes
- loadedDocument.Close(true);
-
- // Close the file streams
- outputFileStream.Close();
- fileStream.Close();
- }
-
-{% endhighlight %}
-
-{% highlight c# tabtitle="C# [Windows-specific]" %}
+ using Syncfusion.OCRProcessor;
+ using Syncfusion.Pdf.Parsing;
// Initialize the OCR processor within a using block to ensure resources are properly disposed
using (OCRProcessor ocrProcessor = new OCRProcessor())
@@ -1617,11 +1527,8 @@ Here is a basic example of using Syncfusion® OCR processor with m
12 // Font size
);
- // Open the PDF file to be processed
- FileStream fileStream = new FileStream("Input.pdf", FileMode.Open);
-
- // Load the PDF document from the file stream
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileStream);
+ // Load the PDF document
+ PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Configure OCR settings
OCRSettings ocrSettings = new OCRSettings();
@@ -1635,18 +1542,20 @@ Here is a basic example of using Syncfusion® OCR processor with m
// Perform OCR on the loaded PDF document, providing the path to the tessdata directory
ocrProcessor.PerformOCR(loadedDocument, "tessdata");
- // Save the OCR-processed document to the file save
- loadedDocument.Save("OCR_Output.pdf");
+ // Save the OCR-processed document
+ loadedDocument.Save("Output.pdf");
// Close the loaded document and commit changes
loadedDocument.Close(true);
-
}
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+ Imports Syncfusion.OCRProcessor
+ Imports Syncfusion.Pdf.Parsing
+
' Initialize the OCR processor within a Using block to ensure resources are properly disposed
Using ocrProcessor As New OCRProcessor()
' Set the Unicode font for the OCR processor using a TrueType font file
@@ -1654,11 +1563,8 @@ Here is a basic example of using Syncfusion® OCR processor with m
New FileStream("arialuni.ttf", FileMode.Open), ' Path to the TrueType font file
12 ' Font size
)
-
- ' Open the PDF file to be processed
- Using fileStream As New FileStream("Input.pdf", FileMode.Open)
' Load the PDF document from the file stream
- Dim loadedDocument As New PdfLoadedDocument(fileStream)
+ Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
' Configure OCR settings
Dim ocrSettings As New OCRSettings()
@@ -1672,10 +1578,8 @@ Here is a basic example of using Syncfusion® OCR processor with m
' Perform OCR on the loaded PDF document, providing the path to the tessdata directory
ocrProcessor.PerformOCR(loadedDocument, "tessdata")
- ' Save the OCR-processed document to the specified file
- Using fileSaveStream As New FileStream("OCR_Output.pdf", FileMode.Create)
- loadedDocument.Save(fileSaveStream)
- End Using
+ ' Save the OCR-processed document
+ loadedDocument.Save("Output.pdf")
' Close the loaded document and commit changes
loadedDocument.Close(True)
@@ -1697,47 +1601,10 @@ Line breaks can be added to OCRed text using the [OCRLayoutResult](https://help.
{% tabs %}
-{% highlight c# tabtitle="C# [Cross-platform]" %}
-
-// Initialize the OCR processor
-using (OCRProcessor processor = new OCRProcessor())
-{
- // Load the existing PDF document
- using (FileStream stream = new FileStream(@"Input.pdf", FileMode.Open))
- {
- // Load the PDF document from the file stream
- PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(stream);
-
- // Set OCR language to English
- processor.Settings.Language = Languages.English;
-
- // Set the page segmentation mode to process sparse text with orientation and script detection
- processor.Settings.PageSegment = PageSegMode.SparseTextOsd;
-
- // Perform OCR on the loaded PDF document to extract text
- processor.PerformOCR(pdfLoadedDocument, processor.TessDataPath, out OCRLayoutResult layoutResult);
-
- // Extract the OCRed text from the first page and join lines with newline characters
- string ocrText = string.Join("\n", layoutResult.Pages[0].Lines.Select(line => line.Text));
-
- // Create a file stream for saving the processed PDF document
- using (FileStream outputFileStream = new FileStream(@"Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- // Save the PDF document to the file stream
- pdfLoadedDocument.Save(outputFileStream);
- }
-
- // Close the PDF document
- pdfLoadedDocument.Close(true);
+{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/OCR/.NET/Adding-Line-Breaks-Using-OCR/.NET/Adding-Line-Breaks-Using-OCR/Program.cs, 300" %}
- // Write the extracted OCR text to an output text file
- File.WriteAllText("Output.txt", ocrText);
- }
-}
-
-{% endhighlight %}
-
-{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.OCRProcessor;
+using Syncfusion.Pdf.Parsing;
// Initialize the OCR processor
using (OCRProcessor processor = new OCRProcessor())
@@ -1759,7 +1626,6 @@ using (OCRProcessor processor = new OCRProcessor())
// Save the PDF document to the file stream
pdfLoadedDocument.Save("Output.pdf");
-
// Close the PDF document
pdfLoadedDocument.Close(true);
@@ -1771,6 +1637,9 @@ using (OCRProcessor processor = new OCRProcessor())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.OCRProcessor
+Imports Syncfusion.Pdf.Parsing
+
' Initialize the OCR processor
Using processor As New OCRProcessor()
' Load the PDF document from the file stream
@@ -1803,4 +1672,4 @@ End Using
{% endtabs %}
-You can downloaded a complete working sample from GitHub.
\ No newline at end of file
+You can downloaded a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/OCR/.NET/Adding-Line-Breaks-Using-OCR/.NET).
\ No newline at end of file
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Troubleshooting.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Troubleshooting.md
index c4e3cfef3..a0ef79410 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Troubleshooting.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-OCR/Troubleshooting.md
@@ -351,17 +351,17 @@ Step 1: Execute the following command in terminal window to check dependencies a
{% tabs %}
{% highlight C# %}
- ldd liblept1753.so
- ldd libSyncfusionTesseract.so
+ldd liblept1753.so
+ldd libSyncfusionTesseract.so
{% endhighlight %}
{% endtabs %}
-Run the following commands in terminal
+Run the following commands in terminal
Step 1:
{% tabs %}
{% highlight C# %}
- sudo apt-get install libleptonica-dev libjpeg62
+sudo apt-get install libleptonica-dev libjpeg62
{% endhighlight %}
{% endtabs %}
@@ -369,7 +369,7 @@ Step 2:
{% tabs %}
{% highlight C# %}
- ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.6 /usr/lib/x86_64-linux-gnu/libtiff.so.5
+ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.6 /usr/lib/x86_64-linux-gnu/libtiff.so.5
{% endhighlight %}
{% endtabs %}
@@ -377,7 +377,7 @@ Step 3:
{% tabs %}
{% highlight C# %}
- ln -s /lib/x86_64-linux-gnu/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.so
+ln -s /lib/x86_64-linux-gnu/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.so
{% endhighlight %}
{% endtabs %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-JetBrains.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-JetBrains.md
index d7467450f..21fdcda25 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-JetBrains.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-JetBrains.md
@@ -34,10 +34,10 @@ Step 4: A default controller with name HomeController.cs gets added on creation
{% highlight c# tabtitle="C#" %}
- using Syncfusion.Pdf;
- using Syncfusion.Pdf.Graphics;
- using Syncfusion.Drawing;
- using System.IO;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+using System.IO;
{% endhighlight %}
@@ -58,30 +58,28 @@ Step 6: Add a new action method named ``CreatePDFDocument`` in HomeController.cs
{% highlight c# tabtitle="C#" %}
- //Create a new PDF document.
- PdfDocument document = new PdfDocument();
- //Add a page to the document.
- PdfPage page = document.Pages.Add();
- //Create PDF graphics for the page.
- PdfGraphics graphics = page.Graphics;
- //Set the standard font.
- PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
- //Draw the text.
- graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
- //Saving the PDF to the MemoryStream.
- MemoryStream stream = new MemoryStream();
- document.Save(stream);
- //Set the position as '0'.
- stream.Position = 0;
- //Download the PDF document in the browser.
- FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/pdf");
- fileStreamResult.FileDownloadName = "Sample.pdf";
- return fileStreamResult;
+//Create a new PDF document.
+PdfDocument document = new PdfDocument();
+//Add a page to the document.
+PdfPage page = document.Pages.Add();
+//Create PDF graphics for the page.
+PdfGraphics graphics = page.Graphics;
+//Set the standard font.
+PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
+//Draw the text.
+graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
+//Saving the PDF to the MemoryStream.
+MemoryStream stream = new MemoryStream();
+document.Save(stream);
+//Set the position as '0'.
+stream.Position = 0;
+// Return file result
+return File(stream.ToArray(), "application/pdf", "Sample.pdf");
{% endhighlight %}
Step 7: Build the project.
-Click the **Build** button in the toolbar or press Ctrl+Shift+B to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 8: Run the project.
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-VS-Code.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-VS-Code.md
index 65d05f2c1..64a45e23a 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-VS-Code.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-VS-Code.md
@@ -68,10 +68,8 @@ MemoryStream stream = new MemoryStream();
document.Save(stream);
//Set the position as '0'.
stream.Position = 0;
-//Download the PDF document in the browser.
-FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/pdf");
-fileStreamResult.FileDownloadName = "Sample.pdf";
-return fileStreamResult;
+// Return file result
+return File(stream.ToArray(), "application/pdf", "Sample.pdf");
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-Visual-Studio.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-Visual-Studio.md
index 9ace274cc..94a8af88a 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-Visual-Studio.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-ASP-NET-Core-Visual-Studio.md
@@ -3,16 +3,14 @@
* Install .NET SDK: Ensure that you have the .NET SDK installed on your system. You can download it from the [.NET Downloads page](https://dotnet.microsoft.com/en-us/download).
* Install Visual Studio: Download and install Visual Studio from the [official website](https://visualstudio.microsoft.com/downloads/).
-
-
Step 1: Create a new C# ASP.NET Core Web Application project.
- 
+
Step 2: In configuration windows, name your project and click Next.
- 
+
Step 3: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package as reference to your ASP.NET Core applications from [NuGet.org](https://www.nuget.org/).
- 
+
N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your application to use our components.
@@ -20,23 +18,23 @@ Step 4: A default controller with name HomeController.cs gets added on creation
{% highlight c# tabtitle="C#" %}
- using Syncfusion.Pdf;
- using Syncfusion.Pdf.Graphics;
- using Syncfusion.Drawing;
- using System.IO;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+using System.IO;
{% endhighlight %}
Step 5: A default action method named Index will be present in HomeController.cs. Right click on Index method and select Go To View where you will be directed to its associated view page Index.cshtml. Add a new button in the Index.cshtml as shown below.
{% highlight c# tabtitle="C#" %}
- @{Html.BeginForm("CreateDocument", "Home", FormMethod.Get);
- {
-
+ }
+ Html.EndForm();
+}
{% endhighlight %}
@@ -44,29 +42,29 @@ Step 6: Add a new action method named ``CreatePDFDocument`` in HomeController.cs
{% highlight c# tabtitle="C#" %}
- //Create a new PDF document.
- PdfDocument document = new PdfDocument();
- //Add a page to the document.
- PdfPage page = document.Pages.Add();
- //Create PDF graphics for the page.
- PdfGraphics graphics = page.Graphics;
- //Set the standard font.
- PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
- //Draw the text.
- graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
- //Saving the PDF to the MemoryStream.
- MemoryStream stream = new MemoryStream();
- document.Save(stream);
- //Set the position as '0'.
- stream.Position = 0;
- //Download the PDF document in the browser.
- FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/pdf");
- fileStreamResult.FileDownloadName = "Sample.pdf";
- return fileStreamResult;
+//Create a new PDF document.
+PdfDocument document = new PdfDocument();
+//Add a page to the document.
+PdfPage page = document.Pages.Add();
+//Create PDF graphics for the page.
+PdfGraphics graphics = page.Graphics;
+//Set the standard font.
+PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
+//Draw the text.
+graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
+//Saving the PDF to the MemoryStream.
+MemoryStream stream = new MemoryStream();
+document.Save(stream);
+//Set the position as '0'.
+stream.Position = 0;
+// Return file result
+return File(stream.ToArray(), "application/pdf", "Sample.pdf");
{% endhighlight %}
Step 7: Build the project.
- Click on Build > Build Solution or press Ctrl + Shift + B to build the project.
+
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 8: Run the project.
- Click the Start button (green arrow) or press F5 to run the app.
+
+Click the **Run** button (green arrow) in the toolbar or press F5 to run the app.
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-JetBrains.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-JetBrains.md
index ef413654f..0dbfe0318 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-JetBrains.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-JetBrains.md
@@ -35,11 +35,11 @@ Step 4: Next, include the following namespaces in the ``_Imports.razor`` file.
{% highlight c# tabtitle="C#" %}
- @using Syncfusion.Pdf;
- @using Syncfusion.Pdf.Graphics;
- @using Syncfusion.Pdf.Grid;
- @using Syncfusion.Drawing;
- @using BlazorMauiAppCreatePdfSample.Services
+@using Syncfusion.Pdf;
+@using Syncfusion.Pdf.Graphics;
+@using Syncfusion.Pdf.Grid;
+@using Syncfusion.Drawing;
+@using BlazorMauiAppCreatePdfSample.Services
{% endhighlight %}
@@ -65,52 +65,52 @@ The [PdfDocument](https://help.syncfusion.com/cr/file-formats/Syncfusion.Pdf.Pdf
{% highlight c# tabtitle="C#" %}
- @functions {
- void ExportToPdf()
+@functions {
+ void ExportToPdf()
+ {
+ int paragraphAfterSpacing = 8;
+ int cellMargin = 8;
+ //Create a new PDF document.
+ PdfDocument pdfDocument = new PdfDocument();
+ //Add Page to the PDF document.
+ PdfPage page = pdfDocument.Pages.Add();
+ //Create a new font.
+ PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 16);
+ //Create a text element to draw a text in PDF page.
+ PdfTextElement title = new PdfTextElement("Weather Forecast", font, PdfBrushes.Black);
+ PdfLayoutResult result = title.Draw(page, new PointF(0, 0));
+ PdfStandardFont contentFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
+ //Create text element.
+ PdfTextElement content = new PdfTextElement("This component demonstrates fetching data from a client side and Exporting the data to PDF document using Syncfusion .NET PDF library.", contentFont, PdfBrushes.Black);
+ PdfLayoutFormat format = new PdfLayoutFormat();
+ format.Layout = PdfLayoutType.Paginate;
+ //Draw a text to the PDF document.
+ result = content.Draw(page, new RectangleF(0, result.Bounds.Bottom + paragraphAfterSpacing, page.GetClientSize().Width, page.GetClientSize().Height), format);
+ //Create a PdfGrid.
+ PdfGrid pdfGrid = new PdfGrid();
+ pdfGrid.Style.CellPadding.Left = cellMargin;
+ pdfGrid.Style.CellPadding.Right = cellMargin;
+ //Applying built-in style to the PDF grid
+ pdfGrid.ApplyBuiltinStyle(PdfGridBuiltinStyle.GridTable4Accent1);
+ //Assign data source.
+ pdfGrid.DataSource = forecasts;
+ pdfGrid.Style.Font = contentFont;
+ //Draw PDF grid into the PDF page.
+ pdfGrid.Draw(page, new Syncfusion.Drawing.PointF(0, result.Bounds.Bottom + paragraphAfterSpacing));
+ using (MemoryStream ms = new MemoryStream())
{
- int paragraphAfterSpacing = 8;
- int cellMargin = 8;
- //Create a new PDF document.
- PdfDocument pdfDocument = new PdfDocument();
- //Add Page to the PDF document.
- PdfPage page = pdfDocument.Pages.Add();
- //Create a new font.
- PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 16);
- //Create a text element to draw a text in PDF page.
- PdfTextElement title = new PdfTextElement("Weather Forecast", font, PdfBrushes.Black);
- PdfLayoutResult result = title.Draw(page, new PointF(0, 0));
- PdfStandardFont contentFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
- //Create text element.
- PdfTextElement content = new PdfTextElement("This component demonstrates fetching data from a client side and Exporting the data to PDF document using Syncfusion .NET PDF library.", contentFont, PdfBrushes.Black);
- PdfLayoutFormat format = new PdfLayoutFormat();
- format.Layout = PdfLayoutType.Paginate;
- //Draw a text to the PDF document.
- result = content.Draw(page, new RectangleF(0, result.Bounds.Bottom + paragraphAfterSpacing, page.GetClientSize().Width, page.GetClientSize().Height), format);
- //Create a PdfGrid.
- PdfGrid pdfGrid = new PdfGrid();
- pdfGrid.Style.CellPadding.Left = cellMargin;
- pdfGrid.Style.CellPadding.Right = cellMargin;
- //Applying built-in style to the PDF grid
- pdfGrid.ApplyBuiltinStyle(PdfGridBuiltinStyle.GridTable4Accent1);
- //Assign data source.
- pdfGrid.DataSource = forecasts;
- pdfGrid.Style.Font = contentFont;
- //Draw PDF grid into the PDF page.
- pdfGrid.Draw(page, new Syncfusion.Drawing.PointF(0, result.Bounds.Bottom + paragraphAfterSpacing));
- using (MemoryStream ms = new MemoryStream())
- {
- // Save the PDF document to the memory stream
- pdfDocument.Save(ms);
- // Close the PDF document
- pdfDocument.Close(true);
- // Reset the memory stream position
- ms.Position = 0;
- // Create a SaveService instance
- SaveService service = new SaveService();
- // Save and view the PDF document
- service.SaveAndView("Output.pdf", "application/pdf", ms);
- }
+ // Save the PDF document to the memory stream
+ pdfDocument.Save(ms);
+ // Close the PDF document
+ pdfDocument.Close(true);
+ // Reset the memory stream position
+ ms.Position = 0;
+ // Create a SaveService instance
+ SaveService service = new SaveService();
+ // Save and view the PDF document
+ service.SaveAndView("Output.pdf", "application/pdf", ms);
}
+ }
{% endhighlight %}
@@ -118,7 +118,7 @@ The [PdfDocument](https://help.syncfusion.com/cr/file-formats/Syncfusion.Pdf.Pdf
Step 7: Build the project.
-Click the **Build** button in the toolbar or press Ctrl+Shift+B to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 8: Run the project.
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-VS-Code.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-VS-Code.md
index 707d40fd7..d194af714 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-VS-Code.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-VS-Code.md
@@ -25,11 +25,11 @@ Step 4: Include necessary namespaces in `_Imports.razor` file.
{% tabs %}
{% highlight c# tabtitle="C#" %}
- @using Syncfusion.Pdf;
- @using Syncfusion.Pdf.Graphics;
- @using Syncfusion.Pdf.Grid;
- @using Syncfusion.Drawing;
- @using BlazorMauiAppCreatePdfSample.Services
+@using Syncfusion.Pdf;
+@using Syncfusion.Pdf.Graphics;
+@using Syncfusion.Pdf.Grid;
+@using Syncfusion.Drawing;
+@using BlazorMauiAppCreatePdfSample.Services
{% endhighlight %}
@@ -41,7 +41,7 @@ Step 5: Create a button in ``Weather.razor`` using the following code.
{% highlight CSHTML %}
-
+
{% endhighlight %}
@@ -55,52 +55,52 @@ The [PdfDocument](https://help.syncfusion.com/cr/file-formats/Syncfusion.Pdf.Pdf
{% highlight c# tabtitle="C#" %}
- @functions {
- void ExportToPdf()
- {
- int paragraphAfterSpacing = 8;
- int cellMargin = 8;
- //Create a new PDF document.
- PdfDocument pdfDocument = new PdfDocument();
- //Add Page to the PDF document.
- PdfPage page = pdfDocument.Pages.Add();
- //Create a new font.
- PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 16);
- //Create a text element to draw a text in PDF page.
- PdfTextElement title = new PdfTextElement("Weather Forecast", font, PdfBrushes.Black);
- PdfLayoutResult result = title.Draw(page, new PointF(0, 0));
- PdfStandardFont contentFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
- //Create text element.
- PdfTextElement content = new PdfTextElement("This component demonstrates fetching data from a client side and Exporting the data to PDF document using Syncfusion .NET PDF library.", contentFont, PdfBrushes.Black);
- PdfLayoutFormat format = new PdfLayoutFormat();
- format.Layout = PdfLayoutType.Paginate;
- //Draw a text to the PDF document.
- result = content.Draw(page, new RectangleF(0, result.Bounds.Bottom + paragraphAfterSpacing, page.GetClientSize().Width, page.GetClientSize().Height), format);
- //Create a PdfGrid.
- PdfGrid pdfGrid = new PdfGrid();
- pdfGrid.Style.CellPadding.Left = cellMargin;
- pdfGrid.Style.CellPadding.Right = cellMargin;
- //Applying built-in style to the PDF grid
- pdfGrid.ApplyBuiltinStyle(PdfGridBuiltinStyle.GridTable4Accent1);
- //Assign data source.
- pdfGrid.DataSource = forecasts;
- pdfGrid.Style.Font = contentFont;
- //Draw PDF grid into the PDF page.
- pdfGrid.Draw(page, new Syncfusion.Drawing.PointF(0, result.Bounds.Bottom + paragraphAfterSpacing));
- using (MemoryStream ms = new MemoryStream())
- {
- // Save the PDF document to the memory stream
- pdfDocument.Save(ms);
- // Close the PDF document
- pdfDocument.Close(true);
- // Reset the memory stream position
- ms.Position = 0;
- // Create a SaveService instance
- SaveService service = new SaveService();
- // Save and view the PDF document
- service.SaveAndView("Output.pdf", "application/pdf", ms);
- }
- }
+@functions {
+ void ExportToPdf()
+ {
+ int paragraphAfterSpacing = 8;
+ int cellMargin = 8;
+ //Create a new PDF document.
+ PdfDocument pdfDocument = new PdfDocument();
+ //Add Page to the PDF document.
+ PdfPage page = pdfDocument.Pages.Add();
+ //Create a new font.
+ PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 16);
+ //Create a text element to draw a text in PDF page.
+ PdfTextElement title = new PdfTextElement("Weather Forecast", font, PdfBrushes.Black);
+ PdfLayoutResult result = title.Draw(page, new PointF(0, 0));
+ PdfStandardFont contentFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
+ //Create text element.
+ PdfTextElement content = new PdfTextElement("This component demonstrates fetching data from a client side and Exporting the data to PDF document using Syncfusion .NET PDF library.", contentFont, PdfBrushes.Black);
+ PdfLayoutFormat format = new PdfLayoutFormat();
+ format.Layout = PdfLayoutType.Paginate;
+ //Draw a text to the PDF document.
+ result = content.Draw(page, new RectangleF(0, result.Bounds.Bottom + paragraphAfterSpacing, page.GetClientSize().Width, page.GetClientSize().Height), format);
+ //Create a PdfGrid.
+ PdfGrid pdfGrid = new PdfGrid();
+ pdfGrid.Style.CellPadding.Left = cellMargin;
+ pdfGrid.Style.CellPadding.Right = cellMargin;
+ //Applying built-in style to the PDF grid
+ pdfGrid.ApplyBuiltinStyle(PdfGridBuiltinStyle.GridTable4Accent1);
+ //Assign data source.
+ pdfGrid.DataSource = forecasts;
+ pdfGrid.Style.Font = contentFont;
+ //Draw PDF grid into the PDF page.
+ pdfGrid.Draw(page, new Syncfusion.Drawing.PointF(0, result.Bounds.Bottom + paragraphAfterSpacing));
+ using (MemoryStream ms = new MemoryStream())
+ {
+ // Save the PDF document to the memory stream
+ pdfDocument.Save(ms);
+ // Close the PDF document
+ pdfDocument.Close(true);
+ // Reset the memory stream position
+ ms.Position = 0;
+ // Create a SaveService instance
+ SaveService service = new SaveService();
+ // Save and view the PDF document
+ service.SaveAndView("Output.pdf", "application/pdf", ms);
+ }
+ }
{% endhighlight %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-Visual-studio.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-Visual-studio.md
index c4f63b315..68acd34f6 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-Visual-studio.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-MaUI-Visual-studio.md
@@ -15,11 +15,11 @@ Step 3: Include necessary namespaces in `_Imports.razor` file.
{% highlight c# tabtitle="C#" %}
- @using Syncfusion.Pdf;
- @using Syncfusion.Pdf.Graphics;
- @using Syncfusion.Pdf.Grid;
- @using Syncfusion.Drawing;
- @using BlazorMauiAppCreatePdfSample.Services
+@using Syncfusion.Pdf;
+@using Syncfusion.Pdf.Graphics;
+@using Syncfusion.Pdf.Grid;
+@using Syncfusion.Drawing;
+@using BlazorMauiAppCreatePdfSample.Services
{% endhighlight %}
@@ -45,52 +45,52 @@ The [PdfDocument](https://help.syncfusion.com/cr/file-formats/Syncfusion.Pdf.Pdf
{% highlight c# tabtitle="C#" %}
- @functions {
- void ExportToPdf()
+@functions {
+ void ExportToPdf()
+ {
+ int paragraphAfterSpacing = 8;
+ int cellMargin = 8;
+ //Create a new PDF document.
+ PdfDocument pdfDocument = new PdfDocument();
+ //Add Page to the PDF document.
+ PdfPage page = pdfDocument.Pages.Add();
+ //Create a new font.
+ PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 16);
+ //Create a text element to draw a text in PDF page.
+ PdfTextElement title = new PdfTextElement("Weather Forecast", font, PdfBrushes.Black);
+ PdfLayoutResult result = title.Draw(page, new PointF(0, 0));
+ PdfStandardFont contentFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
+ //Create text element.
+ PdfTextElement content = new PdfTextElement("This component demonstrates fetching data from a client side and Exporting the data to PDF document using Syncfusion .NET PDF library.", contentFont, PdfBrushes.Black);
+ PdfLayoutFormat format = new PdfLayoutFormat();
+ format.Layout = PdfLayoutType.Paginate;
+ //Draw a text to the PDF document.
+ result = content.Draw(page, new RectangleF(0, result.Bounds.Bottom + paragraphAfterSpacing, page.GetClientSize().Width, page.GetClientSize().Height), format);
+ //Create a PdfGrid.
+ PdfGrid pdfGrid = new PdfGrid();
+ pdfGrid.Style.CellPadding.Left = cellMargin;
+ pdfGrid.Style.CellPadding.Right = cellMargin;
+ //Applying built-in style to the PDF grid
+ pdfGrid.ApplyBuiltinStyle(PdfGridBuiltinStyle.GridTable4Accent1);
+ //Assign data source.
+ pdfGrid.DataSource = forecasts;
+ pdfGrid.Style.Font = contentFont;
+ //Draw PDF grid into the PDF page.
+ pdfGrid.Draw(page, new Syncfusion.Drawing.PointF(0, result.Bounds.Bottom + paragraphAfterSpacing));
+ using (MemoryStream ms = new MemoryStream())
{
- int paragraphAfterSpacing = 8;
- int cellMargin = 8;
- //Create a new PDF document.
- PdfDocument pdfDocument = new PdfDocument();
- //Add Page to the PDF document.
- PdfPage page = pdfDocument.Pages.Add();
- //Create a new font.
- PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 16);
- //Create a text element to draw a text in PDF page.
- PdfTextElement title = new PdfTextElement("Weather Forecast", font, PdfBrushes.Black);
- PdfLayoutResult result = title.Draw(page, new PointF(0, 0));
- PdfStandardFont contentFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
- //Create text element.
- PdfTextElement content = new PdfTextElement("This component demonstrates fetching data from a client side and Exporting the data to PDF document using Syncfusion .NET PDF library.", contentFont, PdfBrushes.Black);
- PdfLayoutFormat format = new PdfLayoutFormat();
- format.Layout = PdfLayoutType.Paginate;
- //Draw a text to the PDF document.
- result = content.Draw(page, new RectangleF(0, result.Bounds.Bottom + paragraphAfterSpacing, page.GetClientSize().Width, page.GetClientSize().Height), format);
- //Create a PdfGrid.
- PdfGrid pdfGrid = new PdfGrid();
- pdfGrid.Style.CellPadding.Left = cellMargin;
- pdfGrid.Style.CellPadding.Right = cellMargin;
- //Applying built-in style to the PDF grid
- pdfGrid.ApplyBuiltinStyle(PdfGridBuiltinStyle.GridTable4Accent1);
- //Assign data source.
- pdfGrid.DataSource = forecasts;
- pdfGrid.Style.Font = contentFont;
- //Draw PDF grid into the PDF page.
- pdfGrid.Draw(page, new Syncfusion.Drawing.PointF(0, result.Bounds.Bottom + paragraphAfterSpacing));
- using (MemoryStream ms = new MemoryStream())
- {
- // Save the PDF document to the memory stream
- pdfDocument.Save(ms);
- // Close the PDF document
- pdfDocument.Close(true);
- // Reset the memory stream position
- ms.Position = 0;
- // Create a SaveService instance
- SaveService service = new SaveService();
- // Save and view the PDF document
- service.SaveAndView("Output.pdf", "application/pdf", ms);
- }
+ // Save the PDF document to the memory stream
+ pdfDocument.Save(ms);
+ // Close the PDF document
+ pdfDocument.Close(true);
+ // Reset the memory stream position
+ ms.Position = 0;
+ // Create a SaveService instance
+ SaveService service = new SaveService();
+ // Save and view the PDF document
+ service.SaveAndView("Output.pdf", "application/pdf", ms);
}
+ }
{% endhighlight %}
@@ -98,7 +98,7 @@ The [PdfDocument](https://help.syncfusion.com/cr/file-formats/Syncfusion.Pdf.Pdf
Step 6: Build the project.
-Click on Build > Build Solution or press `Ctrl + Shift + B` to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 7: Run the project.
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-Server-JetBrains.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-Server-JetBrains.md
index d1e65fe75..88be2740a 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-Server-JetBrains.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-Server-JetBrains.md
@@ -208,7 +208,7 @@ Step 8: Add the following JavaScript function in the `_Host.cshtml` available un
Step 9: Build the project.
-Click the **Build** button in the toolbar or press Ctrl+Shift+B to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 10: Run the project.
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-Server-Visual-studio.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-Server-Visual-studio.md
index 14f5297b0..3f2d56cfb 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-Server-Visual-studio.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-Server-Visual-studio.md
@@ -190,7 +190,7 @@ Step 9: Add the following JavaScript function in the `App.razor` available under
Step 10: Build the project.
-Click on Build > Build Solution or press Ctrl + Shift + B to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 11: Run the project.
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-WASM-JetBrains.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-WASM-JetBrains.md
index a7dbae5ea..afda73fb8 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-WASM-JetBrains.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-WASM-JetBrains.md
@@ -161,7 +161,7 @@ Step 7: Add the following JavaScript function in the ``index.html`` available un
Step 8: Build the project.
-Click the **Build** button in the toolbar or press Ctrl+Shift+B to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 9: Run the project.
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-WASM-Visual-studio.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-WASM-Visual-studio.md
index 58cddf53e..cffe5cb10 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-WASM-Visual-studio.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Blazor-WASM-Visual-studio.md
@@ -145,8 +145,8 @@ Step 8: Add the following JavaScript function to the `index.html` file located i
Step 9: Build the project.
-Click on Build > Build Solution or press `Ctrl + Shift + B` to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 10: Run the project.
-Click the `Start` button (green arrow) or press `F5` to run the application.
\ No newline at end of file
+Click the **Run** button (green arrow) in the toolbar or press F5 to run the application.
\ No newline at end of file
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Console-JetBrains.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Console-JetBrains.md
index daa78b595..f6a2b03aa 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Console-JetBrains.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Console-JetBrains.md
@@ -68,7 +68,7 @@ document.Close(true);
Step 6: Build the project.
-Click the **Build** button in the toolbar or press Ctrl+Shift+B to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 7: Run the project.
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Console-Visual-Studio.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Console-Visual-Studio.md
index ef5cad4dd..656c6227f 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Console-Visual-Studio.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Console-Visual-Studio.md
@@ -52,8 +52,8 @@ document.Close(true);
Step 6: Build the project.
-Click on Build > Build Solution or press Ctrl + Shift + B to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 7: Run the project.
-Click the Start button (green arrow) or press F5 to run the app.
\ No newline at end of file
+Click the **Run** button (green arrow) in the toolbar or press F5 to run the app.
\ No newline at end of file
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-JetBrains.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-JetBrains.md
index ff290f40a..1870b5b6c 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-JetBrains.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-JetBrains.md
@@ -66,13 +66,13 @@ Step 5: Include the following namespaces in the *MainWindow.xaml.cs* file.
{% highlight c# tabtitle="C#" %}
- using CreatePdfDemoSample.Services;
- using Syncfusion.Pdf;
- using Syncfusion.Pdf.Graphics;
- using Syncfusion.Pdf.Grid;
- using Syncfusion.Drawing;
- using System.Reflection;
- using System.Xml.Linq;
+using CreatePdfDemoSample.Services;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Grid;
+using Syncfusion.Drawing;
+using System.Reflection;
+using System.Xml.Linq;
{% endhighlight %}
@@ -385,7 +385,11 @@ Step 6: Add a new action method *createPdf_Click* in *MainWindow.xaml.cs* and in
{% endcapture %}
{{ codesnippet3 | OrderList_Indent_Level_1 }}
-Step 7: Build and Run the Project
+Step 7: Build the project.
-Click the **Run** button (green arrow) in the toolbar or press `F5` to build and run the application. When you click the "Export to PDF" button, a PDF document will be generated and opened using the default PDF viewer on the target device.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
+
+Step 8: Run the project.
+
+Click the **Run** button (green arrow) in the toolbar or press F5 to run the app.
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-VS-Code.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-VS-Code.md
index f70501704..9f5c1ad49 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-VS-Code.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-VS-Code.md
@@ -4,8 +4,6 @@
* Install Visual Studio Code: Download and install Visual Studio Code from the [official website](https://code.visualstudio.com/download).
* Install C# Extension for VS Code: Open Visual Studio Code, go to the Extensions view (Ctrl+Shift+X), and search for 'C#'. Install the official [C# extension provided by Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp).
-
-
Step 1: Open the terminal (Ctrl+` ) and run the following command to create a new .NET MAUI Application.
```
@@ -61,13 +59,13 @@ Step 6: Include the following namespaces in the *MainWindow.xaml.cs* file.
{% highlight c# tabtitle="C#" %}
- using CreatePdfDemoSample.Services;
- using Syncfusion.Pdf;
- using Syncfusion.Pdf.Graphics;
- using Syncfusion.Pdf.Grid;
- using Syncfusion.Drawing;
- using System.Reflection;
- using System.Xml.Linq;
+using CreatePdfDemoSample.Services;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Grid;
+using Syncfusion.Drawing;
+using System.Reflection;
+using System.Xml.Linq;
{% endhighlight %}
@@ -374,8 +372,6 @@ Step 7: Add a new action method *createPdf_Click* in *MainWindow.xaml.cs* and in
}
#endregion
-
-
{% endhighlight %}
{% endtabs %}
@@ -384,16 +380,16 @@ Step 7: Add a new action method *createPdf_Click* in *MainWindow.xaml.cs* and in
Step 8: Build the project.
- Run the following command in terminal to build the project.
+Run the following command in terminal to build the project.
- ```
- dotnet build
- ```
+```
+dotnet build
+```
Step 9: Run the project.
- Run the following command in terminal to run the project.
+Run the following command in terminal to run the project.
- ```
- dotnet run
+```
+dotnet run
```
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-Visual-Studio.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-Visual-Studio.md
index f9e9f332b..b6c9db5bf 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-Visual-Studio.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-MaUI-Visual-Studio.md
@@ -3,8 +3,6 @@
* Install .NET SDK: Ensure that you have the .NET SDK installed on your system. You can download it from the [.NET Downloads page](https://dotnet.microsoft.com/en-us/download).
* Install Visual Studio: Download and install Visual Studio Code from the [official website](https://code.visualstudio.com/download).
-
-
Step 1: Create a new project in VS2022, select the .NET MAUI App (Preview) template, and click the **Next** button.

@@ -52,13 +50,13 @@ Step 5: Include the following namespaces in the *MainWindow.xaml.cs* file.
{% highlight c# tabtitle="C#" %}
- using CreatePdfDemoSample.Services;
- using Syncfusion.Pdf;
- using Syncfusion.Pdf.Graphics;
- using Syncfusion.Pdf.Grid;
- using Syncfusion.Drawing;
- using System.Reflection;
- using System.Xml.Linq;
+using CreatePdfDemoSample.Services;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Grid;
+using Syncfusion.Drawing;
+using System.Reflection;
+using System.Xml.Linq;
{% endhighlight %}
@@ -375,7 +373,8 @@ Step 6: Add a new action method *createPdf_Click* in *MainWindow.xaml.cs* and in
Step 7: Build the project.
-Click on Build > Build Solution or press Ctrl + Shift + B to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 8: Run the project.
- Click the Start button (green arrow) or press F5 to run the app.
+
+Click the **Run** button (green arrow) in the toolbar or press F5 to run the app.
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Mac-OS-VS-Code.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Mac-OS-VS-Code.md
index 5c2094155..893a3ecbd 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Mac-OS-VS-Code.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Mac-OS-VS-Code.md
@@ -4,8 +4,6 @@
* Install Visual Studio Code: Download and install Visual Studio Code from the [official website](https://code.visualstudio.com/download).
* Install C# Extension for VS Code: Open Visual Studio Code, go to the Extensions view (Ctrl+Shift+X), and search for 'C#'. Install the official [C# extension provided by Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp).
-
-
Step 1: Open the terminal (Ctrl+` ) and run the following command to create a .NET Core console application.
```
@@ -104,14 +102,14 @@ Step 7: Build the project.
Run the following command in terminal to build the project.
- ```
- dotnet build
- ```
+```
+dotnet build
+```
Step 8: Run the project.
Run the following command in terminal to build the project.
- ```
- dotnet run
+```
+dotnet run
```
diff --git a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Mac-OS-Visual-Studio.md b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Mac-OS-Visual-Studio.md
index f45720a1f..05c014667 100644
--- a/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Mac-OS-Visual-Studio.md
+++ b/Document-Processing/PDF/PDF-Library/NET/tabcontent-support/Create-PDF-document-in-Mac-OS-Visual-Studio.md
@@ -3,8 +3,6 @@
* Install .NET SDK: Ensure that you have the .NET SDK installed on your system. You can download it from the [.NET Downloads page](https://dotnet.microsoft.com/en-us/download).
* Install Visual Studio: Download and install Visual Studio Code from the [official website](https://code.visualstudio.com/download).
-
-
Step 1: Create a new .NET Core console application project.

@@ -92,7 +90,8 @@ using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output.pd
Step 6: Build the project.
-Click on Build > Build Solution or press Ctrl + Shift + B to build the project.
+To build the project, go to the `Build` menu and select `Build Solution`, or simply press Ctrl+Shift+B.
Step 7: Run the project.
- Click the Start button (green arrow) or press F5 to run the app.
+
+Click the **Run** button (green arrow) in the toolbar or press F5 to run the app.