Skip to content

Commit 02f336b

Browse files
Merge pull request #117 from SyncfusionExamples/921494_rm
921494_rm Added Readme files in FT page sample
2 parents c21c9bb + f332625 commit 02f336b

File tree

17 files changed

+887
-17
lines changed
  • Annotation/Add-popup-annotation-in-a-PDF-document/.NET/Add-popup-annotation-in-a-PDF-document
  • Compression/Compress-the-images-in-an-existing-PDF-document/.NET/Compress-the-images-in-an-existing-PDF-document
  • Digital Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document
  • Forms/Add-a-textbox-field-to-a-new-PDF-document/.NET/Add-a-textbox-field-to-a-new-PDF-document
  • HTML to PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document
  • Images/Convert_Image_to_PDF/.NET/Convert_Image_to_PDF
  • Merge PDFs/Merge-multiple-documents-from-stream/.NET/Merge-multiple-documents-from-stream
  • OCR/.NET/Perform-OCR-for-the-entire-PDF-document/Perform-OCR-for-the-entire-PDF-document
  • PDF Conformance
    • Convert-PDF-to-PDFA-conformance-document/.NET/Convert-PDF-to-PDFA-conformance-document
    • Get-PDF-to-PDFA-conversion-progress/.NET/Get-PDF-to-PDFA-conversion-progress
  • Pages/Splitting-PDF-file-into-individual-pages/.NET/Splitting-PDF-file-into-individual-pages
  • Redaction/Removing-sensitive-content-from-the-PDF-document/.NET/Removing-sensitive-content-from-the-PDF-document
  • Security/Protect-an-existing-PDF-document/.NET/Protect-an-existing-PDF-document
  • Table/PdfGrid/Create-table-from-data-source-in-a-PDF/.NET/Create-table-from-data-source-in-a-PDF
  • Tagged PDF/Add-tag-for-the-text-element-in-PDF-document/.NET/Add-tag-for-the-text-element-in-PDF-document
  • Text Extraction/Extract-text-from-the-entire-PDF-document/.NET/Extract-text-from-the-entire-PDF-document
  • Watermark/Add-text-watermark-in-an-existing-PDF-document/.NET/Add-text-watermark-in-an-existing-PDF-document

17 files changed

+887
-17
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# PDF Annotations
2+
3+
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.
4+
5+
## Steps to add annotations to a PDF
6+
7+
Follow these steps to add a popup annotation to a PDF file using the Syncfusion library:
8+
9+
1. **Create a new project**: Set up a new C# Console Application project.
10+
11+
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/).
12+
13+
3. **Include necessary namespaces**: Add the following namespaces to your `Program.cs` file:
14+
15+
```csharp
16+
using Syncfusion.Drawing;
17+
using Syncfusion.Pdf;
18+
using Syncfusion.Pdf.Graphics;
19+
using Syncfusion.Pdf.Interactive;
20+
using Syncfusion.Pdf.Parsing;
21+
```
22+
23+
4. **Code to add annotations**: Use the following code snippet in `Program.cs` to insert annotations into a PDF file:
24+
25+
```csharp
26+
// Create a FileStream object to read the input PDF file
27+
using (FileStream inputFileStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read))
28+
{
29+
// Load the PDF document from the input stream
30+
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFileStream))
31+
{
32+
// Access the first page of the PDF document
33+
PdfPageBase loadedPage = loadedDocument.Pages[0];
34+
35+
// Create a new popup annotation
36+
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(new RectangleF(100, 100, 20, 20), "Comment");
37+
38+
// Set the icon for the popup annotation
39+
popupAnnotation.Icon = PdfPopupIcon.Comment;
40+
41+
// Set the color for the popup annotation
42+
popupAnnotation.Color = new PdfColor(Color.Yellow);
43+
44+
// Add the annotation to the page
45+
loadedPage.Annotations.Add(popupAnnotation);
46+
47+
// Save the updated document
48+
using (FileStream outputFileStream = new FileStream("output.pdf", FileMode.Create, FileAccess.Write))
49+
{
50+
loadedDocument.Save(outputFileStream);
51+
}
52+
}
53+
}
54+
```
55+
56+
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).
57+
58+
To learn more about the extensive features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core).
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Compressing PDF Files
2+
3+
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.
4+
5+
## Steps to compress PDF files
6+
7+
Follow these steps to compress PDF files using the Syncfusion library:
8+
9+
1. **Create a new project**: Set up a new C# Console Application project.
10+
11+
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/).
12+
13+
3. **Add required namespaces**: Include the following namespaces in your `Program.cs` file:
14+
15+
```csharp
16+
using Syncfusion.Pdf.Parsing;
17+
using Syncfusion.Pdf;
18+
```
19+
20+
4. **Implement PDF compression**: Use the following code snippet in `Program.cs` to compress PDF files:
21+
22+
```csharp
23+
// Open a file stream to read the input PDF file
24+
using (FileStream fileStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read))
25+
{
26+
// Load the PDF document from the file stream
27+
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileStream))
28+
{
29+
// Create a new PdfCompressionOptions object
30+
PdfCompressionOptions options = new PdfCompressionOptions();
31+
32+
// Enable image compression and set the image quality
33+
options.CompressImages = true;
34+
options.ImageQuality = 50;
35+
36+
// Enable font optimization
37+
options.OptimizeFont = true;
38+
39+
// Enable page content optimization
40+
options.OptimizePageContents = true;
41+
42+
// Remove metadata from the PDF
43+
options.RemoveMetadata = true;
44+
45+
// Compress the PDF document
46+
loadedDocument.Compress(options);
47+
48+
// Save the document into a memory stream
49+
using (MemoryStream outputStream = new MemoryStream())
50+
{
51+
loadedDocument.Save(outputStream);
52+
}
53+
}
54+
}
55+
```
56+
57+
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).
58+
59+
To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core).
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Digital Signature
2+
3+
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.
4+
5+
## Steps to add a digital signature to PDF files
6+
7+
Follow these steps to digitally sign PDF files using the Syncfusion library:
8+
9+
1. **Create a new project**: Start by creating a new C# Console Application project.
10+
11+
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/).
12+
13+
3. **Include necessary namespaces**: Add the following namespaces in your `Program.cs` file:
14+
15+
```csharp
16+
using Syncfusion.Pdf;
17+
using Syncfusion.Pdf.Graphics;
18+
using Syncfusion.Pdf.Parsing;
19+
using Syncfusion.Pdf.Security;
20+
using Syncfusion.Drawing;
21+
```
22+
23+
4. **Add digital signature code**: Use the following code snippet in `Program.cs` to add a digital signature to a PDF file:
24+
25+
```csharp
26+
// Open the existing PDF document as a stream
27+
using (FileStream inputStream = new FileStream(Path.GetFullPath("Input.pdf"), FileMode.Open, FileAccess.Read))
28+
{
29+
// Load the existing PDF document
30+
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
31+
32+
// Get the first page of the document
33+
PdfPageBase page = loadedDocument.Pages[0];
34+
35+
// Load the certificate from a PFX file with a private key
36+
FileStream certificateStream = new FileStream(@"PDF.pfx", FileMode.Open, FileAccess.Read);
37+
PdfCertificate pdfCert = new PdfCertificate(certificateStream, "password123");
38+
39+
// Create a signature
40+
PdfSignature signature = new PdfSignature(loadedDocument, page, pdfCert, "Signature");
41+
42+
// Set signature information
43+
signature.Bounds = new RectangleF(new PointF(0, 0), new SizeF(200, 100));
44+
signature.ContactInfo = "[email protected]";
45+
signature.LocationInfo = "Honolulu, Hawaii";
46+
signature.Reason = "I am the author of this document.";
47+
48+
// Load the image for the signature field
49+
FileStream imageStream = new FileStream("signature.png", FileMode.Open, FileAccess.Read);
50+
PdfBitmap signatureImage = new PdfBitmap(imageStream);
51+
52+
// Draw the image on the signature field
53+
signature.Appearance.Normal.Graphics.DrawImage(signatureImage, new RectangleF(0, 0, signature.Bounds.Width, signature.Bounds.Height));
54+
55+
// Save the document to a file stream
56+
using (FileStream outputFileStream = new FileStream("signed.pdf", FileMode.Create, FileAccess.ReadWrite))
57+
{
58+
loadedDocument.Save(outputFileStream);
59+
}
60+
61+
// Close the document
62+
loadedDocument.Close(true);
63+
}
64+
```
65+
66+
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/).
67+
68+
To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core).
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# PDF Forms
2+
3+
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.
4+
5+
## Steps to create PDF forms
6+
7+
Follow these steps to create a PDF form with a textbox field:
8+
9+
1. **Create a new project**: Start by creating a new C# Console Application project.
10+
11+
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/).
12+
13+
3. **Include necessary namespaces**: Add the following namespaces in your `Program.cs` file:
14+
15+
```csharp
16+
using Syncfusion.Drawing;
17+
using Syncfusion.Pdf;
18+
using Syncfusion.Pdf.Graphics;
19+
using Syncfusion.Pdf.Interactive;
20+
```
21+
22+
4. **Create PDF forms**: Implement the following code in `Program.cs` to add a textbox field to a PDF document:
23+
24+
```csharp
25+
// Create a new PDF document
26+
using (PdfDocument pdfDocument = new PdfDocument())
27+
{
28+
// Add a new page to the PDF document
29+
PdfPage pdfPage = pdfDocument.Pages.Add();
30+
31+
// Set the standard font
32+
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 16);
33+
34+
// Draw the title "Job Application"
35+
pdfPage.Graphics.DrawString("Job Application", font, PdfBrushes.Black, new PointF(250, 0));
36+
37+
// Change the font size for form fields
38+
font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
39+
40+
// Draw the label "Name"
41+
pdfPage.Graphics.DrawString("Name", font, PdfBrushes.Black, new PointF(10, 20));
42+
43+
// Create a textbox field for the name
44+
PdfTextBoxField nameField = new PdfTextBoxField(pdfPage, "Name");
45+
nameField.Bounds = new RectangleF(10, 40, 200, 20);
46+
nameField.ToolTip = "Name";
47+
pdfDocument.Form.Fields.Add(nameField);
48+
49+
// Draw the label "Email address"
50+
pdfPage.Graphics.DrawString("Email address", font, PdfBrushes.Black, new PointF(10, 80));
51+
52+
// Create a textbox field for the email address
53+
PdfTextBoxField emailField = new PdfTextBoxField(pdfPage, "Email address");
54+
emailField.Bounds = new RectangleF(10, 100, 200, 20);
55+
emailField.ToolTip = "Email address";
56+
pdfDocument.Form.Fields.Add(emailField);
57+
58+
// Save the PDF document to a file stream
59+
using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create))
60+
{
61+
pdfDocument.Save(outputFileStream);
62+
}
63+
}
64+
```
65+
66+
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).
67+
68+
To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core).
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# HTML to PDF Conversion
2+
3+
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.
4+
5+
## Steps to convert HTML to PDF
6+
7+
Follow these steps to convert HTML content into a PDF file using the Syncfusion library:
8+
9+
1. **Create a new project**: Initialize a new C# Console Application project.
10+
11+
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/).
12+
13+
3. **Include necessary namespaces**: Add the following namespaces in your `Program.cs` file:
14+
15+
```csharp
16+
using Syncfusion.HtmlConverter;
17+
using Syncfusion.Pdf;
18+
using System.Runtime.InteropServices;
19+
```
20+
21+
4. **Convert HTML to PDF**: Implement the following code in `Program.cs` to convert a website URL to a PDF file:
22+
23+
```csharp
24+
// Initialize the HTML to PDF converter
25+
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
26+
27+
// Convert a URL to a PDF document
28+
PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com");
29+
30+
// Create the FileStream to save the PDF document
31+
FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite);
32+
33+
// Save and close the PDF document
34+
document.Save(fileStream);
35+
document.Close(true);
36+
```
37+
38+
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).
39+
40+
To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core).
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Converting Images to PDF
2+
3+
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.
4+
5+
## Steps to convert images to PDF
6+
7+
Follow these steps to convert an image into a PDF file using the Syncfusion library:
8+
9+
1. **Create a new project**: Start a new C# Console Application project.
10+
11+
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/).
12+
13+
3. **Include necessary namespaces**: Add the following namespace in your `Program.cs` file:
14+
15+
```csharp
16+
using Syncfusion.Pdf;
17+
```
18+
19+
4. **Convert image to PDF**: Implement the following code in `Program.cs` to convert an image into a PDF file:
20+
21+
```csharp
22+
// Create an instance of the ImageToPdfConverter class
23+
var imageToPdfConverter = new ImageToPdfConverter();
24+
25+
// Set the page size for the PDF
26+
imageToPdfConverter.PageSize = PdfPageSize.A4;
27+
28+
// Set the position of the image in the PDF
29+
imageToPdfConverter.ImagePosition = PdfImagePosition.TopLeftCornerOfPage;
30+
31+
// Create a file stream to read the image file
32+
using (var imageStream = new FileStream("Autumn Leaves.jpg", FileMode.Open, FileAccess.Read))
33+
{
34+
// Convert the image to a PDF document using the ImageToPdfConverter
35+
var pdfDocument = imageToPdfConverter.Convert(imageStream);
36+
37+
// Create a file stream for the output PDF file
38+
using (var outputFileStream = new FileStream(Path.GetFullPath("Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
39+
{
40+
// Save the generated PDF document to the output file stream
41+
pdfDocument.Save(outputFileStream);
42+
}
43+
44+
// Close the document
45+
pdfDocument.Close(true);
46+
}
47+
```
48+
49+
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).
50+
51+
To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core).

0 commit comments

Comments
 (0)