From f3326254586e524c1bfd9a8ddf56e6fb406cdfda Mon Sep 17 00:00:00 2001 From: Chinnu M <65020530+chinnumuniyappan@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:15:42 +0530 Subject: [PATCH] Reviewed content updated --- .../README.md | 106 ++++++++-------- .../README.md | 113 +++++++++-------- .../README.md | 96 +++++++------- .../README.md | 96 +++++++------- .../README.md | 54 ++++---- .../.NET/Convert_Image_to_PDF/README.md | 69 +++++----- .../README.md | 66 +++++----- .../README.md | 101 +++++++-------- .../README.md | 46 +++++++ .../Program.cs | 39 +++--- .../README.md | 43 ------- .../README.md | 48 ++++--- .../README.md | 102 +++++++-------- .../README.md | 70 +++++------ .../README.md | 77 ++++++------ .../README.md | 86 +++++++------ .../README.md | 64 +++++----- .../README.md | 118 +++++++++--------- 18 files changed, 711 insertions(+), 683 deletions(-) create mode 100644 PDF Conformance/Convert-PDF-to-PDFA-conformance-document/.NET/Convert-PDF-to-PDFA-conformance-document/README.md delete mode 100644 PDF Conformance/Get-PDF-to-PDFA-conversion-progress/.NET/Get-PDF-to-PDFA-conversion-progress/README.md diff --git a/Annotation/Add-popup-annotation-in-a-PDF-document/.NET/Add-popup-annotation-in-a-PDF-document/README.md b/Annotation/Add-popup-annotation-in-a-PDF-document/.NET/Add-popup-annotation-in-a-PDF-document/README.md index 643dfaef..43459eb3 100644 --- a/Annotation/Add-popup-annotation-in-a-PDF-document/.NET/Add-popup-annotation-in-a-PDF-document/README.md +++ b/Annotation/Add-popup-annotation-in-a-PDF-document/.NET/Add-popup-annotation-in-a-PDF-document/README.md @@ -1,52 +1,58 @@ # PDF Annotations -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also offers functionality to add, edit, and manage annotations in PDF files, enabling users to mark up and collaborate effectively. - -## Steps to add annotation to a PDF - -Step 1: Create a new C# Console Application project. - -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). - -Step 3: Include the following namespaces in the **Program.cs** file. - -``` -using Syncfusion.Drawing; -using Syncfusion.Pdf; -using Syncfusion.Pdf.Graphics; -using Syncfusion.Pdf.Interactive; -using Syncfusion.Pdf.Parsing; - -``` - -Step 4: Include the below code snippet in **Program.cs** to add annotations to a PDF file.". -``` -//Create FileStream object to read the input PDF file -using (FileStream inputFileStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read)) -{ - //Load the PDF document from the input stream - using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFileStream)) - { - //Get the first page of the PDF document - PdfPageBase loadedPage = loadedDocument.Pages[0]; - //Create a new popup annotation - PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(new RectangleF(100, 100, 20, 20), "Comment"); - //Set the icon for the popup annotation - popupAnnotation.Icon = PdfPopupIcon.Comment; - //Set the color for the popup annotation - popupAnnotation.Color = new PdfColor(Color.Yellow); - //Add the annotation to the page - loadedPage.Annotations.Add(popupAnnotation); - //Save the document - using (FileStream outpuFileStream = new FileStream("output.pdf", FileMode.Create, FileAccess.Write)) - { - loadedDocument.Save(outpuFileStream); - } - } -} - -``` - -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Annotation/Add-a-popup-annotation-to-an-existing-PDF-document/.NET). - -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) provides powerful tools to create, read, and edit PDF documents. This library also includes features to add, edit, and manage annotations in PDF files, enabling effective markup and collaboration. + +## Steps to add annotations to a PDF + +Follow these steps to add a popup annotation to a PDF file using the Syncfusion library: + +1. **Create a new project**: Set up a new C# Console Application project. + +2. **Install NuGet package**: Add the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package to your .NET Standard application from [NuGet.org](https://www.nuget.org/). + +3. **Include necessary namespaces**: Add the following namespaces to your `Program.cs` file: + + ```csharp + using Syncfusion.Drawing; + using Syncfusion.Pdf; + using Syncfusion.Pdf.Graphics; + using Syncfusion.Pdf.Interactive; + using Syncfusion.Pdf.Parsing; + ``` + +4. **Code to add annotations**: Use the following code snippet in `Program.cs` to insert annotations into a PDF file: + + ```csharp + // Create a FileStream object to read the input PDF file + using (FileStream inputFileStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read)) + { + // Load the PDF document from the input stream + using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFileStream)) + { + // Access the first page of the PDF document + PdfPageBase loadedPage = loadedDocument.Pages[0]; + + // Create a new popup annotation + PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(new RectangleF(100, 100, 20, 20), "Comment"); + + // Set the icon for the popup annotation + popupAnnotation.Icon = PdfPopupIcon.Comment; + + // Set the color for the popup annotation + popupAnnotation.Color = new PdfColor(Color.Yellow); + + // Add the annotation to the page + loadedPage.Annotations.Add(popupAnnotation); + + // Save the updated document + using (FileStream outputFileStream = new FileStream("output.pdf", FileMode.Create, FileAccess.Write)) + { + loadedDocument.Save(outputFileStream); + } + } + } + ``` + +For a complete working example, visit the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Annotation/Add-a-popup-annotation-to-an-existing-PDF-document/.NET). + +To learn more about the extensive features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Compression/Compress-the-images-in-an-existing-PDF-document/.NET/Compress-the-images-in-an-existing-PDF-document/README.md b/Compression/Compress-the-images-in-an-existing-PDF-document/.NET/Compress-the-images-in-an-existing-PDF-document/README.md index 35c80dd4..09c54a0f 100644 --- a/Compression/Compress-the-images-in-an-existing-PDF-document/.NET/Compress-the-images-in-an-existing-PDF-document/README.md +++ b/Compression/Compress-the-images-in-an-existing-PDF-document/.NET/Compress-the-images-in-an-existing-PDF-document/README.md @@ -1,54 +1,59 @@ -# Compress PDF Files - -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) enables users to create, read, and edit PDF documents effortlessly. In addition to these features, the library provides functionality for compressing PDF files, reducing their size without compromising quality, to optimize storage and enhance file sharing efficiency. - -## Steps to compress PDF files. - -Step 1: Create a new C# Console Application project. - -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). - -Step 3: Include the following namespaces in the **Program.cs** file. - -``` -using Syncfusion.Pdf.Parsing; -using Syncfusion.Pdf; - -``` - -Step 4: Include the below code snippet in **Program.cs** to compress PDF files. -``` -// Open a file stream to read the input PDF file. -using (FileStream fileStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) -{ - // Create a new PdfLoadedDocument object from the file stream. - using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileStream)) - { - // Create a new PdfCompressionOptions object. - PdfCompressionOptions options = new PdfCompressionOptions(); - // Enable image compression and set image quality. - options.CompressImages = true; - options.ImageQuality = 50; - // Enable font optimization. - options.OptimizeFont = true; - - // Enable page content optimization. - options.OptimizePageContents = true; - // Remove metadata from the PDF. - options.RemoveMetadata = true; - // Compress the PDF document. - loadedDocument.Compress(options); - - // Save the document into a memory stream. - using (MemoryStream outputStream = new MemoryStream()) - { - loadedDocument.Save(outputStream); - } - } -} - -``` - -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Compression/Compress-the-images-in-an-existing-PDF-document). - -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +# Compressing PDF Files + +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) allows users to seamlessly create, read, and edit PDF documents. Additionally, it offers features for compressing PDF files, which helps reduce their size without sacrificing quality—optimizing storage and enhancing the efficiency of file sharing. + +## Steps to compress PDF files + +Follow these steps to compress PDF files using the Syncfusion library: + +1. **Create a new project**: Set up a new C# Console Application project. + +2. **Install the NuGet package**: Add the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package to your project from [NuGet.org](https://www.nuget.org/). + +3. **Add required namespaces**: Include the following namespaces in your `Program.cs` file: + + ```csharp + using Syncfusion.Pdf.Parsing; + using Syncfusion.Pdf; + ``` + +4. **Implement PDF compression**: Use the following code snippet in `Program.cs` to compress PDF files: + + ```csharp + // Open a file stream to read the input PDF file + using (FileStream fileStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) + { + // Load the PDF document from the file stream + using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileStream)) + { + // Create a new PdfCompressionOptions object + PdfCompressionOptions options = new PdfCompressionOptions(); + + // Enable image compression and set the image quality + options.CompressImages = true; + options.ImageQuality = 50; + + // Enable font optimization + options.OptimizeFont = true; + + // Enable page content optimization + options.OptimizePageContents = true; + + // Remove metadata from the PDF + options.RemoveMetadata = true; + + // Compress the PDF document + loadedDocument.Compress(options); + + // Save the document into a memory stream + using (MemoryStream outputStream = new MemoryStream()) + { + loadedDocument.Save(outputStream); + } + } + } + ``` + +You can download a complete working sample from the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Compression/Compress-the-images-in-an-existing-PDF-document). + +To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/README.md b/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/README.md index 87c4cf11..f01637d9 100644 --- a/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/README.md +++ b/Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/README.md @@ -1,68 +1,68 @@ # Digital Signature -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) enables users to create, read, and edit PDF documents effortlessly. In addition to these features, the library provides robust functionality for applying digital signatures to PDF files, ensuring document authenticity, integrity, and security. +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) offers powerful capabilities for creating, reading, and editing PDF documents. One of its robust features is the ability to apply digital signatures to PDF files, ensuring document authenticity, integrity, and security. -## Steps to Add a Digital Signature to PDF Files +## Steps to add a digital signature to PDF files -Step 1: Create a new C# Console Application project. +Follow these steps to digitally sign PDF files using the Syncfusion library: -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). +1. **Create a new project**: Start by creating a new C# Console Application project. -Step 3: Include the following namespaces in the **Program.cs** file. +2. **Install the NuGet package**: Add the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package to your project from [NuGet.org](https://www.nuget.org/). +3. **Include necessary namespaces**: Add the following namespaces in your `Program.cs` file: -``` -using Syncfusion.Pdf; -using Syncfusion.Pdf.Graphics; -using Syncfusion.Pdf.Parsing; -using Syncfusion.Pdf.Security; -using Syncfusion.Drawing; + ```csharp + using Syncfusion.Pdf; + using Syncfusion.Pdf.Graphics; + using Syncfusion.Pdf.Parsing; + using Syncfusion.Pdf.Security; + using Syncfusion.Drawing; + ``` -``` +4. **Add digital signature code**: Use the following code snippet in `Program.cs` to add a digital signature to a PDF file: -Step 4: Include the below code snippet in **Program.cs** to add a digital signature to PDF files. -``` -//Open existing PDF document as stream -using (FileStream inputStream = new FileStream(Path.GetFullPath("Input.pdf"), FileMode.Open, FileAccess.Read)) -{ - // Load the existing PDF document - PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream); + ```csharp + // Open the existing PDF document as a stream + using (FileStream inputStream = new FileStream(Path.GetFullPath("Input.pdf"), FileMode.Open, FileAccess.Read)) + { + // Load the existing PDF document + PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream); - // Gets the first page of the document - PdfPageBase page = loadedDocument.Pages[0]; + // Get the first page of the document + PdfPageBase page = loadedDocument.Pages[0]; - // Load the certificate from a PFX file with a private key - FileStream certificateStream = new FileStream(@"PDF.pfx", FileMode.Open, FileAccess.Read); - PdfCertificate pdfCert = new PdfCertificate(certificateStream, "password123"); + // Load the certificate from a PFX file with a private key + FileStream certificateStream = new FileStream(@"PDF.pfx", FileMode.Open, FileAccess.Read); + PdfCertificate pdfCert = new PdfCertificate(certificateStream, "password123"); - // Create a signature - PdfSignature signature = new PdfSignature(loadedDocument, page, pdfCert, "Signature"); + // Create a signature + PdfSignature signature = new PdfSignature(loadedDocument, page, pdfCert, "Signature"); - // Set signature information - signature.Bounds = new RectangleF(new PointF(0, 0), new SizeF(200, 100)); - signature.ContactInfo = "johndoe@owned.us"; - signature.LocationInfo = "Honolulu, Hawaii"; - signature.Reason = "I am the author of this document."; + // Set signature information + signature.Bounds = new RectangleF(new PointF(0, 0), new SizeF(200, 100)); + signature.ContactInfo = "johndoe@owned.us"; + signature.LocationInfo = "Honolulu, Hawaii"; + signature.Reason = "I am the author of this document."; - // Load the image for the signature field - FileStream imageStream = new FileStream("signature.png", FileMode.Open, FileAccess.Read); - PdfBitmap signatureImage = new PdfBitmap(imageStream); + // Load the image for the signature field + FileStream imageStream = new FileStream("signature.png", FileMode.Open, FileAccess.Read); + PdfBitmap signatureImage = new PdfBitmap(imageStream); - // Draw the image on the signature field - signature.Appearance.Normal.Graphics.DrawImage(signatureImage, new RectangleF(0, 0, signature.Bounds.Width, signature.Bounds.Height)); + // Draw the image on the signature field + signature.Appearance.Normal.Graphics.DrawImage(signatureImage, new RectangleF(0, 0, signature.Bounds.Width, signature.Bounds.Height)); - // Save the document to a file stream - using (FileStream outputFileStream = new FileStream("signed.pdf", FileMode.Create, FileAccess.ReadWrite)) - { - loadedDocument.Save(outputFileStream); - } + // Save the document to a file stream + using (FileStream outputFileStream = new FileStream("signed.pdf", FileMode.Create, FileAccess.ReadWrite)) + { + loadedDocument.Save(outputFileStream); + } - //Close the document. - loadedDocument.Close(true); -} + // Close the document + loadedDocument.Close(true); + } + ``` -``` +For a complete working example, visit the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Digital%20Signature/Add-a-digital-signature-to-an-existing-document/). -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Digital%20Signature/Add-a-digital-signature-to-an-existing-document/). - -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Forms/Add-a-textbox-field-to-a-new-PDF-document/.NET/Add-a-textbox-field-to-a-new-PDF-document/README.md b/Forms/Add-a-textbox-field-to-a-new-PDF-document/.NET/Add-a-textbox-field-to-a-new-PDF-document/README.md index 5c7cf5d7..93b0c6c7 100644 --- a/Forms/Add-a-textbox-field-to-a-new-PDF-document/.NET/Add-a-textbox-field-to-a-new-PDF-document/README.md +++ b/Forms/Add-a-textbox-field-to-a-new-PDF-document/.NET/Add-a-textbox-field-to-a-new-PDF-document/README.md @@ -1,68 +1,68 @@ # PDF Forms -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also offers functionality for creating, filling, and editing PDF forms, such as interactive form fields and form data. +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) provides an easy way to create, read, and edit PDF documents. It also includes features for creating, filling, and editing PDF forms, which can include interactive form fields and form data. -## Steps to Create PDF Forms +## Steps to create PDF forms -Step 1: Create a new C# Console Application project. +Follow these steps to create a PDF form with a textbox field: -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). +1. **Create a new project**: Start by creating a new C# Console Application project. -Step 3: Include the following namespaces in the **Program.cs** file. +2. **Install the NuGet package**: Add the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package to your project from [NuGet.org](https://www.nuget.org/). +3. **Include necessary namespaces**: Add the following namespaces in your `Program.cs` file: -``` -using Syncfusion.Drawing; -using Syncfusion.Pdf; -using Syncfusion.Pdf.Graphics; -using Syncfusion.Pdf.Interactive; + ```csharp + using Syncfusion.Drawing; + using Syncfusion.Pdf; + using Syncfusion.Pdf.Graphics; + using Syncfusion.Pdf.Interactive; + ``` -``` +4. **Create PDF forms**: Implement the following code in `Program.cs` to add a textbox field to a PDF document: -Step 4: Include the below code snippet in **Program.cs** to create PDF forms. -``` -// Create a new PDF document -using (PdfDocument pdfDocument = new PdfDocument()) -{ - // Add a new page to the PDF document - PdfPage pdfPage = pdfDocument.Pages.Add(); + ```csharp + // Create a new PDF document + using (PdfDocument pdfDocument = new PdfDocument()) + { + // Add a new page to the PDF document + PdfPage pdfPage = pdfDocument.Pages.Add(); - // Set the standard font - PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 16); + // Set the standard font + PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 16); - // Draw the string "Job Application" - pdfPage.Graphics.DrawString("Job Application", font, PdfBrushes.Black, new PointF(250, 0)); + // Draw the title "Job Application" + pdfPage.Graphics.DrawString("Job Application", font, PdfBrushes.Black, new PointF(250, 0)); - // Change the font size for the form fields - font = new PdfStandardFont(PdfFontFamily.Helvetica, 12); + // Change the font size for form fields + font = new PdfStandardFont(PdfFontFamily.Helvetica, 12); - // Draw the string "Name" - pdfPage.Graphics.DrawString("Name", font, PdfBrushes.Black, new PointF(10, 20)); + // Draw the label "Name" + pdfPage.Graphics.DrawString("Name", font, PdfBrushes.Black, new PointF(10, 20)); - // Create a text box field for name - PdfTextBoxField nameField = new PdfTextBoxField(pdfPage, "Name"); - nameField.Bounds = new RectangleF(10, 40, 200, 20); - nameField.ToolTip = "Name"; - pdfDocument.Form.Fields.Add(nameField); + // Create a textbox field for the name + PdfTextBoxField nameField = new PdfTextBoxField(pdfPage, "Name"); + nameField.Bounds = new RectangleF(10, 40, 200, 20); + nameField.ToolTip = "Name"; + pdfDocument.Form.Fields.Add(nameField); - // Draw the string "Email address" - pdfPage.Graphics.DrawString("Email address", font, PdfBrushes.Black, new PointF(10, 80)); + // Draw the label "Email address" + pdfPage.Graphics.DrawString("Email address", font, PdfBrushes.Black, new PointF(10, 80)); - // Create a text box field for email address - PdfTextBoxField emailField = new PdfTextBoxField(pdfPage, "Email address"); - emailField.Bounds = new RectangleF(10, 100, 200, 20); - emailField.ToolTip = "Email address"; - pdfDocument.Form.Fields.Add(emailField); + // Create a textbox field for the email address + PdfTextBoxField emailField = new PdfTextBoxField(pdfPage, "Email address"); + emailField.Bounds = new RectangleF(10, 100, 200, 20); + emailField.ToolTip = "Email address"; + pdfDocument.Form.Fields.Add(emailField); - // Save the PDF document in to a file stream - using (FileStream outputFileSteam = new FileStream("Output.pdf", FileMode.Create)) - { - pdfDocument.Save(outputFileSteam); - } -} + // Save the PDF document to a file stream + using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create)) + { + pdfDocument.Save(outputFileStream); + } + } + ``` -``` +For a full working example, you can download the sample from the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Forms/Add-a-textbox-field-to-a-new-PDF-document). -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Forms/Add-a-textbox-field-to-a-new-PDF-document). - -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/README.md b/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/README.md index dc032d9b..c5cd2b4e 100644 --- a/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/README.md +++ b/HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/README.md @@ -1,36 +1,40 @@ -# HTML to PDF Files +# HTML to PDF Conversion -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also offers functionality to convert HTML content into PDF files with high accuracy. +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) allows you to create, read, and edit PDF documents. It also includes functionality for accurately converting HTML content into PDF files. -## Steps to convert HTML to PDF files. +## Steps to convert HTML to PDF -Step 1: Create a new C# Console Application project. +Follow these steps to convert HTML content into a PDF file using the Syncfusion library: -Step 2: Install the [Syncfusion.HtmlToPdfConverter.Net.Windows](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Windows) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). +1. **Create a new project**: Initialize a new C# Console Application project. -Step 3: Include the following namespaces in the **Program.cs** file. +2. **Install the NuGet package**: Add the [Syncfusion.HtmlToPdfConverter.Net.Windows](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Windows) package as a reference in your .NET Standard application from [NuGet.org](https://www.nuget.org/). -``` -using Syncfusion.HtmlConverter; -using Syncfusion.Pdf; -using System.Runtime.InteropServices; +3. **Include necessary namespaces**: Add the following namespaces in your `Program.cs` file: -``` + ```csharp + using Syncfusion.HtmlConverter; + using Syncfusion.Pdf; + using System.Runtime.InteropServices; + ``` -Step 4: Include the below code snippet in **Program.cs** to convert HTML to PDF files. -``` -//Initialize HTML to PDF converter. -HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); -//Convert URL to PDF document. -PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com"); -//Create the filestream to save the PDF document. -FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite); -//Save and close the PDF document. -document.Save(fileStream); -document.Close(true); +4. **Convert HTML to PDF**: Implement the following code in `Program.cs` to convert a website URL to a PDF file: -``` + ```csharp + // Initialize the HTML to PDF converter + HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); + + // Convert a URL to a PDF document + PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com"); + + // Create the FileStream to save the PDF document + FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite); + + // Save and close the PDF document + document.Save(fileStream); + document.Close(true); + ``` -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/Convert-website-URL-to-PDF-document). +You can download a complete working sample from the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/Convert-website-URL-to-PDF-document). -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Images/Convert_Image_to_PDF/.NET/Convert_Image_to_PDF/README.md b/Images/Convert_Image_to_PDF/.NET/Convert_Image_to_PDF/README.md index 525a5188..ed962cf4 100644 --- a/Images/Convert_Image_to_PDF/.NET/Convert_Image_to_PDF/README.md +++ b/Images/Convert_Image_to_PDF/.NET/Convert_Image_to_PDF/README.md @@ -1,50 +1,51 @@ -# Image to PDF Files +# Converting Images to PDF -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also offers functionality to convert images into PDF files, allowing you to seamlessly integrate image content into PDF documents. +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) offers tools to create, read, and edit PDF documents. It also provides functionality to convert images into PDF files, making it easy to integrate image content into your PDF documents. -## Steps to convert Image to PDF files. +## Steps to convert images to PDF -Step 1: Create a new C# Console Application project. +Follow these steps to convert an image into a PDF file using the Syncfusion library: -Step 2: Install the [Syncfusion.Pdf.Imaging.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Imaging.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). +1. **Create a new project**: Start a new C# Console Application project. -Step 3: Include the following namespaces in the **Program.cs** file. +2. **Install the NuGet package**: Add the [Syncfusion.Pdf.Imaging.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Imaging.Net.Core) package as a reference to your project from [NuGet.org](https://www.nuget.org/). -``` -using Syncfusion.Pdf; +3. **Include necessary namespaces**: Add the following namespace in your `Program.cs` file: -``` + ```csharp + using Syncfusion.Pdf; + ``` -Step 4: Include the below code snippet in **Program.cs** to convert image to PDF files. -``` -// Create an instance of the ImageToPdfConverter class -var imageToPdfConverter = new ImageToPdfConverter(); +4. **Convert image to PDF**: Implement the following code in `Program.cs` to convert an image into a PDF file: -// Set the page size for the PDF -imageToPdfConverter.PageSize = PdfPageSize.A4; + ```csharp + // Create an instance of the ImageToPdfConverter class + var imageToPdfConverter = new ImageToPdfConverter(); -// Set the position of the image in the PDF -imageToPdfConverter.ImagePosition = PdfImagePosition.TopLeftCornerOfPage; + // Set the page size for the PDF + imageToPdfConverter.PageSize = PdfPageSize.A4; -// Create a file stream to read the image file -using (var imageStream = new FileStream("Autumn Leaves.jpg", FileMode.Open, FileAccess.Read)) -{ - // Convert the image to a PDF document using the ImageToPdfConverter - var pdfDocument = imageToPdfConverter.Convert(imageStream); + // Set the position of the image in the PDF + imageToPdfConverter.ImagePosition = PdfImagePosition.TopLeftCornerOfPage; - // Create a file stream for the output PDF file - using (var outputFileStream = new FileStream(Path.GetFullPath("Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) - { - // Save the generated PDF document to the output file stream - pdfDocument.Save(outputFileStream); - } + // Create a file stream to read the image file + using (var imageStream = new FileStream("Autumn Leaves.jpg", FileMode.Open, FileAccess.Read)) + { + // Convert the image to a PDF document using the ImageToPdfConverter + var pdfDocument = imageToPdfConverter.Convert(imageStream); - // Close the document - pdfDocument.Close(true); -} + // Create a file stream for the output PDF file + using (var outputFileStream = new FileStream(Path.GetFullPath("Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) + { + // Save the generated PDF document to the output file stream + pdfDocument.Save(outputFileStream); + } -``` + // Close the document + pdfDocument.Close(true); + } + ``` -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Images/Convert_Image_to_PDF/.NET). +You can download a complete working sample from the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Images/Convert_Image_to_PDF/.NET). -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Merge PDFs/Merge-multiple-documents-from-stream/.NET/Merge-multiple-documents-from-stream/README.md b/Merge PDFs/Merge-multiple-documents-from-stream/.NET/Merge-multiple-documents-from-stream/README.md index f8e002a1..a528102b 100644 --- a/Merge PDFs/Merge-multiple-documents-from-stream/.NET/Merge-multiple-documents-from-stream/README.md +++ b/Merge PDFs/Merge-multiple-documents-from-stream/.NET/Merge-multiple-documents-from-stream/README.md @@ -1,46 +1,46 @@ -# Merge PDF Files +# Merging PDF Files -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) enables users to create, read, and edit PDF documents with ease. Additionally, this library provides functionality for merging multiple PDF files into a single document. +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) allows you to easily create, read, edit, and merge PDF documents. This library provides a straightforward way to combine multiple PDF files into a single document. -## Steps to merge PDF files. +## Steps to merge PDF files -Step 1: Create a new C# Console Application project. +Follow these steps to merge PDF files using the Syncfusion library: -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). +1. **Create a new project**: Start by creating a new C# Console Application project. -Step 3: Include the following namespaces in the **Program.cs** file. +2. **Install the NuGet package**: Reference the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package in your project from [NuGet.org](https://www.nuget.org/). +3. **Include required namespaces**: Add the following namespace in your `Program.cs` file: -``` -using Syncfusion.Pdf; + ```csharp + using Syncfusion.Pdf; + ``` -``` +4. **Merge PDF files**: Use the following code snippet in `Program.cs` to merge PDF files: -Step 4: Include the below code snippet in **Program.cs** to merge PDF files. -``` -// Create a PDF document. -using (PdfDocument finalDocument = new PdfDocument()) -{ - // Get the stream from an existing PDF documents. - using (FileStream firstFileStream = new FileStream("File1.pdf", FileMode.Open, FileAccess.Read)) - using (FileStream secondFileStream = new FileStream("File2.pdf", FileMode.Open, FileAccess.Read)) - { - // Create an array of streams for merging. - Stream[] streams = { firstFileStream, secondFileStream }; + ```csharp + // Create a PDF document for the final merged output + using (PdfDocument finalDocument = new PdfDocument()) + { + // Open streams for existing PDF documents + using (FileStream firstFileStream = new FileStream("File1.pdf", FileMode.Open, FileAccess.Read)) + using (FileStream secondFileStream = new FileStream("File2.pdf", FileMode.Open, FileAccess.Read)) + { + // Create an array of streams to merge + Stream[] streams = { firstFileStream, secondFileStream }; - // Merge PDF documents. - PdfDocumentBase.Merge(finalDocument, streams); + // Merge PDF documents into the final document + PdfDocumentBase.Merge(finalDocument, streams); - // Save the merged document into a file stream. - using (FileStream outputFileStream = new FileStream("MergedDocument.pdf", FileMode.Create, FileAccess.Write)) - { - finalDocument.Save(outputFileStream); - } - } -} + // Save the merged document to a file stream + using (FileStream outputFileStream = new FileStream("MergedDocument.pdf", FileMode.Create, FileAccess.Write)) + { + finalDocument.Save(outputFileStream); + } + } + } + ``` -``` +You can download a complete working sample from the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Merge%20PDFs/Merge-multiple-documents-from-stream/). -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Merge%20PDFs/Merge-multiple-documents-from-stream/). - -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +To explore additional features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/OCR/.NET/Perform-OCR-for-the-entire-PDF-document/Perform-OCR-for-the-entire-PDF-document/README.md b/OCR/.NET/Perform-OCR-for-the-entire-PDF-document/Perform-OCR-for-the-entire-PDF-document/README.md index 689160d5..47dfe316 100644 --- a/OCR/.NET/Perform-OCR-for-the-entire-PDF-document/Perform-OCR-for-the-entire-PDF-document/README.md +++ b/OCR/.NET/Perform-OCR-for-the-entire-PDF-document/Perform-OCR-for-the-entire-PDF-document/README.md @@ -1,50 +1,51 @@ -# OCR PDF Files - -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also offers functionality to perform OCR (Optical Character Recognition) on PDF files, enabling the extraction of text from scanned images. - -## Steps to OCR PDF files. - -Step 1: Create a new C# Console Application project. - -Step 2: Install the [Syncfusion.PDF.OCR.Net.Core](https://www.nuget.org/packages/Syncfusion.PDF.OCR.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). - -Step 3: Include the following namespaces in the **Program.cs** file. - -``` -using Syncfusion.OCRProcessor; -using Syncfusion.Pdf.Parsing; - -``` - -Step 4: Include the below code snippet in **Program.cs** to OCR PDF files. - -``` -// Initialize the OCR processor -using (OCRProcessor processor = new OCRProcessor()) -{ - // Load the existing PDF document - using (FileStream stream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) - { - PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(stream); - - // Set OCR language to process - processor.Settings.Language = Languages.English; - // Process OCR by providing the PDF document - processor.PerformOCR(pdfLoadedDocument); - - // Save the OCRed document - using (FileStream outputFileStream = new FileStream(@"Output.pdf", FileMode.Create, FileAccess.ReadWrite)) - { - //Save the PDF document to file stream. - pdfLoadedDocument.Save(outputFileStream); - } - //Close the document. - pdfLoadedDocument.Close(true); - } -} - -``` - -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/OCR/.NET/Perform-OCR-for-the-entire-PDF-document). - -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +# OCR on PDF Files + +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) enables you to create, read, and edit PDF documents effortlessly. Additionally, the library provides OCR (Optical Character Recognition) capabilities, allowing you to extract text from scanned images within PDF files. + +## Steps to perform OCR on PDF files + +Follow these steps to apply OCR to PDF files using the Syncfusion library: + +1. **Create a new project**: Set up a new C# Console Application project. + +2. **Install the NuGet package**: Add the [Syncfusion.PDF.OCR.Net.Core](https://www.nuget.org/packages/Syncfusion.PDF.OCR.Net.Core) package as a reference in your project from [NuGet.org](https://www.nuget.org/). + +3. **Include necessary namespaces**: Add the following namespaces in your `Program.cs` file: + + ```csharp + using Syncfusion.OCRProcessor; + using Syncfusion.Pdf.Parsing; + ``` + +4. **Implement OCR Processing**: Use the following code snippet in `Program.cs` to perform OCR on a PDF document: + + ```csharp + // Initialize the OCR processor + using (OCRProcessor processor = new OCRProcessor()) + { + // Load the existing PDF document + using (FileStream stream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) + { + PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(stream); + + // Set the language for OCR processing + processor.Settings.Language = Languages.English; + + // Perform OCR on the PDF document + processor.PerformOCR(pdfLoadedDocument); + + // Save the OCR-processed document + using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite)) + { + pdfLoadedDocument.Save(outputFileStream); + } + + // Close the document + pdfLoadedDocument.Close(true); + } + } + ``` + +For a complete working sample, you can download the example from the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/OCR/.NET/Perform-OCR-for-the-entire-PDF-document). + +To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/PDF Conformance/Convert-PDF-to-PDFA-conformance-document/.NET/Convert-PDF-to-PDFA-conformance-document/README.md b/PDF Conformance/Convert-PDF-to-PDFA-conformance-document/.NET/Convert-PDF-to-PDFA-conformance-document/README.md new file mode 100644 index 00000000..6e494167 --- /dev/null +++ b/PDF Conformance/Convert-PDF-to-PDFA-conformance-document/.NET/Convert-PDF-to-PDFA-conformance-document/README.md @@ -0,0 +1,46 @@ +# Convert PDF to PDF/A + +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) provides tools for creating, reading, and editing PDF documents. Among its features, the library enables conversion of standard PDF files into the PDF/A format, suitable for long-term archiving and meeting archival standards. + +## Steps to convert a PDF to PDF/A + +Follow these steps to convert a PDF document to PDF/A format using the Syncfusion library: + +1. **Create a new project**: Start by creating a new C# Console Application project. + +2. **Install the NuGet package**: Reference the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package in your project from [NuGet.org](https://www.nuget.org/). + +3. **Include necessary namespaces**: Add the following namespaces in your `Program.cs` file: + + ```csharp + using Syncfusion.Pdf; + using Syncfusion.Pdf.Parsing; + ``` + +4. **Convert PDF to PDF/A**: Implement the following code in `Program.cs` to perform the conversion: + + ```csharp + // Load an existing PDF document + using (FileStream inputPdfStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) + { + // Initialize PdfLoadedDocument with the input file stream + PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputPdfStream); + + // Convert the loaded document to PDF/A format with the specified conformance level + loadedDocument.ConvertToPDFA(PdfConformanceLevel.Pdf_A1B); + + // Save the converted PDF/A document to a new file + using (FileStream outputPdfStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.Write)) + { + // Save the modified PDF document to the output file stream + loadedDocument.Save(outputPdfStream); + } + + // Close the loaded document to release resources + loadedDocument.Close(true); + } + ``` + +You can download a complete working sample from the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/PDF%20Conformance/Get-PDF-to-PDFA-conversion-progress/.NET). + +To explore additional features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/PDF Conformance/Get-PDF-to-PDFA-conversion-progress/.NET/Get-PDF-to-PDFA-conversion-progress/Program.cs b/PDF Conformance/Get-PDF-to-PDFA-conversion-progress/.NET/Get-PDF-to-PDFA-conversion-progress/Program.cs index a308f6f2..87c4b894 100644 --- a/PDF Conformance/Get-PDF-to-PDFA-conversion-progress/.NET/Get-PDF-to-PDFA-conversion-progress/Program.cs +++ b/PDF Conformance/Get-PDF-to-PDFA-conversion-progress/.NET/Get-PDF-to-PDFA-conversion-progress/Program.cs @@ -3,22 +3,27 @@ using Syncfusion.Pdf; using Syncfusion.Pdf.Parsing; -// Load an existing PDF document -using (FileStream inputPdfStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read)) +//Get stream from an existing PDF document. +FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read); + +//Load an existing PDF document. +PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream); + +//Subscribe to the PdfAConversionProgress event to track the PDF to PDF/A conversion process +loadedDocument.PdfAConversionProgress += new PdfLoadedDocument.PdfAConversionProgressEventHandler(pdfAConversion_TrackProgress); + +loadedDocument.ConvertToPDFA(PdfConformanceLevel.Pdf_A1B); + +//Save the document +FileStream outputStream = new FileStream(Path.GetFullPath(@"Output.pdf"), FileMode.Create, FileAccess.Write); +loadedDocument.Save(outputStream); + +//Close the document +loadedDocument.Close(true); + + +//Event handler for Track PDF to PDF/A conversion process +void pdfAConversion_TrackProgress(object sender, PdfAConversionProgressEventArgs arguments) { - // Initialize PdfLoadedDocument with the input file stream - PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputPdfStream); - - // Convert the loaded document to PDF/A format with specified conformance level - loadedDocument.ConvertToPDFA(PdfConformanceLevel.Pdf_A1B); - - // Save the converted PDF/A document to a new file - using (FileStream outputPdfStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write)) - { - // Save the modified PDF document to the output file stream - loadedDocument.Save(outputPdfStream); - } - - // Close the loaded document to release resources - loadedDocument.Close(true); + Console.WriteLine(String.Format("PDF to PDF/A conversion process " + arguments.ProgressValue + "% completed")); } \ No newline at end of file diff --git a/PDF Conformance/Get-PDF-to-PDFA-conversion-progress/.NET/Get-PDF-to-PDFA-conversion-progress/README.md b/PDF Conformance/Get-PDF-to-PDFA-conversion-progress/.NET/Get-PDF-to-PDFA-conversion-progress/README.md deleted file mode 100644 index e63a65d1..00000000 --- a/PDF Conformance/Get-PDF-to-PDFA-conversion-progress/.NET/Get-PDF-to-PDFA-conversion-progress/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Convert PDF to PDF/A - -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also offers functionality to convert standard PDF files into PDF/A format for long-term archiving and compliance with archival standards. - -## Steps to convert PDF to PDF/A - -Step 1: Create a new C# Console Application project. - -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). - -Step 3: Include the following namespaces in the **Program.cs** file. - -``` -using Syncfusion.Pdf; -using Syncfusion.Pdf.Parsing; - -``` - -Step 4: Include the below code snippet in **Program.cs** to convert PDF to PDF/A files. -``` -// Load an existing PDF document -using (FileStream inputPdfStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) -{ - // Initialize PdfLoadedDocument with the input file stream - PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputPdfStream); - // Convert the loaded document to PDF/A format with specified conformance level - loadedDocument.ConvertToPDFA(PdfConformanceLevel.Pdf_A1B); - - // Save the converted PDF/A document to a new file - using (FileStream outputPdfStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.Write)) - { - // Save the modified PDF document to the output file stream - loadedDocument.Save(outputPdfStream); - } - // Close the loaded document to release resources - loadedDocument.Close(true); -} - -``` - -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/PDF%20Conformance/Get-PDF-to-PDFA-conversion-progress/.NET). - -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file diff --git a/Pages/Splitting-PDF-file-into-individual-pages/.NET/Splitting-PDF-file-into-individual-pages/README.md b/Pages/Splitting-PDF-file-into-individual-pages/.NET/Splitting-PDF-file-into-individual-pages/README.md index 690d8e61..c9a1f2aa 100644 --- a/Pages/Splitting-PDF-file-into-individual-pages/.NET/Splitting-PDF-file-into-individual-pages/README.md +++ b/Pages/Splitting-PDF-file-into-individual-pages/.NET/Splitting-PDF-file-into-individual-pages/README.md @@ -1,52 +1,50 @@ # Split PDF Files -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also provides functionality for splitting PDF files into multiple documents +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) allows for creating, reading, and editing PDF documents, as well as splitting them into separate files. -## Steps to split PDF files. +## Steps to split PDF files -Step 1: Create a new C# Console Application project. +1. **Create a new project**: Begin by setting up a new C# Console Application project. -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). - -Step 3: Include the following namespaces in the **Program.cs** file. +2. **Install the NuGet package**: Add the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package to your project from [NuGet.org](https://www.nuget.org/). +3. **Include necessary namespaces**: In your **Program.cs** file, include the following namespaces: + ```csharp + using Syncfusion.Pdf.Parsing; + using Syncfusion.Pdf; ``` -using Syncfusion.Pdf.Parsing; -using Syncfusion.Pdf -``` +4. **Split the PDF file:** Implement the following code in **Program.cs** to split the PDF file: -Step 4: Include the below code snippet in **Program.cs** to split PDF files. -``` -// Create the FileStream object to read the input PDF file +```csharp +// Create a FileStream object to read the input PDF file using (FileStream inputFileStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) { // Load the PDF document from the input stream - using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFileStream)) + using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFileStream)) { - // Iterate over the pages of the loaded document - for (int pageIndex = 0; pageIndex < loadedDocument.PageCount; pageIndex++) + // Iterate over each page of the loaded document + for (int pageIndex = 0; pageIndex < loadedDocument.PageCount; pageIndex++) { - // Create a new PdfDocument object to hold the output - using (PdfDocument outputDocument = new PdfDocument()) + // Create a new PdfDocument for the output + using (PdfDocument outputDocument = new PdfDocument()) { - // Import the page from the loadedDocument to the outputDocument - outputDocument.ImportPage(loadedDocument, pageIndex); - - // Create the FileStream object to write the output PDF file + // Import the page into the new document + outputDocument.ImportPage(loadedDocument, pageIndex); + + // Create a FileStream to write the output PDF file using (FileStream outputFileStream = new FileStream($"Output{pageIndex}.pdf", FileMode.Create, FileAccess.Write)) { - // Save the outputDocument into the outputFileStream + // Save the new document to the output stream outputDocument.Save(outputFileStream); } } } } } - ``` -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Pages/Splitting-PDF-file-into-individual-pages/). +You can download a complete working sample from [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Pages/Splitting-PDF-file-into-individual-pages/). -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +To explore additional features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Redaction/Removing-sensitive-content-from-the-PDF-document/.NET/Removing-sensitive-content-from-the-PDF-document/README.md b/Redaction/Removing-sensitive-content-from-the-PDF-document/.NET/Removing-sensitive-content-from-the-PDF-document/README.md index d5bd8184..0303a344 100644 --- a/Redaction/Removing-sensitive-content-from-the-PDF-document/.NET/Removing-sensitive-content-from-the-PDF-document/README.md +++ b/Redaction/Removing-sensitive-content-from-the-PDF-document/.NET/Removing-sensitive-content-from-the-PDF-document/README.md @@ -1,50 +1,52 @@ -# Redaction PDF Files - -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) enables users to create, read, and edit PDF documents effortlessly. In addition to these features, the library provides functionality for redacting PDF content, allowing users to permanently remove or hide sensitive information while preserving the integrity of the rest of the document. - -## Steps to redaction PDF files. - -Step 1: Create a new C# Console Application project. - -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). - -Step 3: Include the following namespaces in the **Program.cs** file. - -``` -using Syncfusion.Pdf.Parsing; -using Syncfusion.Pdf.Redaction; -using Syncfusion.Pdf; -using Syncfusion.Drawing; - -``` - -Step 4: Include the below code snippet in **Program.cs** to redaction PDF files. -``` -using (FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read)) -{ - //Load the PDF document from the input stream - using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream)) - { - // Get the first page of the loaded document - PdfLoadedPage firstPage = loadedDocument.Pages[0] as PdfLoadedPage; - // Create a PDF redaction for the specified rectangle on the page - RectangleF redactionRectangle = new RectangleF(340, 120, 140, 20); - PdfRedaction redaction = new PdfRedaction(redactionRectangle); - // Add the redaction to the first page - firstPage.AddRedaction(redaction); - //Redact the contents from the PDF document - loadedDocument.Redact(); - - // Save the redacted PDF document to a file stream - using (FileStream outputFileStream = new FileStream("Redact.pdf", FileMode.Create, FileAccess.ReadWrite)) - { - loadedDocument.Save(outputFileStream); - } - } -} - -``` - -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Redaction/Removing-sensitive-content-from-the-PDF-document/). - -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +# Redacting PDF Files + +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) allows users to create, read, and edit PDFs seamlessly. One of its key features is the ability to redact PDF content, enabling the permanent removal or hiding of sensitive information while maintaining the rest of the document's integrity. + +## Steps to Redact PDF Files + +1. **Create a new project**: Start by creating a new C# Console Application project. + +2. **Install the NuGet package**: Add the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package to your project via [NuGet.org](https://www.nuget.org/). + +3. **Include necessary namespaces**: Add these namespaces to your **Program.cs** file: + + ```csharp + using Syncfusion.Pdf.Parsing; + using Syncfusion.Pdf.Redaction; + using Syncfusion.Pdf; + using Syncfusion.Drawing; + ``` + +4. **Implement redaction**: Use the following code in **Program.cs** to perform PDF redaction: + + ```csharp + using (FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read)) + { + // Load the PDF document from the input stream + using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream)) + { + // Access the first page of the document + PdfLoadedPage firstPage = loadedDocument.Pages[0] as PdfLoadedPage; + + // Define a redaction area + RectangleF redactionRectangle = new RectangleF(340, 120, 140, 20); + PdfRedaction redaction = new PdfRedaction(redactionRectangle); + + // Apply the redaction to the page + firstPage.AddRedaction(redaction); + + // Execute the redaction + loadedDocument.Redact(); + + // Save the redacted document + using (FileStream outputFileStream = new FileStream("Redact.pdf", FileMode.Create, FileAccess.ReadWrite)) + { + loadedDocument.Save(outputFileStream); + } + } + } + ``` + +You can download a complete working example from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Redaction/Removing-sensitive-content-from-the-PDF-document/). + +Discover more features of the Syncfusion PDF library [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Security/Protect-an-existing-PDF-document/.NET/Protect-an-existing-PDF-document/README.md b/Security/Protect-an-existing-PDF-document/.NET/Protect-an-existing-PDF-document/README.md index a61dbfb0..63bd6c0c 100644 --- a/Security/Protect-an-existing-PDF-document/.NET/Protect-an-existing-PDF-document/README.md +++ b/Security/Protect-an-existing-PDF-document/.NET/Protect-an-existing-PDF-document/README.md @@ -1,51 +1,51 @@ # Protect PDF Files -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also offers functionality to protect PDF files by applying encryption and setting password-based permissions. +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) provides tools for creating, reading, and editing PDF documents. It also allows you to protect your PDF files by applying encryption and setting password-based permissions. -## Steps to protect PDF files. +## Steps to Protect PDF Files -Step 1: Create a new C# Console Application project. +1. **Create a new project**: Begin by setting up a new C# Console Application project. -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). +2. **Install the NuGet package**: Add the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package to your project from [NuGet.org](https://www.nuget.org/). -Step 3: Include the following namespaces in the **Program.cs** file. +3. **Include necessary namespaces**: Add these namespaces in your **Program.cs** file: + ```csharp + using Syncfusion.Pdf.Security; + using Syncfusion.Pdf.Parsing; + ``` -``` -using Syncfusion.Pdf.Security; -using Syncfusion.Pdf.Parsing; +4. **Implement encryption**: Use the following code in **Program.cs** to secure your PDF file: -``` + ```csharp + // Load the PDF document from a file stream + using (FileStream inputFileStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) + { + // Load the PDF document + PdfLoadedDocument document = new PdfLoadedDocument(inputFileStream); -Step 4: Include the below code snippet in **Program.cs** to protect PDF files. -``` -// Load the PDF document from a file stream -using (FileStream inputFileStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) -{ - // Load the PDF document - PdfLoadedDocument document = new PdfLoadedDocument(inputFileStream); + // Access the document's security settings + PdfSecurity security = document.Security; - // Gets a security object for the document - PdfSecurity security = document.Security; - // Configure key size and encryption algorithm - security.KeySize = PdfEncryptionKeySize.Key256Bit; - security.Algorithm = PdfEncryptionAlgorithm.AES; - // Assign owner and user passwords - security.OwnerPassword = "owner123"; - security.UserPassword = "user123"; + // Set key size and encryption algorithm + security.KeySize = PdfEncryptionKeySize.Key256Bit; + security.Algorithm = PdfEncryptionAlgorithm.AES; - // Save the PDF document in to a file stream - using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create)) - { - document.Save(outputFileStream); - } + // Specify owner and user passwords + security.OwnerPassword = "owner123"; + security.UserPassword = "user123"; - // Close the document - document.Close(true); -} + // Save the protected PDF document to a file stream + using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create)) + { + document.Save(outputFileStream); + } -``` + // Close the document + document.Close(true); + } + ``` -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Security/Protect-an-existing-PDF-document/). +You can download a complete working example from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Security/Protect-an-existing-PDF-document/). -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +Explore more capabilities of the Syncfusion PDF library [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Table/PdfGrid/Create-table-from-data-source-in-a-PDF/.NET/Create-table-from-data-source-in-a-PDF/README.md b/Table/PdfGrid/Create-table-from-data-source-in-a-PDF/.NET/Create-table-from-data-source-in-a-PDF/README.md index cc044d73..b7fd778d 100644 --- a/Table/PdfGrid/Create-table-from-data-source-in-a-PDF/.NET/Create-table-from-data-source-in-a-PDF/README.md +++ b/Table/PdfGrid/Create-table-from-data-source-in-a-PDF/.NET/Create-table-from-data-source-in-a-PDF/README.md @@ -1,52 +1,55 @@ # PDF Tables -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also offers functionality to create and customize tables in PDF files for organizing and presenting data effectively. +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) facilitates the creation, reading, and editing of PDF documents. It also provides features to create and customize tables within PDF files, allowing for efficient data organization and presentation. -## Steps to add a table to a PDF document +## Steps to Add a Table to a PDF Document -Step 1: Create a new C# Console Application project. +1. **Create a new project**: Start by setting up a new C# Console Application project. -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). +2. **Install the NuGet package**: Reference the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package in your project from [NuGet.org](https://www.nuget.org/). -Step 3: Include the following namespaces in the **Program.cs** file. +3. **Include necessary namespaces**: Add these namespaces to your **Program.cs** file: -``` -using Syncfusion.Pdf.Grid; -using Syncfusion.Pdf; -using Syncfusion.Drawing; + ```csharp + using Syncfusion.Pdf.Grid; + using Syncfusion.Pdf; + using Syncfusion.Drawing; + ``` -``` +4. **Add a table to the PDF**: Use the following code in **Program.cs** to insert a table into the PDF: -Step 4: Include the below code snippet in **Program.cs** to add a table to a PDF files. -``` -//Create a new PDF document -using (PdfDocument document = new PdfDocument()) -{ - //Add a page - PdfPage page = document.Pages.Add(); - //Create a PdfGrid - PdfGrid pdfGrid = new PdfGrid(); + ```csharp + // Create a new PDF document + using (PdfDocument document = new PdfDocument()) + { + // Add a page + PdfPage page = document.Pages.Add(); - //Add values to the list - List data = new List(); - data.Add(new { ID = "E01", Name = "Clay" }); - data.Add(new { ID = "E02", Name = "Thomas" }); - data.Add(new { ID = "E03", Name = "John" }); + // Create a PdfGrid + PdfGrid pdfGrid = new PdfGrid(); - //Assign the data source - pdfGrid.DataSource = data; - //Draw the grid to the page of PDF document - pdfGrid.Draw(page, new PointF(10, 10)); + // Add values to the list + List data = new List + { + new { ID = "E01", Name = "Clay" }, + new { ID = "E02", Name = "Thomas" }, + new { ID = "E03", Name = "John" } + }; - using (FileStream outputStream = new FileStream("output.pdf", FileMode.Create, FileAccess.Write)) - { - //Save the document - document.Save(outputStream); - } -} + // Assign the data source + pdfGrid.DataSource = data; -``` + // Draw the grid on the PDF page + pdfGrid.Draw(page, new PointF(10, 10)); -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Table/PdfGrid/Create-table-from-data-source-in-a-PDF/.NET). + using (FileStream outputStream = new FileStream("output.pdf", FileMode.Create, FileAccess.Write)) + { + // Save the document + document.Save(outputStream); + } + } + ``` -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +A complete working example is available on [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Table/PdfGrid/Create-table-from-data-source-in-a-PDF/.NET). + +Explore more features of the Syncfusion PDF library [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Tagged PDF/Add-tag-for-the-text-element-in-PDF-document/.NET/Add-tag-for-the-text-element-in-PDF-document/README.md b/Tagged PDF/Add-tag-for-the-text-element-in-PDF-document/.NET/Add-tag-for-the-text-element-in-PDF-document/README.md index 9cfa2678..61f02030 100644 --- a/Tagged PDF/Add-tag-for-the-text-element-in-PDF-document/.NET/Add-tag-for-the-text-element-in-PDF-document/README.md +++ b/Tagged PDF/Add-tag-for-the-text-element-in-PDF-document/.NET/Add-tag-for-the-text-element-in-PDF-document/README.md @@ -1,65 +1,63 @@ # Accessible PDF Files -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also provides functionality for creating accessible PDFs that comply with accessibility standards, ensuring content is usable by individuals with disabilities. +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) facilitates the creation, reading, and editing of PDF documents. It also offers features for generating accessible PDFs that adhere to accessibility standards, making content accessible to individuals with disabilities. -## Steps to accessible PDF files. +## Steps to Create Accessible PDF Files -Step 1: Create a new C# Console Application project. +1. **Create a new project**: Start by setting up a new C# Console Application project. -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). +2. **Install the NuGet package**: Add the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package to your project from [NuGet.org](https://www.nuget.org/). -Step 3: Include the following namespaces in the **Program.cs** file. +3. **Include necessary namespaces**: Add these namespaces in your **Program.cs** file: -``` + ```csharp + using Syncfusion.Drawing; + using Syncfusion.Pdf; + using Syncfusion.Pdf.Graphics; + ``` -using Syncfusion.Drawing; -using Syncfusion.Pdf; -using Syncfusion.Pdf.Graphics; +4. **Implement accessibility**: Use the following code in **Program.cs** to create an accessible PDF: -``` + ```csharp + // Create new PDF document + using (PdfDocument document = new PdfDocument()) + { + // Set the document title + document.DocumentInformation.Title = "PdfTextElement"; -Step 4: Include the below code snippet in **Program.cs** to accessible PDF files. -``` -// Create new PDF document -using (PdfDocument document = new PdfDocument()) -{ - // Set the document title - document.DocumentInformation.Title = "PdfTextElement"; + // Create a new page + PdfPage page = document.Pages.Add(); - // Create a new page - PdfPage page = document.Pages.Add(); + // Initialize the structure element with tag type paragraph + PdfStructureElement paragraphStructure = new PdfStructureElement(PdfTagType.Paragraph); - // Initialize the structure element with tag type paragraph - PdfStructureElement paragraphStructure = new PdfStructureElement(PdfTagType.Paragraph); + // Represents the text that is the exact replacement for PdfTextElement + paragraphStructure.ActualText = "Simple paragraph element"; - // Represents the text that is the exact replacement for PdfTextElement - paragraphStructure.ActualText = "Simple paragraph element"; + string paragraphText = "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European, and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base."; - string paragraphText = "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European, and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base."; + // Initialize the PDF text element + PdfTextElement textElement = new PdfTextElement(paragraphText); - // Initialize the PDF text element - PdfTextElement textElement = new PdfTextElement(paragraphText); + // Assign the tag to the text element + textElement.PdfTag = paragraphStructure; - // Adding tag to the text element - textElement.PdfTag = paragraphStructure; + // Create font for the text element + textElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12); - // Create font for the text element - textElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12); + textElement.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93)); - textElement.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93)); + // Draw text element with tag + textElement.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width, 200)); - // Draw text element with tag - textElement.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width, 200)); + using (FileStream outputFile = new FileStream("TaggedPDF.pdf", FileMode.Create)) + { + // Save the document + document.Save(outputFile); + } + } + ``` - using (FileStream outputFile = new FileStream("TaggedPDF.pdf", FileMode.Create)) - { - // Save the document - document.Save(outputFile); - } -} +You can download a complete working example from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Tagged%20PDF/Add-tag-for-the-text-element-in-PDF-document). -``` - -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Tagged%20PDF/Add-tag-for-the-text-element-in-PDF-document). - -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +Discover more features of the Syncfusion PDF library [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Text Extraction/Extract-text-from-the-entire-PDF-document/.NET/Extract-text-from-the-entire-PDF-document/README.md b/Text Extraction/Extract-text-from-the-entire-PDF-document/.NET/Extract-text-from-the-entire-PDF-document/README.md index 2535b31c..d983fd40 100644 --- a/Text Extraction/Extract-text-from-the-entire-PDF-document/.NET/Extract-text-from-the-entire-PDF-document/README.md +++ b/Text Extraction/Extract-text-from-the-entire-PDF-document/.NET/Extract-text-from-the-entire-PDF-document/README.md @@ -1,46 +1,44 @@ # Extract Data from PDF -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also offers functionality to extract data from PDF files, including text, images, and form field values. +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) enables the creation, reading, and editing of PDF documents. Additionally, it provides capabilities to extract data from PDFs, such as text, images, and form field values. -## Steps to extract data from PDF files. +## Steps to Extract Data from PDF Files -Step 1: Create a new C# Console Application project. +1. **Create a new project**: Begin by setting up a new C# Console Application project. -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). +2. **Install the NuGet package**: Add the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package to your project from [NuGet.org](https://www.nuget.org/). -Step 3: Include the following namespaces in the **Program.cs** file. +3. **Include necessary namespaces**: Add these namespaces in your **Program.cs** file: -``` -using Syncfusion.Pdf; -using Syncfusion.Pdf.Parsing; -using System.IO; + ```csharp + using Syncfusion.Pdf; + using Syncfusion.Pdf.Parsing; + using System.IO; + ``` -``` +4. **Extract data from PDF**: Use the following code in **Program.cs** to extract data from a PDF: -Step 4: Include the below code snippet in **Program.cs** to extract data from PDF files. + ```csharp + // Open an existing PDF document stream + using (FileStream inputStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) + { + // Load the PDF document + using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream)) + { + string extractedText = string.Empty; -``` -// Open existing PDF document stream. -using (FileStream inputStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read)) -{ - // Load the PDF document. - using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream)) - { - string extractedText = string.Empty; - - // Extract all text from PDF document pages. - foreach (PdfLoadedPage page in loadedDocument.Pages) - { - extractedText += page.ExtractText(); - } - - // Save extracted text to file. - File.WriteAllText("Result.txt", extractedText); - } -} + // Extract all text from the PDF document pages + foreach (PdfLoadedPage page in loadedDocument.Pages) + { + extractedText += page.ExtractText(); + } -``` + // Save the extracted text to a file + File.WriteAllText("Result.txt", extractedText); + } + } + ``` -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Text%20Extraction/Extract-text-from-the-entire-PDF-document/). +For a complete working example, download it from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Text%20Extraction/Extract-text-from-the-entire-PDF-document/). -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +Explore more features of the Syncfusion PDF library [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file diff --git a/Watermark/Add-text-watermark-in-an-existing-PDF-document/.NET/Add-text-watermark-in-an-existing-PDF-document/README.md b/Watermark/Add-text-watermark-in-an-existing-PDF-document/.NET/Add-text-watermark-in-an-existing-PDF-document/README.md index c629c511..4cf49806 100644 --- a/Watermark/Add-text-watermark-in-an-existing-PDF-document/.NET/Add-text-watermark-in-an-existing-PDF-document/README.md +++ b/Watermark/Add-text-watermark-in-an-existing-PDF-document/.NET/Add-text-watermark-in-an-existing-PDF-document/README.md @@ -1,59 +1,63 @@ # Edit PDF Files -The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) is used to create, read, and edit PDF documents. This library also offers functionality to modify existing PDF files, including updating text, images, and other content. - -## Steps to edit PDF files. - -Step 1: Create a new C# Console Application project. - -Step 2: Install the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/). - -Step 3: Include the following namespaces in the **Program.cs** file. - -``` -using Syncfusion.Pdf.Graphics; -using Syncfusion.Pdf.Parsing; -using Syncfusion.Pdf; -using Syncfusion.Drawing; - -``` - -Step 4: Include the below code snippet in **Program.cs** to edit PDF files. -``` -// Create FileStream object to read the input PDF file -using (FileStream inputFileStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read)) -{ - // Load the PDF document from the input stream - using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFileStream)) - { - // Get the first page of the PDF document - PdfPageBase loadedPage = loadedDocument.Pages[0]; - // Create a PDF font to add a watermark text. - PdfStandardFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 32); - // Measure the watermark text and get the size - string watermarkText = "Created using Syncfusion PDF library"; - SizeF watermarkTextSize = font.MeasureString(watermarkText); - - // Move the graphics to the center of the page - loadedPage.Graphics.Save(); - loadedPage.Graphics.TranslateTransform(loadedPage.Size.Width / 2, loadedPage.Size.Height / 2); - // Rotate the graphics to 45 degrees - loadedPage.Graphics.RotateTransform(-45); - // Draw the watermark text - loadedPage.Graphics.DrawString(watermarkText, font, PdfBrushes.Red, new PointF(-watermarkTextSize.Width / 2, -watermarkTextSize.Height / 2)); - // Restore the graphics - loadedPage.Graphics.Restore(); - - using (FileStream outputStream = new FileStream("output.pdf", FileMode.Create, FileAccess.Write)) - { - // Save the document - loadedDocument.Save(outputStream); - } - } -} - -``` - -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Watermark/Add-text-watermark-in-an-existing-PDF-document/.NET). - -Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core) to explore the rich set of Syncfusion PDF library features. \ No newline at end of file +The Syncfusion [.NET Core PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net-core/pdf-library) provides tools for creating, reading, and editing PDF documents. It also supports modifying existing PDF files, including updating text, images, and other content. + +## Steps to Add a Watermark to a PDF File + +1. **Create a new project**: Begin by setting up a new C# Console Application project. + +2. **Install the NuGet package**: Add the [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.Pdf.Net.Core/) package to your project from [NuGet.org](https://www.nuget.org/). + +3. **Include necessary namespaces**: Include the following namespaces in your **Program.cs** file: + + ```csharp + using Syncfusion.Pdf.Graphics; + using Syncfusion.Pdf.Parsing; + using Syncfusion.Pdf; + using Syncfusion.Drawing; + ``` + +4. **Add a watermark to the PDF**: Use the following code snippet in **Program.cs** to apply a watermark to an existing PDF: + + ```csharp + // Create FileStream object to read the input PDF file + using (FileStream inputFileStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read)) + { + // Load the PDF document from the input stream + using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFileStream)) + { + // Get the first page of the PDF document + PdfPageBase loadedPage = loadedDocument.Pages[0]; + + // Create a PDF font to add a watermark text + PdfStandardFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 32); + + // Measure the watermark text and get the size + string watermarkText = "Created using Syncfusion PDF library"; + SizeF watermarkTextSize = font.MeasureString(watermarkText); + + // Move the graphics to the center of the page + loadedPage.Graphics.Save(); + loadedPage.Graphics.TranslateTransform(loadedPage.Size.Width / 2, loadedPage.Size.Height / 2); + + // Rotate the graphics to 45 degrees + loadedPage.Graphics.RotateTransform(-45); + + // Draw the watermark text + loadedPage.Graphics.DrawString(watermarkText, font, PdfBrushes.Red, new PointF(-watermarkTextSize.Width / 2, -watermarkTextSize.Height / 2)); + + // Restore the graphics + loadedPage.Graphics.Restore(); + + using (FileStream outputStream = new FileStream("output.pdf", FileMode.Create, FileAccess.Write)) + { + // Save the document + loadedDocument.Save(outputStream); + } + } + } + ``` + +You can download a complete working example from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Watermark/Add-text-watermark-in-an-existing-PDF-document/.NET). + +Explore more features of the Syncfusion PDF library [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). \ No newline at end of file