-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from SyncfusionExamples/921494_rm
921494_rm Added Readme files in FT page sample
- Loading branch information
Showing
17 changed files
with
887 additions
and
17 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...otation-in-a-PDF-document/.NET/Add-popup-annotation-in-a-PDF-document/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# PDF Annotations | ||
|
||
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). |
59 changes: 59 additions & 0 deletions
59
...ing-PDF-document/.NET/Compress-the-images-in-an-existing-PDF-document/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# 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). |
68 changes: 68 additions & 0 deletions
68
...xisting-document/.NET/Add-a-digital-signature-to-an-existing-document/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Digital Signature | ||
|
||
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 | ||
|
||
Follow these steps to digitally sign PDF files using the Syncfusion library: | ||
|
||
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 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.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: | ||
|
||
```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); | ||
|
||
// 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"); | ||
|
||
// 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 = "[email protected]"; | ||
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); | ||
|
||
// 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); | ||
} | ||
|
||
// 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/). | ||
|
||
To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). |
68 changes: 68 additions & 0 deletions
68
...-to-a-new-PDF-document/.NET/Add-a-textbox-field-to-a-new-PDF-document/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# PDF Forms | ||
|
||
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 | ||
|
||
Follow these steps to create a PDF form with a textbox field: | ||
|
||
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 from [NuGet.org](https://www.nuget.org/). | ||
|
||
3. **Include necessary namespaces**: Add the following namespaces in your `Program.cs` file: | ||
|
||
```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: | ||
|
||
```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); | ||
|
||
// Draw the title "Job Application" | ||
pdfPage.Graphics.DrawString("Job Application", font, PdfBrushes.Black, new PointF(250, 0)); | ||
|
||
// Change the font size for form fields | ||
font = new PdfStandardFont(PdfFontFamily.Helvetica, 12); | ||
|
||
// Draw the label "Name" | ||
pdfPage.Graphics.DrawString("Name", font, PdfBrushes.Black, new PointF(10, 20)); | ||
|
||
// 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 label "Email address" | ||
pdfPage.Graphics.DrawString("Email address", font, PdfBrushes.Black, new PointF(10, 80)); | ||
|
||
// 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 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). | ||
|
||
To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). |
40 changes: 40 additions & 0 deletions
40
...-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# HTML to PDF Conversion | ||
|
||
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 | ||
|
||
Follow these steps to convert HTML content into a PDF file using the Syncfusion library: | ||
|
||
1. **Create a new project**: Initialize a new C# Console Application project. | ||
|
||
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/). | ||
|
||
3. **Include necessary namespaces**: Add the following namespaces in your `Program.cs` file: | ||
|
||
```csharp | ||
using Syncfusion.HtmlConverter; | ||
using Syncfusion.Pdf; | ||
using System.Runtime.InteropServices; | ||
``` | ||
|
||
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 the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/Convert-website-URL-to-PDF-document). | ||
|
||
To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). |
51 changes: 51 additions & 0 deletions
51
Images/Convert_Image_to_PDF/.NET/Convert_Image_to_PDF/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Converting Images to PDF | ||
|
||
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 images to PDF | ||
|
||
Follow these steps to convert an image into a PDF file using the Syncfusion library: | ||
|
||
1. **Create a new project**: Start a new C# Console Application project. | ||
|
||
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/). | ||
|
||
3. **Include necessary namespaces**: Add the following namespace in your `Program.cs` file: | ||
|
||
```csharp | ||
using Syncfusion.Pdf; | ||
``` | ||
|
||
4. **Convert image to PDF**: Implement the following code in `Program.cs` to convert an image into a PDF file: | ||
|
||
```csharp | ||
// Create an instance of the ImageToPdfConverter class | ||
var imageToPdfConverter = new ImageToPdfConverter(); | ||
|
||
// Set the page size for the PDF | ||
imageToPdfConverter.PageSize = PdfPageSize.A4; | ||
|
||
// Set the position of the image in the PDF | ||
imageToPdfConverter.ImagePosition = PdfImagePosition.TopLeftCornerOfPage; | ||
|
||
// 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); | ||
|
||
// 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 the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Images/Convert_Image_to_PDF/.NET). | ||
|
||
To explore more features of the Syncfusion PDF library, click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core). |
Oops, something went wrong.