diff --git a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/Convert-HTML-to-PDF-in-Azure-Functions-Linux.md b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/Convert-HTML-to-PDF-in-Azure-Functions-Linux.md
index 875979f3a..2662d621a 100644
--- a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/Convert-HTML-to-PDF-in-Azure-Functions-Linux.md
+++ b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/Convert-HTML-to-PDF-in-Azure-Functions-Linux.md
@@ -24,11 +24,62 @@ Step 3: Select the function worker as .NET 8.0 isolated (Long-term support), and

Step 4: Install the [Syncfusion.HtmlToPdfConverter.Net.Linux](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Linux/) NuGet package as a reference to your .NET Core application [NuGet.org](https://www.nuget.org/).
-
+
N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your application to use our components.
-Step 5: Include the following namespaces in Function1.cs file.
+
+Step 5: Create a shell file with the below commands in the project and name it as dependenciesInstall.sh. In this article, these steps have been followed to install dependencies packages.
+
+{% highlight bash tabtitle="Shell" %}
+
+echo "Starting dependencies installation script..."
+
+
+if ! command -v rsync &> /dev/null; then
+ echo "rsync could not be found, installing..."
+ apt-get update && apt-get install -yq rsync
+fi
+
+FILE_PATH="/home/site/wwwroot/Package/usr/lib/x86_64-linux-gnu/libnss3.so"
+if [ -f "$FILE_PATH" ]; then
+ echo "Dependencies file exists."
+ PACKAGE_USR="/home/site/wwwroot/Package/usr/lib/x86_64-linux-gnu"
+ if [ -d "$PACKAGE_USR" ]; then
+ echo "Copying user libraries..."
+ rsync -av --update /home/site/wwwroot/Package/usr/lib/ /usr/lib/
+ echo "Copied successfully..."
+ fi
+else
+ echo "Package directory does not exist. Installing dependencies..."
+ apt-get update && apt-get install -yq --no-install-recommends \
+ libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 \
+ libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
+ libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 \
+ libx11-6 libx11-xcb1 libxcb1 libxcursor1 libxdamage1 libxext6 \
+ libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3 libgbm1
+
+ mkdir -p /home/site/wwwroot/Package/usr/lib/x86_64-linux-gnu
+ mkdir -p /home/site/wwwroot/Package/lib/x86_64-linux-gnu
+
+ PACKAGE_USR="/home/site/wwwroot/Package/usr/lib/x86_64-linux-gnu"
+ if [ -d "$PACKAGE_USR" ]; then
+ echo "Copying user libraries to package..."
+ rsync -av /usr/lib/x86_64-linux-gnu/ /home/site/wwwroot/Package/usr/lib/x86_64-linux-gnu
+ fi
+fi
+
+echo "Dependencies installation script completed."
+
+{% endhighlight %}
+
+
+
+Step 6: Set Copy to Output Directory as “Copy if newer” to the dependenciesInstall.sh file.
+
+
+
+Step 7: Include the following namespaces in Function1.cs file.
{% highlight c# tabtitle="C#" %}
@@ -39,7 +90,7 @@ Step 5: Include the following namespaces in Function1.cs file.
{% endhighlight %}
-Step 6: This Azure Function converts HTML to PDF using HTTP triggers. It handles GET/POST requests, processes the HTML, and returns a PDF response.
+Step 8: This Azure Function converts HTML to PDF using HTTP triggers. It handles GET/POST requests, processes the HTML, and returns a PDF response.
{% highlight c# tabtitle="C#" %}
@@ -67,7 +118,7 @@ Step 6: This Azure Function converts HTML to PDF using HTTP triggers. It handles
{% endhighlight %}
-step 7: Use the following code example in the HtmlToPdfConvert method to convert HTML to a PDF document using the [Convert](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_Convert_System_String_) method in the [HtmlToPdfConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html) class. The Blink command line arguments are configured based on the given [CommandLineArguments](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_CommandLineArguments) property of the [BlinkConverterSettings](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html) class.
+step 9: Use the following code example in the HtmlToPdfConvert method to convert HTML to a PDF document using the [Convert](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_Convert_System_String_) method in the [HtmlToPdfConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html) class. The Blink command line arguments are configured based on the given [CommandLineArguments](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_CommandLineArguments) property of the [BlinkConverterSettings](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html) class.
{% highlight c# tabtitle="C#" %}
@@ -99,6 +150,7 @@ public byte[] HtmlToPdfConvert(string htmlText)
Bottom = 20
}
};
+
htmlConverter.ConverterSettings = settings;
// Convert HTML to PDF
@@ -127,7 +179,7 @@ N> settings.CommandLineArguments.Add("--disable-setuid-sandbox");
N> ```
N> These arguments are only required when using **older versions** of the library that depend on Blink in sandbox-restricted environments.
-Step 8: This code is designed to ensure that the necessary Linux packages for HTML to PDF conversion are installed if the operating system is Linux. It adjusts file permissions and executes a shell script to carry out the installation.
+Step 10: This code is designed to ensure that the necessary Linux packages for HTML to PDF conversion are installed if the operating system is Linux. It adjusts file permissions and executes a shell script to carry out the installation.
{% highlight c# tabtitle="C#" %}
@@ -195,7 +247,7 @@ private static void InstallLinuxPackages()
{% endhighlight %}
-Step 9: Add the following helper methods to copy and set permission to the BlinkBinariesLinux folder.
+Step 11: Add the following helper methods to copy and set permission to the BlinkBinariesLinux folder.
{% highlight c# tabtitle="C#" %}
@@ -257,7 +309,7 @@ private static void SetExecutablePermission(string tempBlinkDir)
{% endhighlight %}
-Step 10: Include the below enum in the Function1.cs file.
+Step 12: Include the below enum in the Function1.cs file.
{% highlight c# tabtitle="C#" %}
@@ -318,4 +370,5 @@ An online sample link to [convert HTML to PDF document](https://ej2.syncfusion.c
Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core/html-to-pdf) to explore the rich set of Syncfusion® HTML to PDF converter library features.
-An online sample link to [convert HTML to PDF document](https://ej2.syncfusion.com/aspnetcore/PDF/HtmltoPDF#/material3) in ASP.NET Core.
\ No newline at end of file
+
+An online sample link to [convert HTML to PDF document](https://ej2.syncfusion.com/aspnetcore/PDF/HtmltoPDF#/material3) in ASP.NET Core.
diff --git a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/htmlconversion_images/CopyToNewer.png b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/htmlconversion_images/CopyToNewer.png
new file mode 100644
index 000000000..ce31cb90a
Binary files /dev/null and b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/htmlconversion_images/CopyToNewer.png differ
diff --git a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/htmlconversion_images/ShellCommand.png b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/htmlconversion_images/ShellCommand.png
new file mode 100644
index 000000000..459eedd6e
Binary files /dev/null and b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/htmlconversion_images/ShellCommand.png differ
diff --git a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/troubleshooting.md b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/troubleshooting.md
index 5599d4a2f..da168c46b 100644
--- a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/troubleshooting.md
+++ b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/troubleshooting.md
@@ -1546,5 +1546,26 @@ N> We have option to exclude the default Blink binaries from the installation pa
+{% endhighlight %}
+{% endtabs %}
+
+## How to Exclude BlinkBinaries or Runtime Files in Build or Deployment
+
+The runtime files, or blink binaries, will be copied into a bin or published folder while building and publishing the application.
+By including the native option in the package reference of the csproj file, you can exclude the runtime files or blink binaries from being copied into the bin or publish folder while building and publishing the application. But you need to place the BlinkBinaries in the server disk and set the BlinkPath in the BlinkConverterSettings to perform the conversion.
+
+N> Using this approach, you can reduce the deployment size on your own servers.
+
+Refer to the following package reference:
+
+{% tabs %}
+{% highlight C# %}
+
+
+
+ native
+
+
+
{% endhighlight %}
{% endtabs %}
\ No newline at end of file
diff --git a/Document-Processing/PDF/PDF-Library/NET/Split-Documents.md b/Document-Processing/PDF/PDF-Library/NET/Split-Documents.md
index dbd2375e5..5bf488845 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Split-Documents.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Split-Documents.md
@@ -126,7 +126,7 @@ loadedDocument.Close(true);
Imports Syncfusion.Pdf.Parsing
'Create the values.
-Dim values As Integer(,) = New Integer(,) {{2, 5},{8, 10}}
+Dim values As Integer(,) = New Integer(,) {{2, 5}, {8, 10}}
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Set a output path
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-DigitalSignature.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-DigitalSignature.md
index df6b82859..1a4829a66 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-DigitalSignature.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-DigitalSignature.md
@@ -20,6 +20,11 @@ The following code example explains how to add a digital signature to the PDF do
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Add-a-digital-signature-to-the-PDF-document/.NET/Add-a-digital-signature-to-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Adds a new page.
@@ -38,29 +43,27 @@ FileStream imageStream = new FileStream("signature.jpg", FileMode.Open, FileAcce
PdfBitmap signatureImage = new PdfBitmap(imageStream);
//Sets signature information.
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
//Draws the signature image.
signature.Appearance.Normal.Graphics.DrawImage(signatureImage, 0, 0);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
+//Save the document
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
-//Defining the ContentType for PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Adds a new page
@@ -76,6 +79,7 @@ PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
PdfBitmap signatureImage = new PdfBitmap(@"signature.jpg");
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
@@ -90,6 +94,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Creates a new PDF document
Dim document As New PdfDocument()
'Adds a new page
@@ -105,6 +114,7 @@ Dim signature As New PdfSignature(document, page, pdfCert, "Signature")
Dim signatureImage As New PdfBitmap("signature.jpg")
'Sets signature information
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
+signature.SignedName = "Syncfusion"
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am author of this document."
@@ -129,6 +139,11 @@ The following code example illustrates how to add a digital signature in the PDF
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Add-a-digital-signature-to-the-PDF-document/.NET/Add-a-digital-signature-to-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Adds a new page
@@ -147,29 +162,27 @@ FileStream imageStream = new FileStream("signature.jpg", FileMode.Open, FileAcce
PdfBitmap signatureImage = new PdfBitmap(imageStream);
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
//Draws the signature image
signature.Appearance.Normal.Graphics.DrawImage(signatureImage, 0, 0);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Adds a new page
@@ -187,6 +200,7 @@ PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
PdfBitmap signatureImage = new PdfBitmap(@"signature.jpg");
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
@@ -201,6 +215,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Creates a new PDF document
Dim document As New PdfDocument()
'Adds a new page
@@ -218,6 +237,7 @@ Dim signature As New PdfSignature(document, page, pdfCert, "Signature")
Dim signatureImage As New PdfBitmap("signature.jpg")
'Sets signature information
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
+signature.SignedName = "Syncfusion"
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am author of this document."
@@ -238,9 +258,14 @@ You can add a digital signature to an existing document as follows.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Add-a-digital-signature-to-an-existing-document/.NET/Add-a-digital-signature-to-an-existing-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the page
PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -255,23 +280,21 @@ signatureField.Signature.Reason = "I am author of this document";
//Adds the field
loadedDocument.Form.Fields.Add(signatureField);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+loadedDocument.Save("Output.pdf");
+//Close the document.
loadedDocument.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
-
+
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Loads the PDF document with signature field
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the page
@@ -295,6 +318,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Loads the PDF document with signature field
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Gets the page
@@ -328,6 +357,12 @@ The following code example illustrates how to add digital signature in a PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Add-digital-signature-using-X509Certificate2/.NET/Add-digital-signature-using-X509Certificate2/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Adds a new page
@@ -345,31 +380,28 @@ FileStream imageStream = new FileStream("signature.jpg", FileMode.Open, FileAcce
PdfBitmap signatureImage = new PdfBitmap(imageStream);
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
//Draws the signature image
signature.Appearance.Normal.Graphics.DrawImage(signatureImage, 0, 0);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-document.Save(stream);
-//If the position is not set to '0', then the PDF will be empty
-stream.Position = 0;
-//Close the document
+//Save the document
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Adds a new page
@@ -386,6 +418,7 @@ PdfSignature signature = new PdfSignature(document, page, pdfCertificate, "Signa
PdfBitmap signatureImage = new PdfBitmap(@"signature.jpg");
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
@@ -401,6 +434,12 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+Imports System.Security.Cryptography.X509Certificates
+
'Creates a new PDF document
Dim document As New PdfDocument()
'Adds a new page
@@ -417,6 +456,7 @@ Dim signature As New PdfSignature(document, page, pdfCertificate, "Signature")
Dim signatureImage As New PdfBitmap("signature.jpg")
'Sets signature information
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
+signature.SignedName = "Syncfusion"
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am author of this document."
@@ -442,9 +482,12 @@ You can load the signature field from the existing PDF document using [PdfLoaded
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Signing-an-existing-PDF-document/.NET/Signing-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the first page of the document
PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage;
//Gets the first signature field of the PDF document
@@ -455,23 +498,19 @@ FileStream certificateStream = new FileStream("PDF.pfx", FileMode.Open, FileAcce
PdfCertificate certificate = new PdfCertificate(certificateStream, "password123");
field.Signature = new PdfSignature(loadedDocument, page, certificate, "Signature", field);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+loadedDocument.Save("Output.pdf");
+//Close the document.
loadedDocument.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Loads a PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the first page of the document
@@ -492,6 +531,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Loads a PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Gets the first page of the document
@@ -522,9 +565,12 @@ You can load the signature field from an existing PDF document using [PdfLoadedS
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the first page of the document
PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage;
//Gets the first signature field of the PDF document
@@ -535,23 +581,19 @@ FileStream certificateStream = new FileStream("PDF.pfx", FileMode.Open, FileAcce
PdfCertificate certificate = new PdfCertificate(certificateStream, "password123");
field.Signature = new PdfSignature(loadedDocument, page, certificate, "Signature", field);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+loadedDocument.Save("Output.pdf");
+//Close the document.
loadedDocument.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Loads a PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the first page of the document
@@ -573,7 +615,11 @@ loadedDocument.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Loads a PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Gets the first page of the document
@@ -606,43 +652,44 @@ The following code example demonstrates how to check if a signature field is sig
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Check-If-PDF-Is-Signed/.NET/Check-If-PDF-Is-Signed/Program.cs" %}
-// Open the signed PDF file for reading
-using (FileStream inputFileStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read))
-{
- // Load the PDF document
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFileStream);
+using Syncfusion.Pdf.Parsing;
- // Check if the document contains a form with fields
- if (loadedDocument.Form == null || loadedDocument.Form.Fields.Count == 0)
- {
- Console.WriteLine("No signature fields found in the document.");
- }
- else
+// Load the PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
+
+// Check if the document contains a form with fields
+if (loadedDocument.Form == null || loadedDocument.Form.Fields.Count == 0)
+{
+ Console.WriteLine("No signature fields found in the document.");
+}
+else
+{
+ // Iterate through all fields in the form
+ foreach (PdfLoadedField field in loadedDocument.Form.Fields)
{
- // Iterate through all fields in the form
- foreach (PdfLoadedField field in loadedDocument.Form.Fields)
+ // Check if the field is a signature field
+ PdfLoadedSignatureField signatureField = field as PdfLoadedSignatureField;
+ if (signatureField != null)
{
- // Check if the field is a signature field
- PdfLoadedSignatureField signatureField = field as PdfLoadedSignatureField;
- if (signatureField != null)
- {
- // Determine whether the signature field is signed or not
- string status = signatureField.IsSigned ? "Signed" : "UnSigned";
+ // Determine whether the signature field is signed or not
+ string status = signatureField.IsSigned ? "Signed" : "UnSigned";
- // Output the result for each signature field
- Console.WriteLine("Signature Field " + signatureField.Name + " is: " + status);
- }
+ // Output the result for each signature field
+ Console.WriteLine("Signature Field " + signatureField.Name + " is: " + status);
}
}
-
- // Close the document
- loadedDocument.Close(true);
}
+// Close the document
+loadedDocument.Close(true);
+
+
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+ using Syncfusion.Pdf.Parsing;
+
// Load the PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -675,7 +722,9 @@ using (FileStream inputFileStream = new FileStream("Input.pdf", FileMode.Open, F
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-
+
+Imports Syncfusion.Pdf.Parsing
+
' Load the PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
@@ -721,19 +770,22 @@ The following code example shows how to sign the PDF document from an external s
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Externally-sign-a-PDF-document/.NET/Externally-sign-a-PDF-document/Program.cs" %}
-//Get the stream from the document
-FileStream documentStream = new FileStream("PDF_Succinctly.pdf ", FileMode.Open, FileAccess.Read);
-//Load the existing PDF document
-PdfLoadedDocument document = new PdfLoadedDocument(documentStream);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Pkcs;
+using System.Security.Cryptography.X509Certificates;
+
+//Load the PDF document
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Creates a digital signature
PdfSignature signature = new PdfSignature(document, document.Pages[0], null, "DigitalSignature");
signature.ComputeHash += Signature_ComputeHash;
-//Save the PDF document to stream
-MemoryStream ms = new MemoryStream();
-document.Save(ms);
-//Close the PDF document
+//Save the document
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
private static void Signature_ComputeHash1(object sender, PdfSignatureEventArgs ars)
@@ -758,6 +810,12 @@ private static void Signature_ComputeHash1(object sender, PdfSignatureEventArgs
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Pkcs;
+using System.Security.Cryptography.X509Certificates;
//Load existing PDF document
PdfLoadedDocument document = new PdfLoadedDocument("PDF_Succinctly.pdf");
@@ -792,6 +850,12 @@ void Signature_ComputeHash(object sender, PdfSignatureEventArgs arguments)
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports System.Security.Cryptography
+Imports System.Security.Cryptography.Pkcs
+Imports System.Security.Cryptography.X509Certificates
+
'Load existing PDF document
Dim document As PdfLoadedDocument = New PdfLoadedDocument("PDF_Succinctly.pdf")
'Creates a digital signature
@@ -827,16 +891,21 @@ End Sub
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Digital%20Signature/Externally-sign-a-PDF-document/).
### Externally sign the PDF document using IPdfExternalSigner
+
The following code example shows how to sign the PDF document from external signature using [IPdfExternalSigner](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Security.IPdfExternalSigner.html).
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Externally-sign-the-PDF-document-using-IPdfExternalSigner/.NET/Externally-sign-the-PDF-document/Program.cs" %}
-//Get the stream from the document
-FileStream documentStream = new FileStream("Input.pdf ", FileMode.Open, FileAccess.Read);
-//Load the existing PDF document
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using Syncfusion.Drawing;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography;
+
+//Load the PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Creates a digital signature.
PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0], null, "Signature");
@@ -853,18 +922,10 @@ List certificates = new List();
certificates.Add(new X509Certificate2(Convert.FromBase64String(PublicCert)));
signature.AddExternalSigner(externalSignature, certificates, null);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+loadedDocument.Save("Output.pdf");
+//Close the document.
loadedDocument.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
//Create the external signer class and sign the document hash.
class ExternalSigner : IPdfExternalSigner
@@ -907,6 +968,12 @@ class ExternalSigner : IPdfExternalSigner
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Drawing;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -966,6 +1033,12 @@ class ExternalSigner : IPdfExternalSigner
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports System.Security.Cryptography
+Imports System.Drawing
+Imports System.Security.Cryptography.X509Certificates
+
'Load an existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
@@ -1036,11 +1109,18 @@ The following example illustrates the process of adding timestamps to a PDF docu
{% highlight c# tabtitle="C# [Cross-platform]" %}
-// Get the stream from the input PDF document.
-FileStream documentStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using Syncfusion.Drawing;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography;
+using Org.BouncyCastle.Tsp;
+using System.Net;
+using System.Text;
+using Org.BouncyCastle.Math;
-// Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream);
+//Load the PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Create a digital signature for the first page of the document.
PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0], null, "Signature");
@@ -1058,12 +1138,8 @@ List certificates = new List();
certificates.Add(new X509Certificate2(Convert.FromBase64String(PublicCert)));
signature.AddExternalSigner(externalSignature, certificates, null);
-//Create file stream.
-using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
-{
- //Save the PDF document to file stream.
- loadedDocument.Save(outputFileStream);
-}
+//Save the document
+loadedDocument.Save("Output.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -1071,6 +1147,16 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using Syncfusion.Drawing;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography;
+using Org.BouncyCastle.Tsp;
+using System.Net;
+using System.Text;
+using Org.BouncyCastle.Math;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -1098,6 +1184,16 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports Syncfusion.Drawing
+Imports System.Security.Cryptography.X509Certificates
+Imports System.Security.Cryptography
+Imports Org.BouncyCastle.Tsp
+Imports System.Net
+Imports System.Text
+Imports Org.BouncyCastle.Math
+
'Load an existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
@@ -1388,11 +1484,15 @@ You can create a Long Term validation (LTV) when signing PDF documents externall
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Create-LTV-when-signing-PDF-documents-externally/.NET/Create-LTV-when-signing-PDF-documents-externally/Program.cs" %}
- //Get the stream from the document.
- FileStream documentStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Parsing;
+ using Syncfusion.Pdf.Security;
+ using System.Security.Cryptography;
+ using System.Security.Cryptography.Pkcs;
+ using System.Security.Cryptography.X509Certificates;
- //Load an existing PDF document.
- PdfLoadedDocument document = new PdfLoadedDocument(documentStream);
+ //Load the PDF document
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the page of the existing PDF document.
PdfLoadedPage loadedPage = document.Pages[0] as PdfLoadedPage;
@@ -1403,14 +1503,13 @@ You can create a Long Term validation (LTV) when signing PDF documents externall
//Hook up the ComputeHash event.
signature.ComputeHash += Signature_ComputeHash;
- //Save the document into stream
- MemoryStream stream = new MemoryStream();
- document.Save(stream);
+ //Save the document.
+ document.Save("SignedDocument.pdf");
//Close the document
document.Close(true);
- //Load an existing PDF stream..
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
+ //Load an existing PDF stream.
+ PdfLoadedDocument loadedDocument = new PdfLoadedDocument("SignedDocument.pdf");
//Gets the first signature field of the PDF document
PdfLoadedSignatureField signatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
@@ -1422,12 +1521,9 @@ You can create a Long Term validation (LTV) when signing PDF documents externall
//Create LTV with your public certificates.
pdfSignature.CreateLongTermValidity(new List { x509 });
- //Save the PDF document
- MemoryStream ms = new MemoryStream();
- loadedDocument.Save(ms);
- //If the position is not set to '0' then the PDF will be empty
- ms.Position = 0;
- //Close the document
+ //Save the document
+ loadedDocument.Save("Output.pdf");
+ //Close the document.
loadedDocument.Close(true);
void Signature_ComputeHash(object sender, PdfSignatureEventArgs ars)
@@ -1454,6 +1550,13 @@ You can create a Long Term validation (LTV) when signing PDF documents externall
{% highlight c# tabtitle="C# [Windows-specific]" %}
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Parsing;
+ using Syncfusion.Pdf.Security;
+ using System.Security.Cryptography;
+ using System.Security.Cryptography.Pkcs;
+ using System.Security.Cryptography.X509Certificates;
+
//Load an existing PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
@@ -1467,12 +1570,12 @@ You can create a Long Term validation (LTV) when signing PDF documents externall
signature.ComputeHash += Signature_ComputeHash;
//Save the document.
- document.Save("SignedDocument");
+ document.Save("SignedDocument.pdf");
//Close the document
document.Close(true);
//Load an existing PDF stream..
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument("SignedDocument");
+ PdfLoadedDocument loadedDocument = new PdfLoadedDocument("SignedDocument.pdf");
//Gets the first signature field of the PDF document
PdfLoadedSignatureField signatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
@@ -1512,6 +1615,13 @@ You can create a Long Term validation (LTV) when signing PDF documents externall
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+ Imports Syncfusion.Pdf
+ Imports Syncfusion.Pdf.Parsing
+ Imports Syncfusion.Pdf.Security
+ Imports System.Security.Cryptography
+ Imports System.Security.Cryptography.Pkcs
+ Imports System.Security.Cryptography.X509Certificates
+
' Load an existing PDF document.
Dim document As New PdfLoadedDocument("Input.pdf")
@@ -1583,6 +1693,10 @@ The following code example shows how to sign a PDF document with LTA using [Time
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Sign_PDF_with_LTA/.NET/Sign_PDF_with_LTA/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using Syncfusion.Pdf;
+
//Load existing PDF document.
FileStream documentStream1 = new FileStream("PDF_Succinctly.pdf", FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream1);
@@ -1599,13 +1713,12 @@ signature.TimeStampServer = new TimeStampServer(new Uri("http://timestamping.ens
signature.EnableLtv = true;
//Save the PDF document.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+loadedDocument.Save("LTV_document.pdf");
//Close the document.
loadedDocument.Close(true);
//Load existing PDF document.
-PdfLoadedDocument ltDocument = new PdfLoadedDocument(stream);
+PdfLoadedDocument ltDocument = new PdfLoadedDocument("LTV_document.pdf");
//Load the existing PDF page.
PdfLoadedPage lpage = ltDocument.Pages[0] as PdfLoadedPage;
@@ -1613,22 +1726,19 @@ PdfLoadedPage lpage = ltDocument.Pages[0] as PdfLoadedPage;
PdfSignature timeStamp = new PdfSignature(lpage, "timestamp");
timeStamp.TimeStampServer = new TimeStampServer(new Uri("http://timestamping.ensuredca.com"));
-//Save and close the PDF document.
-MemoryStream stream1 = new MemoryStream();
-ltDocument.Save(stream1);
+//Save the document
+ltDocument.Save("Output.pdf");
//Close the document.
ltDocument.Close(true);
-//Defining the ContentType for pdf file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream1, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using Syncfusion.Pdf;
+
//Load existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("PDF_Succinctly.pdf");
//Load digital ID with password.
@@ -1663,6 +1773,10 @@ ltDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports Syncfusion.Pdf
+
'Loads a PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("PDF_Succinctly.pdf")
'Load digital ID with password.
@@ -1717,6 +1831,11 @@ The following code example shows how to create a PDF digital signature using the
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Sign_PDF_Windows_Certificate/.NET/Sign_PDF_Windows_Certificate/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using Syncfusion.Pdf;
+using System.Security.Cryptography.X509Certificates;
+
//Initialize the Windows store.
X509Store store = new X509Store("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
@@ -1726,8 +1845,7 @@ X509Certificate2Collection fcollection = (X509Certificate2Collection)collection.
X509Certificate2 digitalID = collection[0];
//Load existing PDF document.
-FileStream documentStream = new FileStream("PDF_Succinctly.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("PDF_Succinctly.pdf");
//Load X509Certificate2.
PdfCertificate certificate = new PdfCertificate(digitalID);
@@ -1737,22 +1855,20 @@ PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0
signature.Settings.CryptographicStandard = CryptographicStandard.CADES;
signature.Settings.DigestAlgorithm = DigestAlgorithm.SHA512;
-//Save the PDF document.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document
+loadedDocument.Save("Output.pdf");
//Close the document.
loadedDocument.Close(true);
-//Defining the ContentType for pdf file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using Syncfusion.Pdf;
+using System.Security.Cryptography.X509Certificates;
+
//Initialize the Windows store.
X509Store store = new X509Store("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
@@ -1781,6 +1897,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports Syncfusion.Pdf
+Imports System.Security.Cryptography.X509Certificates
+
'Initialize the Windows store.
Dim store As X509Store = New X509Store("MY", StoreLocation.CurrentUser)
store.Open(OpenFlags.[ReadOnly] Or OpenFlags.OpenExistingOnly)
@@ -1820,6 +1941,11 @@ Refer to the following code sample.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Adding-a-signature-validation-appearance-in-a-PDF/.NET/Adding-a-signature-validation-appearance-in-a-PDF/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Adds a new page
@@ -1840,29 +1966,27 @@ PdfBitmap signatureImage = new PdfBitmap(imageStream);
signature.EnableValidationAppearance = true;
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
//Draws the signature image
signature.Appearance.Normal.Graphics.DrawImage(signatureImage, 0, 0);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Add a new page
@@ -1879,6 +2003,7 @@ PdfBitmap signatureImage = new PdfBitmap(@"signature.jpg");
//Sets enable signature validation appearance
signature.EnableValidationAppearance = true;
//Sets signature information
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
@@ -1893,6 +2018,11 @@ document.Close( true );
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Creates a new PDF document
Dim document As New PdfDocument()
'Adds a new page
@@ -1910,6 +2040,7 @@ Dim signatureImage As New PdfBitmap("signature.jpg")
signature.EnableValidationAppearance = True
'Sets signature info
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
+signature.SignedName = "Syncfusion"
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am author of this document."
@@ -1934,6 +2065,11 @@ Essential® PDF allows you to add timestamp in the digital signatu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Adding-a-timestamp-in-digital-signature-of-PDF/.NET/Adding-a-timestamp-in-digital-signature-of-PDF/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Adds a new page
@@ -1954,29 +2090,27 @@ PdfBitmap image = new PdfBitmap(imageStream);
signature.TimeStampServer = new TimeStampServer(new Uri("http://syncfusion.digistamp.com"), "user", "123456");
//Sets signature info
signature.Bounds = new RectangleF(new PointF(0, 0), image.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
//Draws the signature image
signature.Appearance.Normal.Graphics.DrawImage(image, 0, 0);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Adds a new page
@@ -1997,6 +2131,7 @@ PdfBitmap image = new PdfBitmap(@"syncfusion_logo.jpeg");
signature.TimeStampServer = new TimeStampServer(new Uri("http://syncfusion.digistamp.com"), "user", "123456");
//Sets signature info
signature.Bounds = new RectangleF(new PointF(0, 0), image.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
@@ -2011,6 +2146,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Creates a new PDF document
Dim document As New PdfDocument()
'Adds a new page
@@ -2028,6 +2168,7 @@ Dim image As New PdfBitmap("syncfusion_logo.jpeg")
signature.TimeStampServer = New TimeStampServer(New Uri("http://syncfusion.digistamp.com"), "user", "123456")
'Sets signature info
signature.Bounds = New RectangleF(New PointF(0, 0), image.PhysicalDimension)
+signature.SignedName = "Syncfusion"
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am author of this document."
@@ -2052,6 +2193,9 @@ You can add timestamp to the PDF document using [TimeStampServer](https://help.s
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Adding-a-timestamp-to-PDF-document/.NET/Adding-a-timestamp-to-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Security;
+
//Create a new pdf document
PdfDocument document = new PdfDocument();
//Adds a new page
@@ -2062,23 +2206,18 @@ PdfSignature signature = new PdfSignature(page, "Signature");
//Add the time stamp by using the server URI
signature.TimeStampServer = new TimeStampServer(new Uri("http://syncfusion.digistamp.com"), "user", "123456");
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a new page
@@ -2097,6 +2236,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Security
+
'Creates a new PDF document
Dim document As New PdfDocument()
'Adds a new page
@@ -2125,9 +2267,12 @@ You can add timestamp to the existing PDF document using [TimeStampServer](https
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Adding-a-timestamp-to-an-existing-PDF/.NET/Adding-a-timestamp-to-an-existing-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the page
PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -2136,23 +2281,19 @@ PdfSignature signature = new PdfSignature(page, "Signature");
//Add the time stamp by using the server URI
signature.TimeStampServer = new TimeStampServer(new Uri("http://syncfusion.digistamp.com"), "user", "123456");
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+loadedDocument.Save("Output.pdf");
+//Close the document.
loadedDocument.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Add a new page
@@ -2172,6 +2313,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Security
+
'Load the PDF document
Dim document As New PdfLoadedDocument("Input.pdf")
'Gets the first page of the document
@@ -2209,9 +2354,11 @@ You can get the above certificate details from an existing signed PDF document u
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Retrieve-certificate-details-from-an-existing-PDF/.NET/Retrieve-certificate-details-from-an-existing-PDF/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the signature field
PdfLoadedSignatureField signatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
@@ -2236,6 +2383,9 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the existing signed PDF
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("SignedDocument.pdf");
//Load the PDF form
@@ -2268,6 +2418,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Load the existing signed PDF
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("../../Signed.pdf")
'Load the PDF form
@@ -2314,6 +2467,11 @@ The following code example explains how to create LTV PDF using [EnableLtv](http
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Enable-LTV-PDF-signature/.NET/Enable-LTV-PDF-signature/Program.cs" %}
+ using Syncfusion.Drawing;
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Graphics;
+ using Syncfusion.Pdf.Parsing;
+ using Syncfusion.Pdf.Security;
//Creates a new PDF document.
PdfDocument document = new PdfDocument();
@@ -2333,14 +2491,12 @@ The following code example explains how to create LTV PDF using [EnableLtv](http
signature.Settings.CryptographicStandard = CryptographicStandard.CADES;
signature.Settings.DigestAlgorithm = DigestAlgorithm.SHA256;
- //Save the document into stream
- MemoryStream stream = new MemoryStream();
- document.Save(stream);
+ document.Save("SignedDocument.pdf");
//Close the document
document.Close(true);
//Load an existing PDF stream.
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
+ PdfLoadedDocument loadedDocument = new PdfLoadedDocument("SignedDocument.pdf");
//Gets the first signature field of the PDF document
PdfLoadedSignatureField signatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
@@ -2349,11 +2505,9 @@ The following code example explains how to create LTV PDF using [EnableLtv](http
//Enable LTV on Signature.
pdfSignature.EnableLtv = true;
- //Save the document into stream
- MemoryStream ms = new MemoryStream();
- loadedDocument.Save(ms);
- stream.ms = 0;
- //Close the document
+ //Save the document
+ loadedDocument.Save("Output.pdf");
+ //Close the document.
loadedDocument.Close(true);
@@ -2361,6 +2515,12 @@ The following code example explains how to create LTV PDF using [EnableLtv](http
{% highlight c# tabtitle="C# [Windows-specific]" %}
+ using System.Drawing;
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Graphics;
+ using Syncfusion.Pdf.Parsing;
+ using Syncfusion.Pdf.Security;
+
//Creates a new PDF document.
PdfDocument document = new PdfDocument();
@@ -2402,6 +2562,12 @@ The following code example explains how to create LTV PDF using [EnableLtv](http
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+ Imports System.Drawing
+ Imports Syncfusion.Pdf
+ Imports Syncfusion.Pdf.Graphics
+ Imports Syncfusion.Pdf.Parsing
+ Imports Syncfusion.Pdf.Security
+
' Creates a new PDF document.
Dim document As New PdfDocument()
@@ -2459,6 +2625,11 @@ The following code example explains how to add a digital signature with [cryptog
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Adding-a-digital-signature-with-CAdES-format/.NET/Adding-a-digital-signature-with-CAdES-format/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a new page
@@ -2481,29 +2652,27 @@ FileStream imageStream = new FileStream("signature.jpg", FileMode.Open, FileAcce
PdfBitmap signatureImage = new PdfBitmap(imageStream);
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
//Draws the signature image
signature.Appearance.Normal.Graphics.DrawImage(signatureImage, 0, 0);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Adds a new page
@@ -2523,6 +2692,7 @@ settings.CryptographicStandard = CryptographicStandard.CADES;
PdfBitmap signatureImage = new PdfBitmap(@"signature.jpg");
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
@@ -2537,6 +2707,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Creates a new PDF document
Dim document As New PdfDocument()
'Adds a new page
@@ -2556,6 +2731,7 @@ settings.CryptographicStandard = CryptographicStandard.CADES
Dim signatureImage As New PdfBitmap("signature.jpg")
'Sets signature info
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
+signature.SignedName = "Syncfusion"
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am author of this document."
@@ -2589,6 +2765,11 @@ The following code example explains how to add a digital signature with various
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Add-digital-signature-with-digest-algorithm/.NET/Add-digital-signature-with-digest-algorithm/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a new page
@@ -2611,29 +2792,27 @@ FileStream imageStream = new FileStream("signature.jpg", FileMode.Open, FileAcce
PdfBitmap signatureImage = new PdfBitmap(imageStream);
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
//Draws the signature image
signature.Appearance.Normal.Graphics.DrawImage(signatureImage, 0, 0);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the document
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
-//Defining the ContentType for pdf file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a new page
@@ -2653,6 +2832,7 @@ settings.DigestAlgorithm = DigestAlgorithm.SHA256;
PdfBitmap signatureImage = new PdfBitmap(@"signature.jpg");
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
@@ -2667,6 +2847,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Creates a new PDF document
Dim document As New PdfDocument()
'Adds a new page
@@ -2686,6 +2871,7 @@ settings.DigestAlgorithm = DigestAlgorithm.SHA256
Dim signatureImage As New PdfBitmap("signature.jpg")
'Sets signature info
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
+signature.SignedName = "Syncfusion"
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am author of this document."
@@ -2722,11 +2908,12 @@ The following code example explains how to validate the digitally signed PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Validate-the-digitally-signed-PDF-signature/.NET/Validate-the-digitally-signed-PDF-signature/Program.cs" %}
-// Load the input PDF document stream from the specified file path
-FileStream documentStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
-// Load the signed PDF document using the stream
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream);
+// Load the signed PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Retrieve the first signature field from the PDF form
PdfLoadedSignatureField signatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
@@ -2856,11 +3043,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
-// Load the input PDF document stream from the specified file path
-FileStream documentStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
-// Load the signed PDF document using the stream
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream);
+// Load the signed PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Retrieve the first signature field from the PDF form
PdfLoadedSignatureField signatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
@@ -2990,11 +3178,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Load the input PDF document stream from the specified file path
-Dim documentStream As New FileStream(Path.GetFullPath("Data/Input.pdf"), FileMode.Open, FileAccess.Read)
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports System.Security.Cryptography.X509Certificates
' Load the signed PDF document using the stream
-Dim loadedDocument As New PdfLoadedDocument(documentStream)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
' Retrieve the first signature field from the PDF form
Dim signatureField As PdfLoadedSignatureField = TryCast(loadedDocument.Form.Fields(0), PdfLoadedSignatureField)
@@ -3127,10 +3316,12 @@ The following code example explains how to validate all the signatures in digita
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Validate-all-signatures-in-digitally-signed-PDF/.NET/Validate-all-signatures-in-digitally-signed-PDF/Program.cs" %}
-//Get the stream from the document
-FileStream documentStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-//Load an existing signed PDF document
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
+//Load the PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//X509Certificate2Collection to check the signer's identity using root certificates
X509Certificate2Collection collection = new X509Certificate2Collection();
@@ -3153,6 +3344,10 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
//Load an existing signed PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -3173,6 +3368,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports System.Security.Cryptography.X509Certificates
+
'Load an existing signed PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
@@ -3205,6 +3404,9 @@ This example shows how to validate and identify different types of digital signa
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Get the stream from the document
FileStream documentStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
// Load the signed PDF document
@@ -3278,6 +3480,9 @@ for (int i = form.Fields.Count - 1; i >= 0; i--)
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
// Load the signed PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Signed PDF.pdf");
@@ -3349,6 +3554,9 @@ for (int i = form.Fields.Count - 1; i >= 0; i--)
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
' Load the signed PDF document
Dim loadedDocument As New PdfLoadedDocument("Signed PDF.pdf")
@@ -3420,10 +3628,14 @@ Steps for deferred signing:
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/refs/heads/master/Digital%20Signature/Deferred-signing-in-PDF-document/.NET/Deferred-signing-in-PDF-document/Program.cs" %}
-//Get the stream from the document.
-FileStream documentStream = new FileStream("PDF_Succinctly.pdf ", FileMode.Open, FileAccess.Read);
-//Load an existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+
+//Load the PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Creates a digital signature.
PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0], null, "Signature");
@@ -3439,17 +3651,10 @@ System.Collections.Generic.List certificates = new System.Coll
certificates.Add(new X509Certificate2(Convert.FromBase64String(PublicCert)));
signature.AddExternalSigner(externalSignature, certificates, null);
-//Save the document.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Close the PDF document.
+//Save the document
+loadedDocument.Save("Output.pdf");
+//Close the document.
loadedDocument.Close(true);
-//Defining the ContentType for a PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
void DeferredSign()
{
@@ -3542,6 +3747,12 @@ class ExternalSigner : IPdfExternalSigner
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("PDF_Succinctly.pdf");
@@ -3655,6 +3866,11 @@ class ExternalSigner : IPdfExternalSigner
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports System.Security.Cryptography
+
'Load an existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("PDF_Succinctly.pdf")
@@ -3770,6 +3986,10 @@ The following code sample shows how to add the estimated size of the signature i
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Adding-the-estimated-size-of-the-signature/.NET/Adding-the-estimated-size-of-the-signature/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Security;
+
//Creating a new PDF Document.
PdfDocument document = new PdfDocument();
//Adding a new page to the PDF document.
@@ -3784,25 +4004,19 @@ signature.Bounds = new Rectangle(10, 20, 400, 200);
//Sets the estimated size of the signature.
signature.EstimatedSignatureSize = 20000;
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into stream.
-document.Save(stream);
-//If the position is not set to '0,' then the PDF will be empty.
-stream.Position = 0;
+//Save the document
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
-//Defining the ContentType for a PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Security;
+
//Creating a new PDF Document.
PdfDocument document = new PdfDocument();
//Adding a new page to the PDF document.
@@ -3825,6 +4039,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Creating a new PDF Document.
Dim document As PdfDocument = New PdfDocument()
'Adding a new page to the PDF document.
@@ -3862,10 +4080,13 @@ Steps for deferred signing:
{% highlight c# tabtitle="C# [Cross-platform]" %}
-//Get the stream from a document.
-FileStream documentStream = new FileStream("PDF_Succinctly.pdf ", FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
//Load an existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("PDF_Succinctly.pdf");
//Creates a digital signature.
PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0], null, "Signature");
@@ -3881,16 +4102,9 @@ System.Collections.Generic.List certificates = new System.Coll
signature.AddExternalSigner(externalSignature, certificates, null);
//Save a document.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Close a PDF document.
+loadedDocument.Save("EmptySignature.pdf");
+//Close a document.
loadedDocument.Close(true);
-//Defining the ContentType for a PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
//Create an external signer with a signed hash message.
IPdfExternalSigner externalSigner = new ExternalSigner("SHA1");
@@ -3899,8 +4113,8 @@ System.Collections.Generic.List publicCertificates = new Syste
publicCertificates.Add(new X509Certificate2(Convert.FromBase64String(PublicCert)));
//Create an output file stream.
-MemoryStream outputFileStream = new MemoryStream();
-// Get the stream from a document.
+MemoryStream outputFileStream = new MemoryStream();
+//Get the stream from a document.
FileStream inputFileStream = new FileStream("EmptySignature.pdf", FileMode.Open, FileAccess.Read);
string pdfPassword = string.Empty;
//Deferred signing without PKCS7 encoding.
@@ -3960,6 +4174,11 @@ class ExternalSigner : IPdfExternalSigner
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("PDF_Succinctly.pdf");
@@ -4049,6 +4268,11 @@ class ExternalSigner : IPdfExternalSigner
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports System.Security.Cryptography.X509Certificates
+
'Load an existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("PDF_Succinctly.pdf")
@@ -4147,47 +4371,47 @@ The following code example illustrates how to draw text/images in a digital appe
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Draw-text-or-images-in-the-signature-appearance/.NET/Draw-text-or-images-in-the-signature-appearance/Program.cs" %}
-//Create a new PDF document.
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
+//Creates a new PDF document.
PdfDocument document = new PdfDocument();
-//Add a new page.
+//Adds a new page.
PdfPageBase page = document.Pages.Add();
//Create PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
-//Create a certificate instance 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 digital signature.
+//Creates a certificate instance from PFX file with private key.
+PdfCertificate pdfCert = new PdfCertificate(@"PDF.pfx", "password123");
+//Creates a digital signature.
PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
-//Set an image for signature field.
-FileStream imageStream = new FileStream("signature.jpg", FileMode.Open, FileAccess.Read);
-//Set an image for signature field.
-PdfBitmap signatureImage = new PdfBitmap(imageStream);
-//Set the signature information.
-signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
+//Sets an image for signature field.
+PdfBitmap signatureImage = new PdfBitmap(@"signature.png");
+//Sets signature information.
+signature.Bounds = new RectangleF(0,0,200,100);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
-//Create appearance for the digital signature.
+//Create appearance for the digital siganture.
signature.Appearance.Normal.Graphics.DrawImage(signatureImage, signature.Bounds);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
+//Save the document.
+document.Save("DigitalSignature.pdf");
//Close the document.
document.Close(true);
-//Define the ContentType for pdf file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Create a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Adds a new page.
@@ -4203,6 +4427,7 @@ PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
PdfBitmap signatureImage = new PdfBitmap(@"signature.png");
//Sets signature information.
signature.Bounds = new RectangleF(0,0,200,100);
+signature.SignedName = "Syncfusion";
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
@@ -4218,6 +4443,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new page.
@@ -4233,6 +4463,7 @@ Dim signature As New PdfSignature(document, page, pdfCert, "Signature")
Dim signatureImage As New PdfBitmap("signature.jpg")
'Set the signature information.
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
+signature.SignedName = "Syncfusion"
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am author of this document."
@@ -4257,11 +4488,11 @@ Added support for LTV validation and getting CRL and OCSP embedded details from
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Get-LTV-information/.NET/Get-LTV-information/Program.cs" %}
-//Gets the stream from the document
-FileStream documentStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
-//Loads an existing signed PDF document
-PdfLoadedDocument document = new PdfLoadedDocument(documentStream);
+//Load the PDF document
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
// Gets the signature field
PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
@@ -4292,11 +4523,11 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
-//Gets the stream from the document
-FileStream documentStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
-//Loads an existing signed PDF document
-PdfLoadedDocument document = new PdfLoadedDocument(documentStream);
+//Load the PDF document
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
// Gets the signature field
PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
@@ -4327,11 +4558,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Gets the stream from the document
-Dim documentStream As New FileStream(Path.GetFullPath("Data/Input.pdf"), FileMode.Open, FileAccess.Read)
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
' Loads an existing signed PDF document
-Dim document As New PdfLoadedDocument(documentStream)
+Dim document As New PdfLoadedDocument("Input.pdf")
' Gets the signature field
Dim signatureField As PdfLoadedSignatureField = TryCast(document.Form.Fields(0), PdfLoadedSignatureField)
@@ -4372,11 +4603,11 @@ Added support to customize revocation validation using [PdfSignatureValidationOp
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Customized-revocation-validation/.NET/Customized-revocation-validation/Program.cs" %}
-//Gets the stream from the document
-FileStream documentStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
-//Loads an existing signed PDF document
-PdfLoadedDocument document = new PdfLoadedDocument(documentStream);
+//Load the PDF document
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
// Gets the signature field
PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
@@ -4407,11 +4638,11 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
-//Gets the stream from the document
-FileStream documentStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
-//Loads an existing signed PDF document
-PdfLoadedDocument document = new PdfLoadedDocument(documentStream);
+//Load the PDF document
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
// Gets the signature field
PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
@@ -4442,6 +4673,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
' Gets the stream from the document
Dim documentStream As New FileStream(Path.GetFullPath("Data/Input.pdf"), FileMode.Open, FileAccess.Read)
@@ -4484,32 +4718,26 @@ The following code example illustrates how to remove existing digital signatures
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Remove_existing_digital_signature_from_PDF/.NET/Remove_existing_digital_signature_from_PDF/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the signature field from PDF form field collection.
PdfLoadedSignatureField signatureField = pdfLoadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
//Remove signature field from form field collection.
pdfLoadedDocument.Form.Fields.Remove(signatureField);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-pdfLoadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document.
+//Save and close the PDF document.
+pdfLoadedDocument.Save("RemoveDigital.pdf");
pdfLoadedDocument.Close(true);
-//Defining the ContentType for PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -4526,6 +4754,8 @@ pdfLoadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document.
Dim pdfLoadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
@@ -4552,12 +4782,13 @@ The following code snippet illustrates how to sign a PDF document without showin
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Sign-PDF-without-showing-digital-signature/.NET/Sign-PDF-without-showing-digital-signature/Program.cs" %}
-//Get stream from an existing PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
+//Load an existing PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load digital ID with password.
-FileStream certificateStream = new FileStream("PDF.pfx", FileMode.Open, FileAccess.Read);
-PdfCertificate certificate = new PdfCertificate(certificateStream, "password123");
+PdfCertificate certificate = new PdfCertificate(@"PDF.pfx", "password123");
//Create a signature with loaded digital ID.
PdfSignature signature = new PdfSignature(loadedDocument, loadedDocument.Pages[0], certificate, "DigitalSignature");
@@ -4568,23 +4799,17 @@ signature.Certificated = true;
//Allow the form fill and and comments.
signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill | PdfCertificationFlags.AllowComments;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document.
-document.Close(true);
-//Defining the ContentType for pdf file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
+//Save and close the PDF document.
+loadedDocument.Save("Certifying.pdf");
+loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load digital ID with password.
@@ -4607,6 +4832,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Load an existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Load digital ID with password.
@@ -4639,9 +4867,11 @@ The following code snippet illustrates how to retrieve digital signature informa
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Retrieve-digital-signature-information-from-PDF/.NET/Retrieve-digital-signature-information-from-PDF/Program.cs" %}
-//Get stream from an existing PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
+//Load the PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the signature field from PdfLoadedDocument form field collection.
PdfLoadedSignatureField signatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
@@ -4661,6 +4891,9 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -4682,6 +4915,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Load an existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
@@ -4715,23 +4951,25 @@ N> It is recommended to use licensed assemblies or registered license keys in yo
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/refs/heads/master/Digital%20Signature/Multiple-digital-signature/.NET/Multiple-digital-signature/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream("SignatureFields.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using Syncfusion.Pdf;
+
+//Load an existing PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the first page of the document.
PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage;
//Get the first signature field of the PDF document.
PdfLoadedSignatureField signatureField1 = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
-//Creates a certificate.
-FileStream certificateStream1 = new FileStream("PDF.pfx", FileMode.Open, FileAccess.Read);
-PdfCertificate certificate1 = new PdfCertificate(certificateStream1, "password123");
-//Add signature to the signature field.
+//Create a certificate instance from a PFX file with a private key.
+PdfCertificate certificate1 = new PdfCertificate("PDF.pfx", "password123");
+//Add a signature to the signature field.
signatureField1.Signature = new PdfSignature(loadedDocument, page, certificate1, "Signature", signatureField1);
-//Get the image as a stream.
-FileStream imageStream = new FileStream("Student Signature.jpg", FileMode.Open, FileAccess.Read);
-PdfBitmap signatureImage = new PdfBitmap(imageStream);
-//Draw an image in signature appearance.
+//Set an image for the signature field.
+PdfBitmap signatureImage = new PdfBitmap(@"Student Signature.jpg");
+//Insert an image in the signature appearance.
signatureField1.Signature.Appearance.Normal.Graphics.DrawImage(signatureImage, 0, 0, 90, 20);
//Save the document into the stream.
@@ -4745,33 +4983,28 @@ PdfLoadedPage loadedPage = signedDocument.Pages[0] as PdfLoadedPage;
//Get the first signature field of the PDF document.
PdfLoadedSignatureField signatureField2 = signedDocument.Form.Fields[1] as PdfLoadedSignatureField;
-//Add the signature to the signature field.
-signatureField1.Signature = new PdfSignature(signedDocument, loadedPage, certificate1, "Signature", signatureField2);
-//Load the image as a stream.
-FileStream imageStream1 = new FileStream("Teacher Signature.png", FileMode.Open, FileAccess.Read);
-PdfBitmap signatureImage1 = new PdfBitmap(imageStream1);
-//Draw the image in signature appearance.
-signatureField1.Signature.Appearance.Normal.Graphics.DrawImage(signatureImage1, 0, 0, 90, 20);
-
-//Saving the PDF to the MemoryStream.
-MemoryStream signedStream = new MemoryStream();
-signedDocument.Save(signedStream);
-//Set the position as '0'.
-signedStream.Position = 0;
-//Close the documents.
+//Add a signature to the signature field.
+signatureField2.Signature = new PdfSignature(signedDocument, loadedPage, certificate1, "Signature", signatureField2);
+//Set an image for the signature field.
+PdfBitmap signatureImage1 = new PdfBitmap(@"Teacher Signature.png");
+//Draw an image in the signature appearance.
+signatureField2.Signature.Appearance.Normal.Graphics.DrawImage(signatureImage1, 0, 0, 90, 20);
+
+//Save the PDF document.
+signedDocument.Save("Multiple_signature.pdf");
+//Close the PDF documents.
signedDocument.Close(true);
loadedDocument.Close(true);
-//Defining the ContentType for a pdf file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Multiple_Signature.pdf";
-//Create the FileContentResult object by using the file contents, content type, and file name.
-return File(signedStream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using Syncfusion.Pdf;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the first page of the document.
@@ -4816,6 +5049,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports Syncfusion.Pdf
+
'Load an existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the first page of the document.
@@ -4869,9 +5107,12 @@ The following code example illustrates how to retrieve revocation certificate in
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Retrieve-revocation-certificate-information/.NET/Retrieve-revocation-certificate-information/Program.cs" %}
-//Load an existing signed PDF document.
-FileStream documentStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(documentStream);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
+//Load the PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get signature field.
PdfLoadedSignatureField loadedSignatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
@@ -4920,6 +5161,10 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
//Load an existing signed PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -4970,6 +5215,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports System.Security.Cryptography.X509Certificates
+
'Load an existing signed PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
@@ -5030,9 +5279,10 @@ The following code example illustrates how to retrieve signed revision informati
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Retrieve-signed-revision-information/.NET/Retrieve-signed-revision-information/Program.cs" %}
-//Load an existing PDF document.
-FileStream inputStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(inputStream);
+using Syncfusion.Pdf.Parsing;
+
+//Load an existing PDF document
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the document revisions.
PdfRevision[] revisions = document.Revisions;
foreach (PdfRevision rev in revisions)
@@ -5046,11 +5296,12 @@ PdfLoadedSignatureField field = document.Form.Fields[0] as PdfLoadedSignatureFie
int revisionIndex = field.Revision;
//Close the document.
document.Close(true);
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the document revisions.
@@ -5071,6 +5322,8 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the document revisions.
@@ -5100,9 +5353,12 @@ The following code example illustrates how to retrieve revocation certificate in
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Retrieve-revocation-certificate-information-from-digital-signature-embed-timestamp/.NET/Program.cs" %}
-//Load an existing PDF document.
-FileStream inputStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(inputStream);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
+//Load an existing PDF document
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets the signature field.
PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
//Validates signature and gets the validation result.
@@ -5116,6 +5372,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
//Load an existing PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets the signature field.
@@ -5131,6 +5391,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports System.Security.Cryptography.X509Certificates
+
'Load an existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Gets the signature field.
@@ -5156,15 +5420,17 @@ Utilize the **GetImages** method within the [PdfLoadedSignatureField](https://he
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Get-images-from-the-existing-signed-signature-field/.NET/Get-images-from-the-existing-signed-signature-field/Program.cs" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF file.
-FileStream fileStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument ldoc = new PdfLoadedDocument(fileStream);
+PdfLoadedDocument ldoc = new PdfLoadedDocument("Input.pdf");
//Get the existing signed signature field.
PdfLoadedSignatureField loadedSignature = ldoc.Form.Fields[0] as PdfLoadedSignatureField;
-//Get the image streams.
-Stream[] imageStreams = loadedSignature.GetImages();
-for (int i = 0; i < imageStreams.Length; i++) {
- File.WriteAllBytes("Output" + i.ToString() + ".jpg", (imageStreams[i] as MemoryStream).ToArray());
+//Get the image.
+Image[] images = loadedSignature.GetImages();
+for (int i = 0; i < images.Length; i++) {
+ images[i].Save("Image" + i.ToString() + ".jpg", ImageFormat.Png);
}
//Close a PDF document.
ldoc.Close(true);
@@ -5173,6 +5439,9 @@ ldoc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF file.
PdfLoadedDocument ldoc = new PdfLoadedDocument("Input.pdf");
//Get the existing signed signature field.
@@ -5189,6 +5458,9 @@ ldoc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Interactive
+
'Load an existing PDF file.
Dim fileStream As FileStream = New FileStream("Input.pdf", FileMode.Open, FileAccess.Read)
Dim ldoc As PdfLoadedDocument = New PdfLoadedDocument(fileStream)
@@ -5218,6 +5490,10 @@ Effortlessly Integrate **signature and timestamp** certificates into the Documen
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
//Loads an existing document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets the signature field
@@ -5248,6 +5524,10 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+using System.Security.Cryptography.X509Certificates;
+
//Gets the stream from the document
FileStream documentStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
//Loads an existing signed PDF document
@@ -5280,6 +5560,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+Imports System.Security.Cryptography.X509Certificates
+
'Loads an existing signed PDF document
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Gets the signature field
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Document-Conversions.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Document-Conversions.md
index 5e3be7eb7..b97659453 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Document-Conversions.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Document-Conversions.md
@@ -89,28 +89,33 @@ For ASP.NET Core and Xamarin applications
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Document%20conversion/Word-to-PDF/Converting-Word-to-PDF-document/.NET/Converting-Word-to-PDF-document/Program.cs" %}
-// Open the file as Stream.
-FileStream docStream = new FileStream(@"Template.docx", FileMode.Open, FileAccess.Read);
-//Loads file stream into Word document.
-WordDocument wordDocument = new WordDocument(docStream, Syncfusion.DocIO.FormatType.Automatic);
-//Instantiation of DocIORenderer for Word to PDF conversion.
-DocIORenderer render = new DocIORenderer();
-//Converts Word document into PDF document.
-PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
-//Releases all resources used by the Word document and DocIO Renderer objects.
-render.Dispose();
-wordDocument.Dispose();
-
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-//Close the document.
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocIORenderer;
+using Syncfusion.Pdf;
+
+//Load an existing Word document.
+WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx);
+//Initialize chart to image converter for converting charts during Word to pdf conversion.
+wordDocument.ChartToImageConverter = new ChartToImageConverter();
+//Create an instance of DocToPDFConverter.
+DocToPDFConverter converter = new DocToPDFConverter();
+//Convert Word document into PDF document.
+PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
+
+//Save the PDF file.
+pdfDocument.Save("WordtoPDF.pdf");
+//Close the instance of document objects.
pdfDocument.Close(true);
+wordDocument.Close();
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocIORenderer;
+using Syncfusion.Pdf;
+
//Load an existing Word document.
WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx);
//Initialize chart to image converter for converting charts during Word to pdf conversion.
@@ -131,6 +136,10 @@ wordDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.DocIO.DLS
+Imports Syncfusion.DocIORenderer
+Imports Syncfusion.Pdf
+
'Load an existing Word document
Dim wordDocument As New WordDocument("Template.docx", FormatType.Docx)
'Initialize chart to image converter for converting charts during Word to pdf conversion
@@ -175,6 +184,13 @@ Essential® DocIO allows you to customize the Word to PDF conversi
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.DocIO;
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocToPDFConverter;
+using Syncfusion.OfficeChart;
+using Syncfusion.OfficeChartToImageConverter;
+using Syncfusion.Pdf;
+
//Loads an existing Word document.
WordDocument wordDocument = new WordDocument("Sample_Image.docx", FormatType.Docx);
//Initialize chart to image converter for converting charts during Word to pdf conversion.
@@ -203,6 +219,13 @@ wordDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.DocIO
+Imports Syncfusion.DocIO.DLS
+Imports Syncfusion.DocToPDFConverter
+Imports Syncfusion.OfficeChart
+Imports Syncfusion.OfficeChartToImageConverter
+Imports Syncfusion.Pdf
+
'Loads an existing Word document
Dim wordDocument As New WordDocument("Sample_Image.docx", FormatType.Docx)
'Initialize chart to image converter for converting charts during Word to pdf conversion
@@ -250,29 +273,32 @@ The following code illustrates how to convert a workbook to PDF Document using [
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Document%20conversion/Excel-to-PDF/Convert-workbook-to-PDF-document/.NET/Convert-workbook-to-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.XlsIO;
+using Syncfusion.XlsIORenderer;
+
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
//Load the document.
- FileStream excelStream = new FileStream("ExcelToPDF.xlsx", FileMode.Open, FileAccess.Read);
- IWorkbook workbook = application.Workbooks.Open(excelStream);
+ IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
//Initialize XlsIO renderer.
XlsIORenderer renderer = new XlsIORenderer();
//Convert Excel document into PDF document.
PdfDocument pdfDocument = renderer.ConvertToPDF(workbook);
- //Save the PDF document to stream.
- Stream stream = new FileStream("ExcelToPDF.pdf", FileMode.Create, FileAccess.ReadWrite);
- pdfDocument.Save(stream);
- //Dispose the stream.
- excelStream.Dispose();
- stream.Dispose();
+ //Save the PDF file.
+ pdfDocument.Save("ExcelToPDF.pdf");
}
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.XlsIO;
+using Syncfusion.XlsIORenderer;
+
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
@@ -293,6 +319,10 @@ using(ExcelEngine excelEngine = new ExcelEngine())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.XlsIO
+Imports Syncfusion.XlsIORenderer
+
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
@@ -322,30 +352,36 @@ The following code shows how to convert a particular sheet to PDF Document using
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Document%20conversion/Excel-to-PDF/Converting-a-worksheet-to-PDF-document/.NET/Converting-a-worksheet-to-PDF-document/Program.cs" %}
-using (ExcelEngine excelEngine = new ExcelEngine())
+using Syncfusion.Pdf;
+using Syncfusion.XlsIO;
+using Syncfusion.XlsIORenderer;
+
+Using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
- FileStream excelStream = new FileStream("ExcelToPDF.xlsx", FileMode.Open, FileAccess.Read);
- IWorkbook workbook = application.Workbooks.Open(excelStream);
- IWorksheet worksheet = workbook.Worksheets[0];
-
- //Initialize XlsIO renderer.
- XlsIORenderer renderer = new XlsIORenderer();
- //Convert Excel document into PDF document.
- PdfDocument pdfDocument = renderer.ConvertToPDF(worksheet);
-
- //Saving the PDF to the MemoryStream.
- Stream stream = new FileStream("ExcelToPDF.pdf", FileMode.Create, FileAccess.ReadWrite);
- pdfDocument.Save(stream);
- //Dispose the stream.
- excelStream.Dispose();
- stream.Dispose();
+ application.DefaultVersion = ExcelVersion.Excel2013;
+ IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
+ IWorksheet sheet = workbook.Worksheets[0];
+
+ //convert the sheet to PDF.
+ ExcelToPdfConverter converter = new ExcelToPdfConverter(sheet);
+ //Initialize PDF document.
+ PdfDocument pdfDocument= new PdfDocument();
+ //Convert Excel document into PDF document.
+ pdfDocument = converter.Convert();
+
+ //Save the PDF file.
+ pdfDocument.Save("ExcelToPDF.pdf");
}
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.XlsIO;
+using Syncfusion.XlsIORenderer;
+
Using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
@@ -368,6 +404,10 @@ Using(ExcelEngine excelEngine = new ExcelEngine())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.XlsIO
+Imports Syncfusion.XlsIORenderer
+
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
@@ -399,31 +439,37 @@ The following code snippet shows how to create an individual PDF document for ea
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Document%20conversion/Excel-to-PDF/Creating-individual-PDF-document-for-each-worksheet/.NET/Program.cs" %}
-using (ExcelEngine excelEngine = new ExcelEngine())
+using Syncfusion.Pdf;
+using Syncfusion.XlsIO;
+using Syncfusion.XlsIORenderer;
+
+Using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
- FileStream excelStream = new FileStream("ExcelToPDF.xlsx", FileMode.Open, FileAccess.Read);
- IWorkbook workbook = application.Workbooks.Open(excelStream);
-
- //Initialize XlsIO renderer.
- XlsIORenderer renderer = new XlsIORenderer();
+ application.DefaultVersion = ExcelVersion.Excel2013;
+ IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
+
//Create a new PDF document.
- PdfDocument pdfDocument = new PdfDocument();
+ PdfDocument pdfDocument = new PdfDocument();
foreach (IWorksheet sheet in workbook.Worksheets)
{
- pdfDocument = renderer.ConvertToPDF(sheet);
-
+ //Open the Excel document to Convert.
+ ExcelToPdfConverter converter = new ExcelToPdfConverter(sheet);
+ pdfDocument = converter.Convert();
+
//Save the PDF file.
- Stream stream = new FileStream(sheet.Name+".pdf", FileMode.Create, FileAccess.ReadWrite);
- pdfDocument.Save(stream);
- stream.Dispose();
+ pdfDocument.Save(sheet.Name +".pdf");
+ converter.Dispose();
}
- excelStream.Dispose();
}
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.XlsIO;
+using Syncfusion.XlsIORenderer;
+
Using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
@@ -448,6 +494,10 @@ Using(ExcelEngine excelEngine = new ExcelEngine())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.XlsIO
+Imports Syncfusion.XlsIORenderer
+
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
@@ -480,29 +530,39 @@ To preserve the charts during Excel to PDF conversion, you should initialize the
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Document%20conversion/Excel-to-PDF/Converting-Excel-with-chart-to-PDF-document/.NET/Converting-Excel-with-chart-to-PDF-document/Program.cs" %}
-using (ExcelEngine excelEngine = new ExcelEngine())
+using Syncfusion.Pdf;
+using Syncfusion.XlsIO;
+using Syncfusion.XlsIORenderer;
+
+Using(ExcelEngine excelEngine = new ExcelEngine())
{
- IApplication application = excelEngine.Excel;
- //Initialize XlsIO renderer.
- XlsIORenderer renderer = new XlsIORenderer();
- //Load the document as stream.
- FileStream excelStream = new FileStream("chart.xlsx", FileMode.Open, FileAccess.Read);
- IWorkbook workbook = application.Workbooks.Open(excelStream);
+ IApplication application = excelEngine.Excel;
+ application.DefaultVersion = ExcelVersion.Excel2013;
+ //Instantiating the ChartToImageConverter and assigning the ChartToImageConverter instance of XlsIO application.
+ application.ChartToImageConverter = new ChartToImageConverter();
+ //Tuning chart image quality.
+ application.ChartToImageConverter.ScalingMode = ScalingMode.Best;
+ IWorkbook workbook = application.Workbooks.Open("chart.xlsx");
+ IWorksheet worksheet = workbook.Worksheets[0];
- //Convert Excel document with charts into PDF document.
- PdfDocument pdfDocument = renderer.ConvertToPDF(workbook);
+ //Open the Excel document to Convert.
+ ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);
- //Save the PDF document.
- Stream stream = new FileStream("ExcelToPDF.pdf", FileMode.Create, FileAccess.ReadWrite);
- pdfDocument.Save(stream);
- //Dispose the stream.
- excelStream.Dispose();
- stream.Dispose();
+ //Initialize PDF document.
+ PdfDocument pdfDocument = new PdfDocument();
+ //Convert Excel document into PDF document.
+ pdfDocument = converter.Convert();
+ //Save the PDF file.
+ pdfDocument.Save("ExcelToPDF.pdf");
}
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.XlsIO;
+using Syncfusion.XlsIORenderer;
+
Using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
@@ -529,6 +589,10 @@ Using(ExcelEngine excelEngine = new ExcelEngine())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.XlsIO
+Imports Syncfusion.XlsIORenderer
+
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
@@ -640,31 +704,33 @@ For ASP.NET Core and Xamarin applications
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Document%20conversion/RTF-to-PDF/Convert-RTF-to-PDF-document/.NET/Convert-RTF-to-PDF-document/Program.cs" %}
-//Open the file as Stream
-FileStream docStream = new FileStream(@"Input.rtf", FileMode.Open, FileAccess.Read);
-//Loads file stream into Word document
-WordDocument wordDocument = new WordDocument(docStream, Syncfusion.DocIO.FormatType.Automatic);
-//Instantiation of DocIORenderer for Word to PDF conversion
-DocIORenderer render = new DocIORenderer();
-//Converts Word document into PDF document
-PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
-
-//Releases all resources used by the Word document and DocIO Renderer objects
-render.Dispose();
-wordDocument.Dispose();
-
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-//Close the document
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocIORenderer;
+using Syncfusion.Pdf;
+
+//Load an existing RTF document.
+WordDocument rtfDocument = new WordDocument("Input.rtf");
+//Create an instance of DocToPDFConverter.
+DocToPDFConverter converter = new DocToPDFConverter();
+//Convert Word document into PDF document.
+PdfDocument pdfDocument = converter.ConvertToPDF(rtfDocument);
+
+//Save the PDF file.
+pdfDocument.Save("RTFToPDF.pdf");
+//Close the instance of document objects.
pdfDocument.Close(true);
+rtfDocument.Close();
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocIORenderer;
+using Syncfusion.Pdf;
+
//Load an existing RTF document.
-WordDocument rtfDocument = new WordDocument(inputFileName);
+WordDocument rtfDocument = new WordDocument("Input.rtf");
//Create an instance of DocToPDFConverter.
DocToPDFConverter converter = new DocToPDFConverter();
//Convert Word document into PDF document.
@@ -681,6 +747,10 @@ rtfDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.DocIO.DLS
+Imports Syncfusion.DocIORenderer
+Imports Syncfusion.Pdf
+
'Load an existing Word document
Dim rtfDocument As New WordDocument(inputFileName)
'Create an instance of DocToPDFConverter
@@ -718,6 +788,12 @@ Essential® DocIO allows you to customize the RTF to PDF conversio
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocToPDFConverter;
+using Syncfusion.Pdf;
+using System;
+using System.Collections.Generic;
+
//Loads an existing Word document
WordDocument rtfDocument = new WordDocument(inputFileName);
//create an instance of DocToPDFConverter - responsible for Word to PDF conversion
@@ -741,6 +817,12 @@ rtfDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.DocIO.DLS
+Imports Syncfusion.DocToPDFConverter
+Imports Syncfusion.Pdf
+Imports System
+Imports System.Collections.Generic
+
'Loads an existing Word document
Dim rtfDocument As New WordDocument(inputFileName)
'create an instance of DocToPDFConverter - responsible for Word to PDF conversion
@@ -777,26 +859,28 @@ The code snippet to illustrate the same is given below.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Document%20conversion/TIFF-to-PDF/Converting-multipage-TIFF-to-PDF-document/.NET/Converting-multipage-TIFF-to-PDF-document/Program.cs" %}
-//Create a new PDF document
-PdfDocument document = new PdfDocument();
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
-//Load the multi frame TIFF image from the disk
-FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
-PdfTiffImage tiffImage = new PdfTiffImage(imageStream);
+//Create a PDF document
+PdfDocument pdfDocument = new PdfDocument();
+
+//Load multi frame TIFF image
+PdfBitmap tiffImage = new PdfBitmap("image.tiff");
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
+ tiffImage.ActiveFrame = i;
//Add a section to the PDF document
- PdfSection section = document.Sections.Add();
+ PdfSection section = pdfDocument.Sections.Add();
//Set page margins
section.PageSettings.Margins.All = 0;
- tiffImage.ActiveFrame = i;
//Create a PDF unit converter instance
PdfUnitConvertor converter = new PdfUnitConvertor();
//Convert to point
- Syncfusion.Drawing.SizeF size = converter.ConvertFromPixels(tiffImage.PhysicalDimension, PdfGraphicsUnit.Point);
+ SizeF size = converter.ConvertFromPixels(tiffImage.PhysicalDimension, PdfGraphicsUnit.Point);
//Set page orientation
section.PageSettings.Orientation = (size.Width > size.Height) ? PdfPageOrientation.Landscape : PdfPageOrientation.Portrait;
//Set page size
@@ -804,20 +888,20 @@ for (int i = 0; i < frameCount; i++)
//Add a page to the section
PdfPage page = section.Pages.Add();
//Draw TIFF image into the PDF page
- page.Graphics.DrawImage(tiffImage, Syncfusion.Drawing.PointF.Empty, size);
+ page.Graphics.DrawImage(tiffImage, PointF.Empty, size);
}
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-document.Save(stream);
-//Close the document
-document.Close(true);
+//Save and close the document
+pdfDocument.Save("Sample.pdf");
+pdfDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+
//Create a PDF document
PdfDocument pdfDocument = new PdfDocument();
@@ -855,6 +939,9 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf
+
'Create a PDF document
Dim pdfDocument As New PdfDocument()
@@ -910,6 +997,11 @@ Refer the below code snippet to draw a single frame monochrome TIFF image with J
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using System;
+using System.Collections.Generic;
+
//Create a PDF document
PdfDocument pdfDocument = new PdfDocument();
//Add a page
@@ -930,6 +1022,11 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf
+Imports System
+Imports System.Collections.Generic
+
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Add a page
@@ -966,28 +1063,29 @@ The below code illustrates how to convert XPS to PDF.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Document%20conversion/Converting-XPS-to-PDF-document/.NET/Converting-XPS-to-PDF-document/Program.cs" %}
-//Initialize XPS to PDF converter.
+using Syncfusion.Pdf;
+using Syncfusion.XPS;
+
+//Create converter class
XPSToPdfConverter converter = new XPSToPdfConverter();
-//Open the XPS file as stream.
-FileStream fileStream = new FileStream("Input.xps", FileMode.Open, FileAccess.ReadWrite);
-//Convert the XPS to PDF.
-PdfDocument document = converter.Convert(fileStream);
-
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into stream.
-document.Save(stream);
-//Close the documents.
+//Convert the XPS to PDF
+PdfDocument document = converter.Convert("Input.xps");
+
+//Save and close the document
+document.Save("Sample.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.XPS;
+
//Create converter class
XPSToPdfConverter converter = new XPSToPdfConverter();
//Convert the XPS to PDF
-PdfDocument document = converter.Convert(xpsFileName);
+PdfDocument document = converter.Convert("Input.xps");
//Save and close the document
document.Save("Sample.pdf");
@@ -997,10 +1095,13 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.XPS
+
'Create converter class
Dim converter As New XPSToPdfConverter()
'Convert the XPS to PDF
-Dim document As PdfDocument = converter.Convert(xpsFileName)
+Dim document As PdfDocument = converter.Convert("Input.xps")
'Save and close the document
document.Save("Sample.pdf")
@@ -1220,6 +1321,9 @@ The following code snippet illustrates how to convert PDF page into image using
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.PdfToImageConverter;
+using System.IO;
+
//Initialize PDF to Image converter.
PdfToImageConverter imageConverter = new PdfToImageConverter();
//Load the PDF document as a stream
@@ -1227,13 +1331,16 @@ FileStream inputStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.R
imageConverter.Load(inputStream);
//Convert PDF to Image.
Stream outputStream = imageConverter.Convert(0, false, false);
-MemoryStream stream = outputStream as MemoryStream;
-return File(stream.ToArray(), System.Net.Mime.MediaTypeNames.Image.Jpeg, "sample.jpeg");
+Bitmap image = new Bitmap(outputStream);
+image.Save("sample.png");
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.PdfToImageConverter;
+using System.IO;
+
//Initialize PDF to Image converter.
PdfToImageConverter imageConverter = new PdfToImageConverter();
//Load the PDF document as a stream
@@ -1248,6 +1355,9 @@ image.Save("sample.png");
{% endhighlight %}
{% highlight vb tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.PdfToImageConverter
+Imports System.IO
+
'Initialize PDF to Image converter.
Dim imageConverter As PdfToImageConverter = New PdfToImageConverter()
'Load the PDF document as a stream
@@ -1279,6 +1389,9 @@ The [HTML to PDF converter library](https://www.syncfusion.com/document-processi
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/HTML%20to%20PDF/Blink/Convert-website-URL-to-PDF-document/.NET/Convert-website-URL-to-PDF-document/Program.cs, 300" %}
+using Syncfusion.HtmlConverter;
+using Syncfusion.Pdf;
+
//Initialize HTML to PDF converter.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
//Convert URL to PDF
@@ -1292,6 +1405,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.HtmlConverter;
+using Syncfusion.Pdf;
+
//Initialize HTML to PDF converter.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
//Convert URL to PDF
@@ -1305,6 +1421,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.HtmlConverter
+Imports Syncfusion.Pdf
+
' Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter()
@@ -1330,20 +1449,24 @@ The [HTML to PDF converter library](https://www.syncfusion.com/document-processi
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.HtmlConverter;
+using Syncfusion.Pdf;
+
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
-//Convert URL to PDF document.
+//Convert a SVG file to PDF with HTML converter
PdfDocument document = htmlConverter.Convert("inputSVG.svg");
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the document
+//Save and close the PDF document
+document.Save("SVGToPDF.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.HtmlConverter;
+using Syncfusion.Pdf;
+
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
//Convert a SVG file to PDF with HTML converter
@@ -1356,6 +1479,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.HtmlConverter
+Imports Syncfusion.Pdf
+
'Initialize HTML to PDF converter
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter()
'Convert a SVG file to PDF with HTML converter
@@ -1366,4 +1492,4 @@ document.Close(True)
{% endhighlight %}
-{% endtabs %}
+ {% endtabs %}
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Document.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Document.md
index 2557aa4ba..75759e9e7 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Document.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Document.md
@@ -17,6 +17,9 @@ You can choose the standard or custom page size when you add a page to the PDF d
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Create-a-PDF-document-with-standard-page-size/.NET/Create-a-PDF-document-with-standard-page-size/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
// Set the page size.
@@ -31,10 +34,8 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -42,6 +43,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
// Set the page size.
@@ -65,6 +69,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Set the page size.
@@ -96,6 +103,9 @@ You can create a PDF document with custom page size in [PdfPageSettings Size](ht
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Create-a-PDF-document-with-custom-page-size/.NET/Create-a-PDF-document-with-custom-page-size/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
// Set the custom page size.
@@ -110,10 +120,8 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -121,6 +129,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
// Set the custom page size.
@@ -144,6 +155,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Set the custom page size.
@@ -175,6 +189,9 @@ You can change page orientation from portrait to landscape, through [PdfPageOrie
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Change-the-page-orientation-from-portrait-to-landscape/.NET/Change-the-page-orientation-from-portrait-to-landscape/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
// Set the page size.
@@ -191,10 +208,8 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -202,6 +217,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
// Set the page size.
@@ -227,6 +245,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf
+
'Create a new PDF document.
Dim document As New PdfDocument()
' Set the page size.
@@ -262,6 +283,10 @@ You can also change orientation by setting the rotation angle using [PdfPageRota
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Rotate_PDF_based_on_angle/.NET/Rotate_PDF_based_on_angle/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
// Set the page size.
@@ -278,10 +303,8 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -289,6 +312,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
// Set the page size.
@@ -314,6 +341,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Set the page size.
@@ -349,6 +380,10 @@ PDF sections are parts of the PDF document, which may contain one or more pages
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Create_sections_in_PDF_document/.NET/Create_sections_in_PDF_document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a section to PDF document.
@@ -363,10 +398,8 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -374,6 +407,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a section to PDF document.
@@ -397,6 +434,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a section to PDF document.
@@ -436,6 +477,8 @@ The following code snippet illustrates how to print a PDF document.
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.PdfViewer;
+
PdfDocumentView viewer = new PdfDocumentView();
//Load the PDF document
viewer.Load("Input.pdf");
@@ -456,6 +499,8 @@ viewer.Dispose();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.PdfViewer
+
Dim viewer As New PdfDocumentView()
'Load the PDF document
viewer.Load("Input.pdf")
@@ -486,6 +531,10 @@ The following code snippet illustrates how to set PDF document information.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Add_PDF_document_properties/.NET/Add_PDF_document_properties/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
@@ -506,10 +555,8 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -517,6 +564,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
@@ -546,6 +597,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim document As New PdfDocument()
@@ -583,9 +638,10 @@ To read and modify the document [DocumentInformation](https://help.syncfusion.co
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Change_existing_PDF_properties/.NET/Change_existing_PDF_properties/Program.cs" %}
-//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf.Parsing;
+
+//Load a existing PDF document
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Modify document information.
document.DocumentInformation.Author = "Syncfusion";
@@ -595,10 +651,8 @@ document.DocumentInformation.Keywords = "PDF";
document.DocumentInformation.Subject = "Document information DEMO";
document.DocumentInformation.Title = "Essential PDF Sample";
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -606,7 +660,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
-//Create a new PDF document.
+using Syncfusion.Pdf.Parsing;
+
+//Load a existing PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Modify document information.
@@ -626,7 +682,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create a new PDF document.
+Imports Syncfusion.Pdf.Parsing
+
+'Load a existing PDF document
Dim document As New PdfLoadedDocument("Input.pdf")
'Modify document information.
@@ -656,9 +714,10 @@ To remove specific details from the existing document information, use the **Rem
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Remove-specific-keys-from-the-existing-document-information/.NET/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Remove the document information properties.
document.DocumentInformation.Remove("Title");
@@ -670,10 +729,8 @@ document.DocumentInformation.Remove("Producer");
document.DocumentInformation.Remove("ModDate");
document.DocumentInformation.Remove("CreationDate");
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into stream.
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -681,6 +738,8 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
@@ -703,6 +762,8 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
@@ -735,19 +796,18 @@ The Essential® PDF supports incremental update for PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Perform-incremental-update-for-the-PDF-document/.NET/Perform-incremental-update-for-the-PDF-document/Program.cs" %}
-//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Disable the incremental update
loadedDocument.FileStructure.IncrementalUpdate = false;
//Set the compression level
loadedDocument.Compression = PdfCompressionLevel.Best;
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Output.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -755,6 +815,9 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -772,6 +835,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf
+
'Load the PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
@@ -801,6 +867,10 @@ You can hide the menu bar and toolbar by enabling [HideMenubar](https://help.syn
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Create_PDF_with_viewer_preference/.NET/Create_PDF_with_viewer_preference/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -819,10 +889,8 @@ document.ViewerPreferences.HideToolbar = true;
//Shows user interface elements in the document's window (such as scroll bars and navigation controls).
document.ViewerPreferences.HideWindowUI = false;
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -830,6 +898,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -857,6 +929,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf
+Imports System.Drawing
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -892,6 +968,9 @@ You can also allow the reader application to initially display the bookmarks, th
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Create-PDF-with-display-of-specific-panel/.NET/Create-PDF-with-display-of-specific-panel/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -906,9 +985,8 @@ graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Dra
//Show the attachments panel.
document.ViewerPreferences.PageMode = PdfPageMode.UseAttachments;
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -916,6 +994,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -939,6 +1020,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -978,6 +1062,10 @@ The following code sample illustrates how to create a PDF document in multi-thre
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
IEnumerable works = Enumerable.Range(0, 100);
Parallel.ForEach(works, index => GeneratePDF(index));
@@ -1010,6 +1098,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
Dim works As IEnumerable(Of Integer) = Enumerable.Range(0, 100)
Parallel.ForEach(works, Sub(index) GeneratePDF(index))
Private Sub GeneratePDF(ByVal index As Integer)
@@ -1046,6 +1138,11 @@ To modify the existing PDF document in multi-threading environment [EnableThread
{% tabs %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
IEnumerable works = Enumerable.Range(0, 100);
Parallel.ForEach(works, index => GeneratePDF(index));
@@ -1075,6 +1172,11 @@ doc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
Dim works As IEnumerable(Of Integer) = Enumerable.Range(0, 100)
Parallel.ForEach(works, Sub(index) GeneratePDF(index))
Private Sub GeneratePDF(ByVal index As Integer)
@@ -1115,6 +1217,10 @@ The following code snippet explains how to have uniform resource naming in a PDF
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Create_PDF_with_Uniform_Resouce_Naming/.NET/Create_PDF_with_Uniform_Resouce_Naming/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Disable unique resource naming
PdfDocument.EnableUniqueResourceNaming = false;
@@ -1139,16 +1245,19 @@ PdfFont font3 = new PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20);
//Draw the text
graphics.DrawString("こんにちは世界", font3, PdfBrushes.Blue, new PointF(50, 150));
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-//Close the document
+//Save the document.
+doc.Save("Output.pdf");
+//Close the document.
doc.Close(true);
{%endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Disable unique resource naming
PdfDocument.EnableUniqueResourceNaming = false;
@@ -1180,6 +1289,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Disable unique resource naming
PdfDocument.EnableUniqueResourceNaming = False
@@ -1222,9 +1335,11 @@ Enabling this property will optimize the memory but difference in time occurs ba
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Manage_memory_while_appending_PDF_document/.NET/Manage_memory_while_appending_PDF_document/Program.cs" %}
-//Load an existing PDF document
-FileStream docStream = new FileStream("file1.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
+//Load an existing PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create a new PDF document
PdfDocument document = new PdfDocument();
@@ -1234,17 +1349,18 @@ document.EnableMemoryOptimization = true;
//Append the document with source document
document.Append(loadedDocument);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the documents
-document.Close(true);
+//Save the document.
+loadedDocument.Save("Output.pdf");
+//Close the document.
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("file1.pdf");
@@ -1265,6 +1381,10 @@ loadedDocument.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document
Dim loadedDocument As New PdfLoadedDocument("file1.pdf")
@@ -1293,10 +1413,13 @@ Syncfusion PDF Library provides support to check whether the existing PDF docume
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Find_corrupted_PDF_document/.NET/Find_corrupted_PDF_document/Program.cs" %}
+
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using System.Text;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-//Create a new instance for the PDF analyzer
-PdfDocumentAnalyzer analyzer = new PdfDocumentAnalyzer(docStream);
+PdfDocumentAnalyzer analyzer = new PdfDocumentAnalyzer("Input.pdf");
//Get the syntax errors
SyntaxAnalyzerResult result = analyzer.AnalyzeSyntax();
@@ -1321,6 +1444,10 @@ analyzer.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using System.Text;
+
//Create a new instance for the PDF analyzer
PdfDocumentAnalyzer analyzer = new PdfDocumentAnalyzer("Input.pdf");
@@ -1347,6 +1474,10 @@ analyzer.Close();
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Create a new instance for the PDF analyzer
Dim analyzer As PdfDocumentAnalyzer = New PdfDocumentAnalyzer("Input.pdf")
@@ -1379,6 +1510,9 @@ Refer to the following code sample to achieve the same,
{% tabs %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+
+using Syncfusion.Pdf.Parsing;
+
//Load an existing document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Embed all the non-embedded fonts.
@@ -1393,6 +1527,9 @@ loadedDocument.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf.Parsing
+
//Load an existing document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
// Embed all the non-embedded fonts.
@@ -1415,6 +1552,8 @@ The Essential® PDF allows you to get or set the [BaseUri](https:/
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Add_BaseUri_in_the_PDF_document/.NET/Add_BaseUri_in_the_PDF_document/Program.cs" %}
+using Syncfusion.Pdf;
+
//Create a new instance of the PdfDocument class.
PdfDocument document = new PdfDocument();
//Set the Base URI.
@@ -1423,14 +1562,15 @@ document.BaseUri = "https://www.syncfusion.com/";
PdfPage page = document.Pages.Add();
//Save the document.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+
//Create a new instance of the PdfDocument class.
PdfDocument document = new PdfDocument();
//Set the Base URI.
@@ -1446,6 +1586,9 @@ document.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf.Parsing
+
'Create a new instance of the PdfDocument class.
Dim document As PdfDocument = New PdfDocument()
'Set the Base URI.
@@ -1467,17 +1610,21 @@ The following code example illustrates the retrieval of [BaseUri](https://help.s
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Retrieve_BaseUri_from_the_existing_PDF/.NET/Retrieve_BaseUri_from_the_existing_PDF/Program.cs" %}
-//Load the PDF document as file stream.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-//Load a PDF document.
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf.Parsing;
+
+//Load an existing PDF document.
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the Base URI.
string baseUri = document.BaseUri;
//Close the document.
document.Close(true);
+
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+
+using Syncfusion.Pdf.Parsing;
+
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
@@ -1488,6 +1635,9 @@ document.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the Base URI.
@@ -1507,6 +1657,10 @@ Essential® PDF enables you to track the save progress through the
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Document/Create-a-PDF-document-with-save-progress/.NET/PDF-document-with-save-progress/Program.cs" %}
+ using Syncfusion.Pdf.Graphics;
+ using Syncfusion.Pdf;
+ using Syncfusion.Drawing;
+
// Create a new PDF document.
PdfDocument document = new PdfDocument();
@@ -1529,13 +1683,8 @@ Essential® PDF enables you to track the save progress through the
// Subscribe to the SaveProgress event.
document.SaveProgress += new PdfDocument.ProgressEventHandler(document_SaveProgress);
- // Create a file stream to save the PDF document.
- using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
- {
- // Save the PDF document to the file stream.
- document.Save(outputFileStream);
- }
-
+ //Save the document.
+ document.Save("Output.pdf");
// Close the document.
document.Close(true);
@@ -1551,6 +1700,10 @@ Essential® PDF enables you to track the save progress through the
{% highlight c# tabtitle="C# [Windows-specific]" %}
+ using Syncfusion.Pdf.Graphics;
+ using Syncfusion.Pdf;
+ using System.Drawing;
+
// Create a new PDF document.
PdfDocument document = new PdfDocument();
// Add multiple pages to the document.
@@ -1567,12 +1720,8 @@ Essential® PDF enables you to track the save progress through the
}
// Subscribe to the SaveProgress event.
document.SaveProgress += new PdfDocument.ProgressEventHandler(document_SaveProgress);
- // Create a file stream to save the PDF document.
- using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
- {
- // Save the PDF document to the file stream.
- document.Save(outputFileStream);
- }
+ //Save the document.
+ document.Save("Output.pdf");
// Close the document.
document.Close(true);
@@ -1587,6 +1736,10 @@ Essential® PDF enables you to track the save progress through the
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+ Imports Syncfusion.Pdf.Graphics
+ Imports Syncfusion.Pdf
+ Imports Syncfusion.Drawing
+
Module Program
Sub Main()
' Create a new PDF document.
@@ -1604,11 +1757,8 @@ Essential® PDF enables you to track the save progress through the
Next
' Subscribe to the SaveProgress event.
AddHandler document.SaveProgress, AddressOf document_SaveProgress
- ' Create a file stream to save the PDF document.
- Using outputFileStream As New FileStream(Path.GetFullPath("../../../Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)
- ' Save the PDF document to the file stream.
- document.Save(outputFileStream)
- End Using
+ ' Save the document.
+ document.Save("Output.pdf")
' Close the document.
document.Close(True)
End Sub
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Flow-Layout.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Flow-Layout.md
index 5a5e0eb6d..3bceda99c 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Flow-Layout.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Flow-Layout.md
@@ -90,11 +90,11 @@ PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
render.Dispose();
wordDocument.Dispose();
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-//Close the documents.
+//Save and close the PDF document.
+pdfDocument.Save("Output.pdf");
pdfDocument.Close(true);
+//Close the document.
+wordDocument.Close();
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
@@ -180,6 +180,11 @@ You can create PDF document with text and image using the following code snippet
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
+
+using Syncfusion.Pdf;
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocToPDFConverter;
+
//A new document is created.
WordDocument document = new WordDocument();
//Adding a new section to the document.
@@ -230,15 +235,18 @@ PdfDocument pdfDocument = render.ConvertToPDF(document);
render.Dispose();
document.Dispose();
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-//Close the documents.
+//Saves the PDF file.
+pdfDocument.Save("Sample.pdf");
pdfDocument.Close(true);
+document.Close();
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocToPDFConverter;
+
//A new document is created.
WordDocument document = new WordDocument();
//Adding a new section to the document.
@@ -293,6 +301,11 @@ document.Close();
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.DocIO.DLS
+Imports Syncfusion.DocToPDFConverter
+Imports Syncfusion.Pdf
+
'A new document is created
Dim document As New WordDocument()
'Adding a new section to the document
@@ -355,6 +368,11 @@ You can create PDF document with simple table using the following code snippet.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
+
+using Syncfusion.Pdf;
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocToPDFConverter;
+
//Creates a new Word document.
WordDocument wordDocument = new WordDocument();
//Adding a new section to the document.
@@ -424,15 +442,19 @@ PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
render.Dispose();
wordDocument.Dispose();
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-//Close the documents.
+//Save and close the PDF document.
+pdfDocument.Save("Output.pdf");
pdfDocument.Close(true);
+//Close the document.
+wordDocument.Close();
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocToPDFConverter;
+
//Creates a new Word document.
WordDocument wordDocument = new WordDocument();
//Adding a new section to the document.
@@ -508,6 +530,11 @@ wordDocument.Close();
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.DocIO.DLS
+Imports Syncfusion.DocToPDFConverter
+Imports Syncfusion.Pdf
+
'Creates a new Word document
Dim wordDocument As New WordDocument()
'Adding a new section to the document
@@ -593,7 +620,13 @@ Syncfusion Essential® PDF supports creating a PDF document with f
The following code snippet explains how to create a PDF document with image, paragraph text, header text, a line below the header text, and a table using flow model.
{% tabs %}
-{% highlight c# tabtitle="C#" %}
+{% highlight c# tabtitle="C#" [Cross-platform] %}
+
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Grid;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -650,15 +683,20 @@ grid.ApplyBuiltinStyle(PdfGridBuiltinStyle.GridTable5DarkAccent5);
//Draw the table in page, below the line with a height gap of 20.
grid.Draw(page, new PointF(0, layoutResult.Bounds.Bottom + 20));
-//Saving the PDF to the MemoryStream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the PDF document.
+document.Save("Output.pdf");
//Close the instance of PdfDocument.
document.Close(true);
+
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Grid;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -722,6 +760,12 @@ document.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Grid
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Headers-and-Footers.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Headers-and-Footers.md
index dd22c7e57..ad0b75ad9 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Headers-and-Footers.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Headers-and-Footers.md
@@ -22,6 +22,10 @@ The below code snippet explains how to draw the page numbers in footer using aut
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Header%20and%20Footer/Adding-an-automatic-field-in-header-and-footer/.NET/Adding-an-automatic-field-in-header-and-footer/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document
@@ -52,16 +56,18 @@ compositeField.Draw(footer.Graphics, new PointF(470, 40));
//Add the footer template at the bottom.
pdfDocument.Template.Bottom = footer;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-//Closes the document.
+//Save and close the document.
+pdfDocument.Save("Output.pdf");
pdfDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document
@@ -98,6 +104,10 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim pdfDocument As New PdfDocument()
'Add a page to the PDF document.
@@ -146,6 +156,10 @@ The example below illustrates how to implement a dynamic footer that updates uni
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Header%20and%20Footer/Adding-dynamic-headers-and-footers-in-PDF/.NET/Adding-dynamic-headers-and-footers-in-PDF/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
// Create a new PDF document.
PdfDocument document = new PdfDocument();
@@ -213,10 +227,7 @@ PdfPage firstPage = document.Pages.Add();
textElement.Draw(firstPage, new PointF(0, headerHeight));
// Save and close the document.
-using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write))
-{
- document.Save(outputFileStream);
-}
+document.Save("Output.pdf");
document.Close(true);
// Add header and footer to every page.
@@ -249,6 +260,10 @@ static void PageAddedHandler(object sender, PageAddedEventArgs e)
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
// Create a new PDF document.
PdfDocument document = new PdfDocument();
@@ -349,6 +364,10 @@ static void PageAddedHandler(object sender, PageAddedEventArgs e)
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
' Create a new PDF document.
Dim document As New PdfDocument()
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-HyperLinks.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-HyperLinks.md
index 2a18cf994..cce02b755 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-HyperLinks.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-HyperLinks.md
@@ -1,17 +1,17 @@
---
-title: Working with Hyperlinks | Syncfusion
+title: Working with Hyperlinks in PDF | Syncfusion
description: This section explains how to add hyperlink in a new and existing PDF document using Syncfusion .NET PDF library
platform: document-processing
control: PDF
documentation: UG
---
-# Working with Hyperlinks
+# Working with Hyperlinks in PDF
In PDF, hyperlinks can be added to allow the users to navigate to another part of PDF file, web page or any other external content. Essential® PDF provides support for all these types of hyperlink.
## Working with Web navigation
-You can navigate to specified URL from a PDF document by using the [PdfTextWebLink](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfTextWebLink.html) class.
+You can navigate to specified URL from a PDF document by using the [PdfTextWebLink](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Interactive.PdfTextWebLink.html) class.
Please refer the below code snippet for navigating to the web page.
@@ -19,6 +19,11 @@ Please refer the below code snippet for navigating to the web page.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Hyperlinks/Navigate-to-specific-URL-from-a-PDF-document/.NET/Navigate-to-specific-URL-from-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -37,9 +42,8 @@ textLink.Font = font;
//Draw the hyperlink in PDF page.
textLink.DrawTextWebLink(page, new PointF(10, 40));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -47,6 +51,11 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -74,6 +83,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -109,9 +122,14 @@ To add a web hyperlink to an existing document, please refer the below code snip
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Hyperlinks/Add-a-web-hyperlink-to-an-existing-PDF-document/.NET/Add-a-web-hyperlink-to-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the page.
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
//Create the font.
@@ -128,9 +146,8 @@ textLink.Font = font;
//Draw the hyperlink in loaded page graphics.
textLink.DrawTextWebLink(loadedPage.Graphics, new PointF(10, 40));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Output.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -138,6 +155,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(@"Filename.pdf");
//Load the page.
@@ -165,6 +188,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load the existing PDF document.
Dim loadedDocument As New PdfLoadedDocument("fileName.pdf")
'Load the page.
@@ -202,6 +230,11 @@ To allow the users to navigate to any other part of the same document, [PdfDocum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Hyperlinks/Add-the-hyperlink-for-internal-document-navigation/.NET/Add-the-hyperlink-for-internal-document-navigation/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
@@ -228,9 +261,8 @@ documentLinkAnnotation.Destination.Zoom = 5;
//Add this annotation to a new page.
page.Annotations.Add(documentLinkAnnotation);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -238,6 +270,11 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
@@ -273,6 +310,10 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
@@ -316,9 +357,14 @@ To add a [PdfDocumentLinkAnnotation](https://help.syncfusion.com/cr/document-pro
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Hyperlinks/Internal-document-navigation-to-an-existing-PDF/.NET/Internal-document-navigation-to-an-existing-PDF/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("fileName.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the page.
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
//Create a new rectangle.
@@ -337,9 +383,8 @@ documentLinkAnnotation.Destination.Location = new PointF(10, 0);
//Add this annotation to respective page.
loadedPage.Annotations.Add(documentLinkAnnotation);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Output.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -347,6 +392,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(@"fileName.pdf");
//Load the page.
@@ -376,6 +427,11 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load the existing PDF document.
Dim loadedDocument As New PdfLoadedDocument("fileName.pdf")
'Load the page.
@@ -417,6 +473,9 @@ Please refer the below code snippet for navigating to external documents.
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create the PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page.
@@ -429,9 +488,8 @@ PdfFileLinkAnnotation fileLinkAnnotation = new PdfFileLinkAnnotation(bounds, fil
//Add this annotation to a page.
page.Annotations.Add(fileLinkAnnotation);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -439,6 +497,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create the PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page.
@@ -460,6 +521,9 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
'Create the PDF document
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document
@@ -495,7 +559,10 @@ To open a file in relative path, the [PdfLaunchAction](https://help.syncfusion.c
{% endhighlight %}
-{% highlight c# tabtitle="C#" %}
+{% highlight c# tabtitle="C#" [Windows-specific] %}
+
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
//Create a new PDF document.
PdfDocument document = new PdfDocument();
@@ -520,7 +587,10 @@ document.Close();
{% endhighlight %}
-{% highlight vb.net tabtitle="VB.NET" %}
+{% highlight vb.net tabtitle="VB.NET" [Windows-specific] %}
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
'Create a new PDF document
Dim document As New PdfDocument()
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Image-Extraction.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Image-Extraction.md
index 932a39df7..a07dd7903 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Image-Extraction.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Image-Extraction.md
@@ -15,9 +15,12 @@ Refer to the following code snippet to extract the images from a PDF page.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Image%20Extraction/Extract-images-from-a-PDF-pages/.NET/Extract-images-from-a-PDF-pages/Program.cs" %}
-//Load an existing PDF
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Exporting;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the first page
PdfPageBase pageBase = loadedDocument.Pages[0];
@@ -30,8 +33,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Exporting;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the first page
PdfPageBase pageBase = loadedDocument.Pages[0];
@@ -44,8 +51,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Exporting
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Load the first page
Dim pageBase As PdfPageBase = loadedDocument.Pages(0)
@@ -72,9 +83,13 @@ Refer to the following code snippet to extract the image info from a PDF page.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Image%20Extraction/Extract-the-image-info-from-a-PDF-page/.NET/Extract-the-image-info-from-a-PDF-page/Program.cs" %}
-//Load an existing PDF
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Exporting;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the first page
PdfPageBase pageBase = loadedDocument.Pages[0];
@@ -87,8 +102,13 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Exporting;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the first page
PdfPageBase pageBase = loadedDocument.Pages[0];
@@ -101,8 +121,13 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Exporting
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Load the first page
Dim pageBase As PdfPageBase = loadedDocument.Pages(0)
@@ -125,6 +150,9 @@ The following code example illustrates how to extract images from an entire PDF
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Image%20Extraction/Extract-images-from-PDF-documents/.NET/Extract-images-from-PDF-documents/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+using System.IO;
+
//Get stream from an existing PDF document.
FileStream inputStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
//Initialize the PDF document extractor.
@@ -144,6 +172,9 @@ documentExtractor.Dispose();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using System.IO;
+
//Get stream from an existing PDF document.
FileStream inputStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
//Initialize the PDF document extractor.
@@ -163,6 +194,9 @@ documentExtractor.Dispose();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports System.IO
+
'Get stream from an existing PDF document.
Dim inputStream As FileStream = New FileStream("Input.pdf", FileMode.Open, FileAccess.Read)
'Initialize the PDF document extractor.
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Images.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Images.md
index 33c5f9f79..38ca465a8 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Images.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Images.md
@@ -34,6 +34,9 @@ The following code snippet shows how to add a file from disk to the PDF document
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Images/Insert-image-in-a-new-PDF-document/.NET/Insert-image-in-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
@@ -47,10 +50,8 @@ PdfBitmap image = new PdfBitmap(imageStream);
//Draw the image
graphics.DrawImage(image, 0, 0);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-doc.Save(stream);
+//Save the document
+doc.Save("Output.pdf");
//Close the document
doc.Close(true);
@@ -58,6 +59,9 @@ doc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
@@ -79,6 +83,9 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim doc As New PdfDocument()
'Add a page to the document
@@ -110,9 +117,12 @@ You can also add images into an existing PDF document using the below code snipp
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Images/Insert-image-in-an-existing-PDF-document/.NET/Insert-image-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument doc = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument doc = new PdfLoadedDocument("Input.pdf");
//Get first page from document
PdfLoadedPage page = doc.Pages[0] as PdfLoadedPage;
@@ -124,10 +134,8 @@ PdfBitmap image = new PdfBitmap(imageStream);
//Draw the image
graphics.DrawImage(image, 0, 0);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-doc.Save(stream);
+//Save the document
+doc.Save("Output.pdf");
//Close the document
doc.Close(true);
@@ -135,6 +143,10 @@ doc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load a PDF document
PdfLoadedDocument doc = new PdfLoadedDocument("input.pdf");
//Get first page from document
@@ -156,6 +168,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load a PDF document
Dim doc As New PdfLoadedDocument("input.pdf")
'Get first page from document
@@ -182,9 +198,12 @@ To add image from stream, use the below code snippet.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Images/Insert-image-in-an-existing-PDF-document/.NET/Insert-image-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument doc = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument doc = new PdfLoadedDocument("Input.pdf");
//Get first page from document
PdfLoadedPage page = doc.Pages[0] as PdfLoadedPage;
@@ -196,10 +215,8 @@ PdfBitmap image = new PdfBitmap(imageStream);
//Draw the image
graphics.DrawImage(image, 0, 0);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-doc.Save(stream);
+//Save the document
+doc.Save("Output.pdf");
//Close the document
doc.Close(true);
@@ -207,6 +224,10 @@ doc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load a PDF document
PdfLoadedDocument doc = new PdfLoadedDocument("input.pdf");
//Get first page from document
@@ -230,6 +251,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load a PDF document
Dim doc As New PdfLoadedDocument("input.pdf")
'Get first page from document
@@ -278,6 +303,10 @@ The following code illustrate this,
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using System.Drawing;
+
//Create a PDF Document
PdfDocument doc = new PdfDocument();
//Add pages to the document
@@ -304,6 +333,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a PDF Document
Dim doc As New PdfDocument()
'Add pages to the document
@@ -342,6 +375,9 @@ The following code illustrate shows how to add a mask to TIFF image.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Images/Add-a-mask-to-TIFF-image/.NET/Add-a-mask-to-TIFF-image/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a PDF document
PdfDocument doc = new PdfDocument();
//Add pages to the document
@@ -360,9 +396,8 @@ image.Mask = mask;
graphics.DrawImage(image, 0, 0);
///Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-doc.Save(stream);
+//Save the document
+doc.Save("Output.pdf");
//Close the document
doc.Close(true);
@@ -370,6 +405,9 @@ doc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a PDF document
PdfDocument doc = new PdfDocument();
//Add pages to the document
@@ -394,6 +432,9 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a PDF document
Dim doc As New PdfDocument()
'Add pages to the document
@@ -430,9 +471,11 @@ Essential® PDF allows you to replace images in an existing docume
{% highlight c# tabtitle="C# [Cross-platform]" %}
-//Load an existing PDF document.
-FileStream pdfStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(pdfStream);
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create an image instance.
FileStream imageStream = new FileStream(Path.GetFullPath("Autumn Leaves.jpg"), FileMode.Open, FileAccess.Read);
@@ -440,9 +483,8 @@ PdfBitmap bmp = new PdfBitmap(imageStream);
//Replace the first image in the page
loadedDocument.Pages[0].ReplaceImage(0, bmp);
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-loadedDocument.Save(stream);
+//Save the document
+loadedDocument.Save("Output.pdf");
//Close the document
loadedDocument.Close(true);
@@ -450,6 +492,9 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
PdfLoadedDocument doc = new PdfLoadedDocument(@"image.pdf");
//Create an image instance
@@ -466,6 +511,9 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Graphics
+
'Load the PDF document
Dim doc As New PdfLoadedDocument("image.pdf")
'Create an image instance
@@ -492,6 +540,9 @@ You can allow a large image to paginate across multiple pages in the PDF documen
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Images/Paginate-an-image-in-PDF-document/.NET/Paginate-an-image-in-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create Document
PdfDocument doc = new PdfDocument();
//Add new page
@@ -507,17 +558,17 @@ format.Layout = PdfLayoutType.Paginate;
//Draw image
image.Draw(page, 20, 400, format);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-doc.Save(stream);
-//Close the document
+//Save the PDF
+doc.Save("output.pdf");
doc.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create Document
PdfDocument doc = new PdfDocument();
//Add new page
@@ -540,6 +591,9 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create Document
Dim doc As New PdfDocument()
'Add new page
@@ -572,6 +626,9 @@ You can add transparency and rotation to the image using [SetTransparency](https
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Images/Add-transparancy-and-rotation-to-the-image/.NET/Add-transparancy-and-rotation-to-the-image/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create Document
PdfDocument doc = new PdfDocument();
//Add a new page
@@ -594,17 +651,17 @@ image.Draw(page, 0, 0);
//Restore the graphics state
page.Graphics.Restore(state);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as strea
-doc.Save(stream);
-//Close the document
+//Save the PDF
+doc.Save("output.pdf");
doc.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create Document
PdfDocument doc = new PdfDocument();
//Add a new page
@@ -633,6 +690,9 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create Document
Dim doc As New PdfDocument()
'Add a new page
@@ -673,6 +733,9 @@ The code snippet to illustrate the same is given below.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Images/Converting-multi-page-TIFF-to-PDF/.NET/Converting-multi-page-TIFF-to-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
@@ -691,17 +754,17 @@ for (int i = 0; i < frameCount; i++)
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-doc.Save(stream);
-//Close the document
-doc.Close(true);
+//Save and close the document
+pdfDocument.Save("Sample.pdf");
+pdfDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a PDF document
PdfDocument pdfDocument = new PdfDocument();
//Set page margins
@@ -728,6 +791,9 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
@@ -767,27 +833,31 @@ The code snippet to illustrate the same is given below.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Images/Remove-images-from-PDF-document/.NET/Remove-images-from-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Exporting;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the first page.
PdfPageBase pageBase = loadedDocument.Pages[0];
//Extract images from the first page.
PdfImageInfo[] imageInfo = loadedDocument.Pages[0].GetImagesInfo();
//Remove the Image.
pageBase.RemoveImage(imageInfo[0]);
-//Create the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-loadedDocument.Save(stream);
-//Close the document
+//Save and close the document
+loadedDocument.Save("Sample.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Exporting;
+using Syncfusion.Pdf.Parsing;
+
//Load a PDF document
PdfLoadedDocument doc = new PdfLoadedDocument("input.pdf");
//Load the first page
@@ -805,6 +875,10 @@ doc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Load the first page
@@ -813,10 +887,9 @@ Dim pageBase As PdfPageBase = loadedDocument.Pages(0)
Dim imageInfo As PdfImageInfo = pageBase.ImagesInfo(0)
'Remove the Image
pageBase.RemoveImage(imageInfo)
-Dim stream As New MemoryStream()
'Save the document
-loadedDocument.Save(stream)
+loadedDocument.Save("Output.pdf")
'Close the document
loadedDocument.Close(True)
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-JavaScript.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-JavaScript.md
index 07ad2112a..966551198 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-JavaScript.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-JavaScript.md
@@ -22,6 +22,9 @@ You can add the JavaScript action to the PDF document by using [PdfJavaScriptAct
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/JavaScript/Add-the-JavaScript-action-to-the-PDF-document/.NET/Add-the-JavaScript-action-to-the-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new document
PdfDocument document = new PdfDocument();
//Add a page
@@ -32,23 +35,17 @@ PdfJavaScriptAction scriptAction = new PdfJavaScriptAction("app.alert(\"Hello Wo
//Add the JavaScript action
document.Actions.AfterOpen = scriptAction;
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save and close the PDF document
+document.Save("Output.pdf");
document.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new document
PdfDocument document = new PdfDocument();
//Add a page
@@ -67,6 +64,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
'Create a new document
Dim document As New PdfDocument()
'Add a page
@@ -97,6 +97,11 @@ The following code snippet illustrate this.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/JavaScript/Add-JavaScript-action-to-the-form-fields-in-a-PDF/.NET/Add-JavaScript-action-to-the-form-fields-in-a-PDF/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Creates a new page
@@ -116,23 +121,19 @@ submitButton.Actions.MouseDown = scriptAction;
//Add the submit button to the new document
document.Form.Fields.Add(submitButton);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save and close the PDF document
+document.Save("Output.pdf");
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Creates a new page
@@ -161,6 +162,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As New PdfDocument()
'Creates a new page
@@ -199,6 +205,10 @@ The 3D Annotations are used to represent 3D artworks in a PDF document. You can
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/JavaScript/Add-JavaScript-to-3D-annotation-in-a-PDF-document/.NET/Add-JavaScript-to-3D-annotation-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Creates a new page
@@ -218,23 +228,18 @@ pdf3dAnnotation.Activation = activation;
//Adds annotation to page
page.Annotations.Add(pdf3dAnnotation);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save and close the PDF document
+document.Save("Output.pdf");
document.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "3DAnnotation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Creates a new PDF document
PdfDocument document = new PdfDocument();
//Creates a new page
@@ -261,6 +266,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
'Creates a new PDF document
Dim document As New PdfDocument()
'Creates a new page
@@ -297,6 +306,10 @@ Add or modify the JavaScript action in a [PdfLoadedDocument](https://help.syncfu
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -312,6 +325,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
'Load the PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Layers.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Layers.md
index 11603afce..98e5eb3c2 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Layers.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Layers.md
@@ -20,6 +20,10 @@ Essential® PDF allows the users to create a layer in a PDF page u
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Layer/Adding-layers-in-a-PDF-document/.NET/Adding-layers-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create PDF document.
PdfDocument document = new PdfDocument();
//Add the page.
@@ -41,23 +45,19 @@ graphics.TranslateTransform(100, 180);
//Draw ellipse.
graphics.DrawEllipse(pen, bounds);
-//Save and close the document.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document.
+//Save the document.
+document.Save("Sample.pdf");
+//Close the document
document.Close(true);
-//Defining the ContentType for PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create PDF document.
PdfDocument document = new PdfDocument();
//Add the page.
@@ -88,6 +88,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create PDF document.
Dim document As New PdfDocument()
'Add the page.
@@ -126,9 +130,13 @@ The below code illustrates how to add the multiple layers in an existing PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Layer/Add-the-multiple-layers-in-an-existing-PDF-document/.NET/Add-the-multiple-layers-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get first page from document
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -148,25 +156,22 @@ graphics.TranslateTransform(100, 180);
//Draw ellipse.
graphics.DrawEllipse(pen, bounds);
-//Save and close the document
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document.
-loadedDocument.Close(true);
-//Defining the ContentType for pdf file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
+//Save the document.
+document.Save("Sample.pdf");
+//Close the document
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
-//Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get first page from document
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -195,8 +200,13 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports System.Drawing
+
'Load the existing PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get first page from document
Dim loadedPage As PdfLoadedPage = TryCast(loadedDocument.Pages(0), PdfLoadedPage)
@@ -235,6 +245,11 @@ Essential® PDF allows the users to add different types of [Annota
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Layer/Adding-annotation-to-layer-in-the-PDF-document/.NET/Adding-annotation-to-layer-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create new PDF document
PdfDocument document = new PdfDocument();
//Add page
@@ -255,23 +270,20 @@ annotation.Layer = layer;
//Add annotation to the created page
page.Annotations.Add(annotation);
-//Save and close the document
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
+//Save the document.
+document.Save("Sample.pdf");
//Close the document
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create new PDF document
PdfDocument document = new PdfDocument();
//Add page
@@ -301,6 +313,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Interactive
+Imports System.Drawing
+
'Create new PDF document
Dim document As New PdfDocument()
'Add page
@@ -338,9 +355,14 @@ The following code illustrates how to add annotation to the layers in an existin
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Layer/Add-annotation-to-the-layer-in-an-existing-PDF-document/.NET/Add-annotation-to-the-layer-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the first page from the document
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -359,23 +381,21 @@ annotation.Layer = Layer;
//Add annotation to the created page
loadedPage.Annotations.Add(annotation);
-//Save and close the document
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
+//Save the document.
+loadedDocument.Save("Sample.pdf");
//Close the document
loadedDocument.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the first page from the document
@@ -405,6 +425,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Interactive
+Imports System.Drawing
+
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Gets the first page from the document
@@ -444,6 +470,10 @@ Essential® PDF allows users to add nested layers in the PDF docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Layer/Add-nested-layers-in-the-PDF-document/.NET/Add-nested-layers-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create the PDF document
PdfDocument document = new PdfDocument();
//Add the page
@@ -466,25 +496,19 @@ graphics.TranslateTransform(100, 180);
//Draw an ellipse
graphics.DrawEllipse(pen, bounds);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-document.Save(stream);
-//If the position is not set to '0', the PDF will be empty
-stream.Position = 0;
+//Save the document.
+document.Save("Sample.pdf");
//Close the document
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create the PDF document
PdfDocument document = new PdfDocument();
//Add the page
@@ -516,6 +540,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create the PDF document
Dim document As New PdfDocument()
'Add the page
@@ -557,9 +585,11 @@ You can remove the layers using [RemoveAt](https://help.syncfusion.com/cr/docume
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Layer/Removing-layers-from-an-existing-PDF-document/.NET/Removing-layers-from-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets the first page from the document
PdfLoadedPage loadedPage = document.Pages[0] as PdfLoadedPage;
@@ -568,23 +598,18 @@ PdfPageLayerCollection layers = loadedPage.Layers;
//Remove the layer
layers.RemoveAt(0);
-//Save and close the document
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
+//Save the document
+document.Save("Output.pdf");
//Close the document
document.Close(true);
-//Defining the ContentType for pdf file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets the first page from the document
@@ -604,6 +629,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load the existing PDF document
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Gets the first page from the document
@@ -633,29 +661,29 @@ You can flatten a layer in a PDF document by removing it from the [PdfDocumentLa
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Layer/Flattening-the-layers-in-an-existing-PDF-document/.NET/Flattening-the-layers-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document
-FileStream inputStream = new FileStream("Layers.pdf", FileMode.Open);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the layer collection
PdfDocumentLayerCollection layers = loadedDocument.Layers;
//Flatten a layer in the PDF document
layers.RemoveAt(0);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Set the position as '0'
-stream.Position = 0;
-//Download the PDF document in the browser
-FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/pdf");
-fileStreamResult.FileDownloadName = "Output.pdf";
-return fileStreamResult;
+//Save the PDF document
+loadedDocument.Save("Output.pdf");
+//Close the instance of PdfLoadedDocument
+loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Layers.pdf");
@@ -673,6 +701,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load the existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Layers.pdf")
@@ -702,6 +733,10 @@ The below code illustrates how to toggle the visibility of layers in new PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Layer/Toggle-the-visibility-of-layers-in-new-PDF-document/.NET/Toggle-the-visibility-of-layers-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create the document
PdfDocument document = new PdfDocument();
//Create a page
@@ -724,23 +759,19 @@ graphics.TranslateTransform(100, 180);
//Draw ellipse
graphics.DrawEllipse(pen, bounds);
-//Save and close the document
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save the PDF document
+document.Save("Output.pdf");
+//Close the instance of PdfLoadedDocument
document.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create the document
PdfDocument document = new PdfDocument();
//Create a page
@@ -773,6 +804,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
'Create the document
Dim document As New PdfDocument()
'Create a page
@@ -812,32 +846,29 @@ The following code illustrates how to toggle the visibility of layers in an exis
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Layer/Toggle-the-visibility-of-layers-in-an-existing-PDF/.NET/Toggle-the-visibility-of-layers-in-an-existing-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets the first layer from the layer collection
PdfLayer layer = document.Layers[0];
//Disable the visibility
layer.Visible = false;
-//Save and close the document
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
+//Save the document
+document.Save("Output.pdf");
//Close the document
document.Close(true);
-//Defining the content type for PDF file.
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
@@ -855,6 +886,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load the existing PDF document
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
@@ -884,6 +918,10 @@ The following code sample shows how to add a lock state to the layer in a new PD
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Layer/Add-a-lock-state-to-the-layer-in-a-new-PDF-document/.NET/Add-a-lock-state-to-the-layer-in-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creating a new PDF document.
PdfDocument document = new PdfDocument();
//Adding a new page to the PDF document.
@@ -899,25 +937,19 @@ PdfGraphics graphics = layer.CreateGraphics(page);
//Draw ellipse.
graphics.DrawEllipse(PdfPens.Red, new RectangleF(50, 50, 40, 40));
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into stream.
-document.Save(stream);
-//If the position is not set to '0,' then the PDF will be empty.
-stream.Position = 0;
-//Close the document.
+//Save the PDF document.
+document.Save("Output.pdf");
+//Close the PDF document.
document.Close(true);
-//Defining the content type for a PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creating a new PDF document.
PdfDocument document = new PdfDocument();
//Adding a new page to the PDF document.
@@ -942,6 +974,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Creating a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Adding a new page to the PDF document.
@@ -986,6 +1022,10 @@ This is illustrated in the following code sample.
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Layers.pdf");
@@ -1009,6 +1049,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load the existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Output.pdf")
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Metadata.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Metadata.md
index 795912637..12093da51 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Metadata.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Metadata.md
@@ -24,6 +24,9 @@ You can add XMP metadata in a PDF document using the [XmpMetadata](https://help.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Adding-XMP-metadata-in-PDF-document/.NET/Adding-XMP-metadata-in-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create a PDF document
PdfDocument pdfDoc = new PdfDocument();
//Create a page
@@ -47,22 +50,16 @@ basic.Nickname = "nickname";
basic.Rating.Add(-25);
//Save and close the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "DocumentInformation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create a PDF document
PdfDocument pdfDoc = new PdfDocument();
//Create a page
@@ -86,13 +83,16 @@ basic.Nickname = "nickname";
basic.Rating.Add(-25);
//Save and close the document
-pdfDoc.Save("DocumentInformation.pdf");
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Create a PDF document
Dim pdfDoc As New PdfDocument()
'Create a page
@@ -133,9 +133,12 @@ You can add metadata in an existing PDF document using the [XmpMetadata](https:/
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Adding-XMP-metadata-to-an-existing-PDF-document/.NET/Adding-XMP-metadata-to-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Xmp;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument pdfDoc = new PdfLoadedDocument(docStream);
+PdfLoadedDocument pdfDoc = new PdfLoadedDocument("Input.pdf");
//Get XMP object
XmpMetadata metaData = pdfDoc.DocumentInformation.XmpMetadata;
@@ -155,22 +158,18 @@ basic.Nickname = "nickname";
basic.Rating.Add(-25);
//Save and close the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "DocumentInformation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
+
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Xmp;
+
//Load the document
PdfLoadedDocument pdfDoc = new PdfLoadedDocument("input.pdf");
@@ -192,13 +191,17 @@ basic.Nickname = "nickname";
basic.Rating.Add(-25);
//Save and close the document
-pdfDoc.Save("DocumentInformation.pdf");
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Load the document
Dim pdfDoc As New PdfLoadedDocument("input.pdf")
@@ -260,6 +263,9 @@ The [BasicSchema](https://help.syncfusion.com/cr/document-processing/Syncfusion.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Create-PDF-document-with-XMP-basic-schema/.NET/Create-PDF-document-with-XMP-basic-schema/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create a PDF document
PdfDocument pdfDoc = new PdfDocument();
//Create a page
@@ -283,22 +289,17 @@ basic.Nickname = "nickname";
basic.Rating.Add(-25);
//Save and close the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "DocumentInformation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
+
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create a PDF document
PdfDocument pdfDoc = new PdfDocument();
//Create a page
@@ -322,13 +323,16 @@ basic.Nickname = "nickname";
basic.Rating.Add(-25);
//Save and close the document
-pdfDoc.Save("DocumentInformation.pdf");
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Create a PDF document
Dim pdfDoc As New PdfDocument()
'Create a page
@@ -381,6 +385,9 @@ The [DublinCoreSchema](https://help.syncfusion.com/cr/document-processing/Syncfu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Create-PDF-document-with-dubline-core-schema-properties/.NET/Create-PDF-document-with-dubline-core-schema-properties/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create new PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add a new page
@@ -399,22 +406,16 @@ dublin.Type.Add("PDF");
dublin.Publisher.Add("Essential PDF");
//Save and close the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "DocumentInformation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create new PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add a new page
@@ -433,13 +434,16 @@ dublin.Type.Add("PDF");
dublin.Publisher.Add("Essential PDF");
//Save and close the document
-pdfDoc.Save("DocumentInformation.pdf");
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Create new PDF document
Dim pdfDoc As New PdfDocument()
'Add a new page
@@ -483,6 +487,9 @@ The [RightsManagementSchema](https://help.syncfusion.com/cr/document-processing/
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Create-PDF-document-with-right-management-schema/.NET/Create-PDF-document-with-right-management-schema/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add a new page
@@ -499,22 +506,16 @@ rights.Owner.Add("Syncfusion");
rights.Marked = true;
//Save and close the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "DocumentInformation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add a new page
@@ -530,13 +531,16 @@ rights.Owner.Add("Syncfusion");
rights.Marked = true;
//Save and close the document
-pdfDoc.Save("DocumentInformation.pdf");
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Create PDF document
Dim pdfDoc As New PdfDocument()
'Add a new page
@@ -572,6 +576,9 @@ This schema describes very simple workflow or job information and the [BasicJobT
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Create-PDF-document-with-basic-job-ticket-schema/.NET/Create-PDF-document-with-basic-job-ticket-schema/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create a document
PdfDocument pdfDoc = new PdfDocument();
//Add a page
@@ -586,22 +593,16 @@ BasicJobTicketSchema basicJob = metaData.BasicJobTicketSchema;
basicJob.JobRef.Add("PDF document creation");
//Save and close the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document.
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "DocumentInformation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create a document
PdfDocument pdfDoc = new PdfDocument();
//Add a page
@@ -616,13 +617,16 @@ BasicJobTicketSchema basicJob = metaData.BasicJobTicketSchema;
basicJob.JobRef.Add("PDF document creation");
//Save and close the document
-pdfDoc.Save("DocumentInformation.pdf");
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Create a document
Dim pdfDoc As New PdfDocument()
'Add a page
@@ -661,6 +665,9 @@ The [PagedTextSchema](https://help.syncfusion.com/cr/document-processing/Syncfus
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Create-PDF-document-with-pages-text-schema/.NET/Create-PDF-document-with-pages-text-schema/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create a PDF document
PdfDocument pdfDoc = new PdfDocument();
//Create a Page
@@ -678,22 +685,16 @@ pagedText.NPages = 1;
pagedText.PlateNames.Add("Sample page");
//Save and close the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "DocumentInformation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create a Pdf document
PdfDocument pdfDoc = new PdfDocument();
//Create a Page
@@ -711,13 +712,16 @@ pagedText.NPages = 1;
pagedText.PlateNames.Add("Sample page");
//Save and close the document
-pdfDoc.Save("DocumentInformation.pdf");
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Create a PDF document
Dim pdfDoc As New PdfDocument()
'Create a Page
@@ -752,6 +756,9 @@ This schema specifies the properties used with Adobe PDF documents. The [PDFSche
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Create-PDF-document-with-PDF-schema/.NET/Create-PDF-document-with-PDF-schema/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create a PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add a page
@@ -768,22 +775,16 @@ pdfSchema.PDFVersion = "1.5";
pdfSchema.Keywords = "Essential PDF";
//Save and close the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "DocumentInformation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create a PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add a page
@@ -800,13 +801,16 @@ pdfSchema.PDFVersion = "1.5";
pdfSchema.Keywords = "Essential PDF";
//Save and close the document
-pdfDoc.Save("DocumentInformation.pdf");
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Create a PDF document
Dim pdfDoc As New PdfDocument()
'Add a page
@@ -845,6 +849,9 @@ Add the following code sample to define the custom schema in a PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Create-PDF-document-with-custom-schema/.NET/Create-PDF-document-with-custom-schema/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add a new page
@@ -860,23 +867,17 @@ customSchema["DOCID"] = "SYNCSAM001";
customSchema["Encryption"] = "Standard";
customSchema["Project"] = "Data processing";
-//Save the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save and close the document
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "DocumentInformation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create Pdf document
PdfDocument pdfDoc = new PdfDocument();
//Add a new page
@@ -894,13 +895,16 @@ customSchema["Encryption"] = "Standard";
customSchema["Project"] = "Data processing";
//Save and close the document
-pdfDoc.Save("DocumentInformation.pdf");
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Create PDF document
Dim pdfDoc As New PdfDocument()
'Add a new page
@@ -935,6 +939,9 @@ Essential® PDF allows you to add required metadata (custom schema
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Adding-custom-schema-to-the-PDF-document/.NET/Adding-custom-schema-to-the-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add a new page
@@ -950,22 +957,16 @@ customSchema["creationDate"] = DateTime.Now.ToString();
customSchema["DOCID"] = "SYNCSAM001";
//Save and close the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "CustomMetaField.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add a new page
@@ -988,6 +989,9 @@ pdfDoc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Create PDF document
Dim pdfDoc As New PdfDocument()
'Add a new page
@@ -1020,6 +1024,9 @@ The custom metadata can be added in PDF document by using the [CustomMetadata](h
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Adding-custom-metadata-to-the-PDF-document/.NET/Adding-custom-metadata-to-the-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add new PDF page
@@ -1031,22 +1038,16 @@ pdfDoc.DocumentInformation.CustomMetadata["CompanyName"] = "Syncfusion";
pdfDoc.DocumentInformation.CustomMetadata["Key"] = "DocumentKey";
//Save and close the document
-MemoryStream stream = new MemoryStream();
-pdfDoc.Save(stream);
-stream.Position = 0;
-//Close the document
+pdfDoc.Save("Output.pdf");
pdfDoc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "AddCustomField.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+
//Create PDF document
PdfDocument pdfDoc = new PdfDocument();
//Add new PDF page
@@ -1065,6 +1066,9 @@ pdfDoc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Create PDF document
Dim pdfDoc As New PdfDocument()
'Add new PDF page
@@ -1093,30 +1097,28 @@ Removing the custom metadata from an existing PDF document using the [Remove](ht
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Remove-custom-metadata-from-an-existing-PDF-document/.NET/Remove-custom-metadata-from-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Remove custom metadata using key name
loadedDocument.DocumentInformation.CustomMetadata.Remove("Key");
//Save and close the document
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Xmp;
+using Syncfusion.Pdf.Parsing;
+
//Load the document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -1131,6 +1133,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Load the document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
@@ -1159,6 +1165,10 @@ You can add the XMP metadata along with an image to the PDF document. The [PdfBi
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Adding-XMP-metadata-along-with-an-image-in-PDF/.NET/Adding-XMP-metadata-along-with-an-image-in-PDF/Program.cs" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using System.Reflection.Metadata;
+
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
@@ -1172,24 +1182,18 @@ PdfBitmap image = new PdfBitmap(imageStream, true);
//Draw the image
graphics.DrawImage(image, 0, 0);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-doc.Save(stream);
-stream.Position = 0;
+//Save the document
+doc.Save("Output.pdf");
//Close the document
doc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using System.Reflection.Metadata;
+
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
@@ -1211,6 +1215,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Reflection.Metadata
+
'Create a new PDF document
Dim doc As New PdfDocument()
'Add a page to the document
@@ -1244,9 +1252,12 @@ Refer to the following code example to extract the image metadata from a PDF ima
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Metadata/Extracting-XMP-metadata-from-PDF-image/.NET/Extracting-XMP-metadata-from-PDF-image/Program.cs" %}
-//Load an existing PDF
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Xmp;
+using Syncfusion.Pdf;
+
+//Load the PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the first page
PdfPageBase pageBase = loadedDocument.Pages[0];
@@ -1262,6 +1273,10 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Xmp;
+using Syncfusion.Pdf;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
//Load the first page
@@ -1279,6 +1294,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Xmp
+Imports Syncfusion.Pdf
+
'Load an existing PDF
Dim loadedDocument As New PdfLoadedDocument(fileName)
'Load the first page
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Named-Destination.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Named-Destination.md
index b864b4559..71141373f 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Named-Destination.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Named-Destination.md
@@ -28,6 +28,11 @@ The following code example shows how to add named destination in a new PDF docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Named%20Destination/Adding-named-destination-to-a-PDF-document/.NET/Adding-named-destination-to-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
@@ -43,16 +48,19 @@ doc.NamedDestinationCollection.Add(destination);
//Draw the text.
page.Graphics.DrawString("Hello World!!", new PdfStandardFont(PdfFontFamily.Helvetica, 10), PdfBrushes.Black, new PointF(0, 500));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-//Closes the document
+//Save the document.
+doc.Save("Output.pdf");
+//Close the document.
doc.Close(true);
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
@@ -77,6 +85,11 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Interactive
+
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
@@ -111,9 +124,13 @@ The following code example shows how to add named destination in an existing PDF
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Named%20Destination/Adding-named-destination-to-an-existing-PDF-document/.NET/Adding-named-destination-to-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the first page of the document.
PdfPageBase page = loadedDocument.Pages[0];
//Create an instance for named destination.
@@ -125,16 +142,20 @@ destination.Destination.Location = new PointF(0, 500);
destination.Destination.Zoom = 4;
loadedDocument.NamedDestinationCollection.Add(destination);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Closes the document.
+//Save the document.
+loadedDocument.Save("Output.pdf");
+//Close the document.
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the first page of the document.
@@ -157,6 +178,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Interactive
+
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the first page of the document.
@@ -189,9 +215,11 @@ You can remove the named destination using [Remove](https://help.syncfusion.com/
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Named%20Destination/Remove-and-modify-the-named-destination-in-a-PDF/.NET/Remove-and-modify-the-named-destination-in-a-PDF/Program.cs" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Barcode.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument lDoc = new PdfLoadedDocument(docStream);
+PdfLoadedDocument lDoc = new PdfLoadedDocument("Input.pdf");
//Get the named destination collection.
PdfNamedDestinationCollection destinationCollection = lDoc.NamedDestinationCollection;
//Remove the named destination by title.
@@ -200,9 +228,8 @@ destinationCollection.Remove("TOC");
PdfNamedDestination destination = destinationCollection[0];
destination.Title = "POC";
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-lDoc.Save(stream);
+//Save the document.
+lDoc.Save("Output.pdf");
//Close the document.
lDoc.Close(true);
@@ -210,6 +237,9 @@ lDoc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument lDoc = new PdfLoadedDocument("Sample.pdf");
//Get the named destination collection.
@@ -230,6 +260,9 @@ lDoc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Interactive
+
'Load the PDF document.
Dim lDoc As New PdfLoadedDocument("Sample.pdf")
'Get the named destination collection.
@@ -260,6 +293,11 @@ The following code example shows how to add named destination to the [Bookmarks]
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Named%20Destination/Adding-named-destination-to-the-bookmarks/.NET/Adding-named-destination-to-the-bookmarks/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
@@ -278,10 +316,8 @@ PdfBookmark bookmark = doc.Bookmarks.Add("TOC");
//Assign the named destination to the bookmark.
bookmark.NamedDestination = destination;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-stream.Position = 0;
+//Save the document.
+doc.Save("Sample.pdf");
//Close the document.
doc.Close(true);
@@ -289,6 +325,11 @@ doc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
@@ -316,6 +357,11 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Interactive
+
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-PDF-Conformance.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-PDF-Conformance.md
index ecf21596b..30a3ab9f7 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-PDF-Conformance.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-PDF-Conformance.md
@@ -123,6 +123,9 @@ You can create a PDF/A-1b document by specifying the conformance level as ```Pdf
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-the-new-PDFA1B-document/.NET/Creating-the-new-PDFA1B-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/A-1b standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A1B);
//Add a page to the document
@@ -137,25 +140,16 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
-//If the position is not set to '0', then the PDF will be empty
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/A-1b standard.
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A1B);
//Add a page.
@@ -180,6 +174,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new document with PDF/A-1b standard.
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A1B)
'Add a page.
@@ -214,6 +211,9 @@ You can create a PDF/A-2b document by specifying the conformance level as ```Pdf
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-the-new-PDFA2B-document/.NET/Creating-the-new-PDFA2B-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/A-2b standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A2B);
//Add a page to the document
@@ -228,25 +228,17 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
-//If the position is not set to '0', then the PDF will be empty
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/A-2b standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A2B);
//Add a page
@@ -271,6 +263,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new document with PDF/A-2b standard
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A2B)
'Add a page
@@ -307,6 +302,10 @@ You can create a PDF/A-3b document by specifying the conformance level as Pdf_A3
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-the-new-PDFA3B-document/.NET/Creating-the-new-PDFA3B-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new document with PDF/A-3b standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3B);
//Add a page to the document
@@ -330,25 +329,18 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
-//If the position is not set to '0', then the PDF will be empty
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new document with PDF/A-3b standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3B);
//Add a page
@@ -381,6 +373,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Interactive
+
'Create a new document with PDF/A-3b standard
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A3B)
'Add a page
@@ -425,6 +421,9 @@ You can create a PDF/A-1a document by specifying the conformance level as ```Pdf
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-the-new-PDFA1A-document/.NET/Creating-the-new-PDFA1A-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/A-1a standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A1A);
//Add a page to the document
@@ -438,25 +437,16 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
-//If the position is not set to '0', then the PDF will be empty
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/A-1a standard.
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A1A);
//Add a page.
@@ -480,6 +470,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new document with PDF/A-1a standard.
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A1A)
'Add a page.
@@ -515,6 +508,9 @@ You can create a PDF/A-2a document by specifying the conformance level as ```Pdf
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-the-new-PDFA2A-document/.NET/Creating-the-new-PDFA2A-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/A-2a standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A2A);
//Add a page to the document
@@ -528,25 +524,17 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
-//If the position is not set to '0', then the PDF will be empty
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/A-2a standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A2A);
//Add a page
@@ -570,6 +558,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new document with PDF/A-2a standard
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A2A)
'Add a page
@@ -605,6 +596,10 @@ You can create a PDF/A-3a document by specifying the conformance level as ``Pdf_
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-the-new-PDFA3A-document/.NET/Creating-the-new-PDFA3A-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new document with PDF/A-3a standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3A);
//Add a page to the document
@@ -628,25 +623,18 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
-//If the position is not set to '0', then the PDF will be empty
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new document with PDF/A-3a standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3A);
//Add a page
@@ -680,6 +668,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Interactive
+
'Create a new document with PDF/A-3a standard
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A3A)
'Add a page
@@ -725,6 +717,9 @@ You can create a PDF/A-2u document by specifying the conformance level as ```Pdf
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-the-new-PDFA2U-document/.NET/Creating-the-new-PDFA2U-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/A-2u standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A2U);
//Add a page to the document
@@ -738,25 +733,16 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
-//If the position is not set to '0', then the PDF will be empty
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/A-2u standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A2U);
//Add a page
@@ -780,6 +766,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new document with PDF/A-2u standard
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A2U)
'Add a page
@@ -815,6 +804,10 @@ You can create a PDF/A-3u document by specifying the conformance level as ``Pdf_
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-the-new-PDFA3U-document/.NET/Creating-the-new-PDFA3U-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new document with PDF/A-3u standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3U);
//Add a page to the document
@@ -838,25 +831,18 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
-//If the position is not set to '0', then the PDF will be empty
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new document with PDF/A-3u standard
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3U);
//Add a page
@@ -890,6 +876,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Interactive
+
'Create a new document with PDF/A-3u standard
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A3U)
'Add a page
@@ -935,6 +925,9 @@ Create a PDF/A-4 document by specifying the conformance level as ``Pdf_A4`` thro
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-the-new-PDFA4-document/.NET/Creating-the-new-PDFA4-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with the PDF/A-4 standard.
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A4);
//Add a page to the document.
@@ -948,25 +941,17 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Create the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into the memory stream.
-document.Save(stream);
-//If the position is not set to '0,' a PDF will be empty.
-stream.Position = 0;
-//Close the document.
-document.Close(true);
-//Define the content type for a PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Output.pdf";
-//Create the FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
+//Save and close the document.
+document.Save("Output.pdf");
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with the PDF/A-4 standard.
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A4);
//Add a page.
@@ -990,6 +975,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new document with the PDF/A-4 standard.
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A4)
'Add a page.
@@ -1025,6 +1013,9 @@ Create a PDF/A-4E document by specifying the conformance level as ``Pdf_A4E`` th
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-the-new-PDFA4E-document/.NET/Creating-the-new-PDFA4E-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with the PDF/A-4 standard.
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A4);
//Creates a new page.
@@ -1040,22 +1031,16 @@ activation.ShowToolbar = true; pdf3dAnnotation.Activation = activation;
//Add the annotation to the page.
page.Annotations.Add(pdf3dAnnotation);
-//Save the document into the stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream); stream.Position = 0;
-//Close the document.
-document.Close(true);
-//Define the ContentType for a pdf file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "3DAnnotation.pdf";
-//Create the FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
-
+//Save and close the document.
+document.Save("Output.pdf");
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with the PDF/A-4E standard.
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A4E);
//Create a new page.
@@ -1079,6 +1064,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new document with the PDF/A-4 standard.
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A4E)
'Creates a new page.
@@ -1115,6 +1103,9 @@ Create a PDF/A-4f document by specifying the conformance level as ``Pdf_A4F`` th
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Creating-a-new-PDFA4F-document/.NET/Creating-a-new-PDFA4F-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with the PDF/A-4F standard.
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A4F);
//Add a page to the document.
@@ -1140,18 +1131,17 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
-//Save the document into the memory stream.
-MemoryStream stream = new MemoryStream();
-await document.SaveAsync(stream);
-//Close the document.
-document.Close(true);
-//Save the stream as a PDF document file in the local machine. Refer to the PDF/UWP section for respective code samples.
-Save(stream, "Output.pdf");
+//Save and close the document.
+document.Save("Output.pdf");
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with the PDF/A-3b standard.
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A4F);
//Add a page.
@@ -1184,6 +1174,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new document with the PDF/A-3b standard.
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A4F)
'Add a page.
@@ -1233,6 +1226,9 @@ You can create a PDF/X-1a document by specifying the conformance level as ```Pdf
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document with PDF/x standard.
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_X1A2001);
//Add a page.
@@ -1258,6 +1254,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new document with PDF/x standard.
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_X1A2001)
'Add a page.
@@ -1307,32 +1306,32 @@ Refer to the following code sample to implement this conversion.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Convert-PDF-to-PDFA-conformance-document/.NET/Convert-PDF-to-PDFA-conformance-document/Program.cs" %}
-//Load an existing PDF document
-FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using SkiaSharp;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Sample level font event handling
loadedDocument.SubstituteFont += LoadedDocument_SubstituteFont ;
//Convert the loaded document to PDF/A document
loadedDocument.ConvertToPDFA(PdfConformanceLevel.Pdf_A1B);
-//Save the document
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document
-loadedDocument.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
+loadedDocument.Close(true)
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using SkiaSharp;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -1347,6 +1346,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports SkiaSharp
+
'Load an existing PDF document.
Dim document As New PdfLoadedDocument("Input.pdf")
@@ -1429,9 +1433,15 @@ N> To convert an existing PDF to a PDF/A-compliant document in .NET Core, ensure
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Font_Subsetting_in_PDFA_conversion/.NET/Font_Subsetting_in_PDFA_conversion/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf;
+using System.Reflection.Metadata;
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Graphics;
+using SkiaSharp;
+
//Load an existing PDF document
-FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Sample level font event handling
loadedDocument.SubstituteFont += LoadedDocument_SubstituteFont;
@@ -1447,17 +1457,21 @@ options.SubsetFonts = true;
// Convert to PDF/A conformance
loadedDocument.ConvertToPDFA(options);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf;
+using System.Reflection.Metadata;
+using System.Drawing;
+using Syncfusion.Pdf.Graphics;
+using SkiaSharp;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -1478,6 +1492,13 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf
+Imports System.Reflection.Metadata
+Imports System.Drawing
+Imports Syncfusion.Pdf.Graphics
+Imports SkiaSharp
+
' Load an existing PDF document.
Dim document As New PdfLoadedDocument("Input.pdf")
@@ -1562,9 +1583,11 @@ You can find the conformance level of the existing PDF document using the [Confo
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Get-the-conformance-level-of-the-existing-PDF-document/.NET/Program.cs" %}
-//Load an existing PDF document
-FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the conformance level of the loaded document.
PdfConformanceLevel conformance = loadedDocument.Conformance;
@@ -1576,6 +1599,9 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -1589,6 +1615,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf
+
'Load an existing PDF.
Dim document As New PdfLoadedDocument("Input.pdf")
@@ -1613,24 +1642,20 @@ The following code sample shows the delegate for handling PDF to PDF/A conversio
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Get-PDF-to-PDFA-conversion-progress/.NET/Get-PDF-to-PDFA-conversion-progress/Program.cs" %}
-
-
-//Get stream from an existing PDF document.
-FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//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
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
@@ -1645,6 +1670,9 @@ void pdfAConversion_TrackProgress(object sender, PdfAConversionProgressEventArgs
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load a PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
@@ -1668,6 +1696,9 @@ Console.WriteLine(String.Format("PDF to PDF/A conversion Process " + arguments.
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf
+
'Load a PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
@@ -1699,30 +1730,25 @@ An existing PDF/A conformance document can be converted to a PDF document using
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Conformance/Convert-PDFA-to-PDF-document/.NET/Convert-PDFA-to-PDF-document/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+
//Load a PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Remove PDF/A conformance.
document.RemoveConformance();
//Save the document.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
-//Defining the content type for PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "output.pdf";
-
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument("input.pdf");
@@ -1738,6 +1764,8 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-PDF-Templates.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-PDF-Templates.md
index d925cfe00..4fc50279b 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-PDF-Templates.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-PDF-Templates.md
@@ -19,6 +19,10 @@ The below code snippet illustrates how to add contents to the [PdfTemplate](http
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Templates/Add-the-contents-to-template-and-render-into-PDF-page/.NET/Add-the-contents-to-template-and-render-into-PDF-page/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document.
@@ -37,9 +41,8 @@ template.Graphics.DrawString("Hello World", font, brush, 5, 5);
//Draw the template on the page graphics of the document.
pdfPage.Graphics.DrawPdfTemplate(template, PointF.Empty);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
+//Save the document.
+pdfDocument.Save("Output.pdf");
//Close the document.
pdfDocument.Close(true);
@@ -47,6 +50,10 @@ pdfDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document.
@@ -74,6 +81,10 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim pdfDocument As New PdfDocument()
'Add a page to the PDF document.
@@ -109,9 +120,12 @@ The below code snippet illustrates how to render the [PdfTemplate](https://help.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Templates/Render-the-template-in-an-existing-PDF-document/.NET/Render-the-template-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the page into Pdf document.
PdfLoadedPage LoadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -128,9 +142,8 @@ template.Graphics.DrawString("Hello World", font, brush, 5, 5);
//Draw the template on the page graphics of the document.
LoadedPage.Graphics.DrawPdfTemplate(template, Syncfusion.Drawing.PointF.Empty);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Output.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -138,8 +151,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the page into Pdf document.
PdfLoadedPage LoadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -165,8 +182,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Load the existing PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Load the page into Pdf document.
Dim LoadedPage As PdfLoadedPage = TryCast(loadedDocument.Pages(0), PdfLoadedPage)
@@ -204,9 +225,12 @@ The below code illustrates how to create the template from an existing page and
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Templates/Create-template-from-an-existing-PDF-document/.NET/Create-template-from-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the page.
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
//Create the template from the page.
@@ -221,19 +245,21 @@ PdfGraphics graphics = page.Graphics;
//Draw the template.
graphics.DrawPdfTemplate(template, Syncfusion.Drawing.PointF.Empty, new Syncfusion.Drawing.SizeF(page.Size.Width / 2, page.Size.Height));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+loadedDocument.Save("Output.pdf");
//Close the document.
-document.Close(true);
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the page.
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
//Create the template from the page.
@@ -258,8 +284,12 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Load the existing PDF document
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Load the page
Dim loadedPage As PdfLoadedPage = TryCast(loadedDocument.Pages(0), PdfLoadedPage)
'Create the template from the page
@@ -296,6 +326,10 @@ The below code illustrates how to add the page template elements in a PDF docume
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Templates/Add-the-page-template-elements-in-a-PDF-document/.NET/Add-the-page-template-elements-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document.
@@ -329,9 +363,8 @@ compositeField.Draw(footer.Graphics, new Syncfusion.Drawing.PointF(470, 40));
//Add the footer template at the bottom.
pdfDocument.Template.Bottom = footer;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
+//Save the document.
+pdfDocument.Save("Output.pdf");
//Close the document.
pdfDocument.Close(true);
@@ -339,6 +372,10 @@ pdfDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document.
@@ -379,6 +416,10 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim pdfDocument As New PdfDocument()
'Add a page to the PDF document.
@@ -429,12 +470,15 @@ Multiple templates can be drawn over a PDF page, to create a document-overlay us
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Templates/Creating-the-document-overlays/.NET/Creating-the-document-overlays/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream1 = new FileStream(fileName1, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument1 = new PdfLoadedDocument(docStream1);
+PdfLoadedDocument loadedDocument1 = new PdfLoadedDocument("Input1.pdf");
//Load the PDF document.
-FileStream docStream2 = new FileStream(fileName2, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument2 = new PdfLoadedDocument(docStream2);
+PdfLoadedDocument loadedDocument2 = new PdfLoadedDocument("Input2.pdf");
//Create the new document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -451,23 +495,25 @@ template = loadedPage.CreateTemplate();
//Draw the loaded template into new document.
page.Graphics.DrawPdfTemplate(template, new PointF(10, 10), new SizeF(400, 500));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Set the position as '0'.
-stream.Position = 0;
+//Save the new document.
+document.Save("Output.pdf");
//Closes the documents.
-document.Close(true);
loadedDocument1.Close(true);
loadedDocument2.Close(true);
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing documents.
-PdfLoadedDocument loadedDocument1 = new PdfLoadedDocument(fileName1);
-PdfLoadedDocument loadedDocument2 = new PdfLoadedDocument(fileName2);
+PdfLoadedDocument loadedDocument1 = new PdfLoadedDocument("Input1.pdf");
+PdfLoadedDocument loadedDocument2 = new PdfLoadedDocument("Input2.pdf");
//Create the new document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -495,9 +541,14 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+Imports System.Drawing
+
'Load the existing documents.
-Dim loadedDocument1 As New PdfLoadedDocument(fileName1)
-Dim loadedDocument2 As New PdfLoadedDocument(fileName2)
+Dim loadedDocument1 As New PdfLoadedDocument("Input1.pdf")
+Dim loadedDocument2 As New PdfLoadedDocument("Input2.pdf")
'Create the new document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -535,9 +586,12 @@ The following code sample shows how to add a [PdfPageTemplate](https://help.sync
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/PDF%20Templates/Add-a-template-from-an-existing-PDF-document/.NET/Add-a-template-from-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Loads an existing PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the first page of the document.
PdfPageBase page = loadedDocument.Pages[0];
@@ -550,17 +604,19 @@ pageTemplate.IsVisible = true;
//Adds the page template.
loadedDocument.PdfPageTemplates.Add(pageTemplate);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into stream.
-loadedDocument.Save(stream);
-//Close the document.
+//Save the PDF document.
+loadedDocument.Save("output.pdf");
+//Close the PDF document.
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Loads an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Get the first page of the document.
@@ -584,6 +640,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Loads an existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Get the first page of the documsent.
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Pages.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Pages.md
index 2841de9bb..7f719a83a 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Pages.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Pages.md
@@ -15,6 +15,9 @@ The following code sample explains you on how to add a [PdfPage](https://help.sy
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Add-a-new-page-to-the-PDF-document/.NET/Add-a-new-page-to-the-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
@@ -29,17 +32,17 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 14);
//Draw the text.
graphics.DrawString("Hello world!", font, brush, new Syncfusion.Drawing.PointF(20, 20));
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-document.Save(stream);
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
@@ -62,6 +65,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
@@ -94,23 +100,23 @@ You can insert an empty page at any location in the existing PDF document using
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Insert-pages-in-a-PDF-document/.NET/Insert-pages-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Insert a new page in the beginning of the document.
loadedDocument.Pages.Insert(0);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-loadedDocument.Save(stream);
-//Close the document.
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Insert a new page in the beginning of the document.
@@ -123,6 +129,8 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Insert a new page in the beginning of the document.
@@ -145,6 +153,9 @@ You can add margin to all the PDF pages of the PDF document using the [PageSetti
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Add-margin-to-the-PDF-pages/.NET/Add-margin-to-the-PDF-pages/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Set margin for all the pages.
@@ -161,17 +172,17 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 14);
//Draw the text.
graphics.DrawString("Hello world!", font, brush, new Syncfusion.Drawing.PointF(20, 20));
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-document.Save(stream);
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Set margin for all the pages
@@ -196,6 +207,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Set margin for all the pages.
@@ -234,6 +248,9 @@ The following code snippet explains how to add more sections to a PDF document w
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Adding-sections-with-different-page-settings/.NET/Adding-sections-with-different-page-settings/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Create a solid brush and standard font
@@ -293,17 +310,18 @@ graphics = page.Graphics;
//Draw simple text on the page
graphics.DrawString("Rotated by 270 degrees", font, brush, new PointF(20, 20));
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
+
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Create a solid brush and standard font
@@ -372,6 +390,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Create a solid brush and standard font
@@ -451,6 +472,9 @@ For example, to use lowercase Roman numerals (i, ii, iii, ...), assign `PdfNumbe
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document.
PdfDocument document = new PdfDocument();
//Add a section to the document.
@@ -484,21 +508,17 @@ for (int i = 0; i < 3; i++)
page.Graphics.DrawString("This is the main content of a page with a footer.", font, PdfBrushes.Black, new PointF(10, 10));
}
-//Create file stream.
-using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
-{
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
-}
-
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new document.
PdfDocument document = new PdfDocument();
//Add a section to the document.
@@ -541,6 +561,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new document.
Dim document As New PdfDocument()
'Add a section to the document.
@@ -592,9 +615,10 @@ You can get page count from the existing PDF document as shown in the following
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Get-number-of-pages-from-PDF-document/.NET/Get-number-of-pages-from-PDF-document/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page count.
int pageCount = loadedDocument.Pages.Count;
//Close the document.
@@ -604,6 +628,8 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page count.
@@ -615,6 +641,8 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the page count.
@@ -637,10 +665,11 @@ Essential® PDF allows you to import a page or import a range of p
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Importing-pages-from-one-PDF-to-another-PDF/.NET/Importing-pages-from-one-PDF-to-another-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create a new PDF document.
PdfDocument document = new PdfDocument();
int startIndex = 0;
@@ -648,18 +677,17 @@ int endIndex = loadedDocument.Pages.Count - 1;
//Import all the pages to the new PDF document.
document.ImportPageRange(loadedDocument, startIndex, endIndex);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-document.Save(stream);
-//Close the document instances.
-document.Close(true);
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create a new PDF document.
@@ -679,6 +707,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Create a new PDF document.
@@ -710,10 +741,11 @@ N> Performance will be effective only in the large PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Import-pages-from-PDF-without-bookmarks/.NET/Import-pages-from-PDF-without-bookmarks/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-//Load the PDF document
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the new PDF document
PdfDocument document = new PdfDocument();
int startIndex = 0;
@@ -721,18 +753,17 @@ int endIndex = loadedDocument.Pages.Count - 1;
//Import all the pages to the new PDF document
document.ImportPageRange(loadedDocument, startIndex, endIndex, false);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-document.Save(stream);
-//Close the document instances
-document.Close(true);
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -754,6 +785,9 @@ System.Diagnostics.Process.Start("Output.pdf");
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Create the new PDF document
@@ -783,22 +817,25 @@ You can rearrange the pages in an existing PDF document using [ReArrange](https:
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Rearrange-pages-in-an-existing-PDF-document/.NET/Rearrange-pages-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Rearrange the page by index
-loadedDocument.Pages.ReArrange(new int[] { 1, 0 });//Creating the stream object
-MemoryStream stream = new MemoryStream();
+loadedDocument.Pages.ReArrange(new int[] { 1, 0 });
-//Save the document as stream
-loadedDocument.Save(stream);
-//Close the document
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Rearrange the page by index
@@ -811,6 +848,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Rearrange the page by index
@@ -834,10 +874,11 @@ You can alter the page label for the existing PDF document using [PdfPageLabel](
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Changing-page-numbers-in-a-PDF-document/.NET/Changing-page-numbers-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-//Load the PDF document
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Create a page label
PdfPageLabel pageLabel = new PdfPageLabel();
//Set the number style with upper case roman letters
@@ -846,17 +887,16 @@ pageLabel.NumberStyle = PdfNumberStyle.UpperRoman;
pageLabel.StartNumber = 1;
loadedDocument.LoadedPageLabel = pageLabel;
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-loadedDocument.Save(stream);
-//Close the document
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create a page label
@@ -876,6 +916,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Create a page label
@@ -905,23 +948,24 @@ You can remove the pages from the existing PDF document using [RemoveAt](https:/
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Remove-pages-from-the-existing-PDF-document/.NET/Remove-pages-from-the-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Remove the first page in the PDF document
loadedDocument.Pages.RemoveAt(0);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-loadedDocument.Save(stream);
-//Close the document.
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Remove the first page in the PDF document
@@ -935,6 +979,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Remove the first page in the PDF document
@@ -958,6 +1005,10 @@ You can rotate a particular PDF page in the PDF document using [PdfPageRotateAng
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Rotating-a-PDF-page/.NET/Rotating-a-PDF-page/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a section.
@@ -975,17 +1026,18 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 14);
//Draws the text.
graphics.DrawString("Rotated by 90 degree", font, brush, new Syncfusion.Drawing.PointF(20, 20));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-document.Save(stream);
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a section.
@@ -1012,6 +1064,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a section.
@@ -1048,24 +1104,27 @@ You can also rotate a PDF page in the existing PDF document using [PdfPageRotate
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Rotate-an-existing-PDF-page/.NET/Rotate-an-existing-PDF-page/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the page
PdfPageBase loadedPage = loadedDocument.Pages[0] as PdfPageBase;
//Set the rotation for loaded page
loadedPage.Rotation = PdfPageRotateAngle.RotateAngle90;
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Close the document
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the page.
@@ -1082,6 +1141,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Gets the page.
@@ -1108,24 +1170,27 @@ You can find the empty pages from the PDF document using the [IsBlank](https://h
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Pages/Detect-empty-pages-from-PDF/.NET/Detect-empty-pages-from-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the page.
PdfPageBase loadedPage = loadedDocument.Pages[0] as PdfPageBase;
//get the page is blank or not.
bool isEmpty = loadedPage.IsBlank;
-//Save the document into a stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Close the document.
+//Save and close the document.
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the page.
@@ -1142,6 +1207,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("input.pdf")
'Gets the page.
@@ -1170,28 +1238,30 @@ Essential® PDF allows to split the pages of an existing PDF docum
//Due to platform limitations, Essential® PDF supports splitting a PDF file into individual pages only in Windows Forms, WPF, ASP.NET, and ASP.NET MVC platforms. However this can be achieved by using the following code snippet.
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
-for (int i=0;i® PDF provides support for extracting the files from
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Portfolio/Extracting-the-files-from-PDF-portfolio/.NET/Extracting-the-files-from-PDF-portfolio/Program.cs" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
-FileStream docStream = new FileStream("Sample.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Iterate the attachments
foreach (PdfAttachment attachment in document.Attachments)
@@ -125,23 +127,17 @@ foreach (PdfAttachment attachment in document.Attachments)
s.Dispose();
}
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+document.Save("Sample.pdf");
document.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Sample.pdf");
@@ -162,6 +158,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document
Dim document As New PdfLoadedDocument("Sample.pdf")
@@ -191,30 +190,24 @@ The following code example illustrates how to remove files from an existing PDF
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Portfolio/Remove-the-files-from-PDF-portfolio/.NET/Remove-the-files-from-PDF-portfolio/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Sample.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Remove the file from the Portfolio
document.Attachments.RemoveAt(0);
-//Save and close the document
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+document.Save("Sample.pdf");
document.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Sample.pdf");
@@ -229,6 +222,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document
Dim document As New PdfLoadedDocument("Sample.pdf")
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Redaction.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Redaction.md
index 616c54d60..c9ccb547a 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Redaction.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Redaction.md
@@ -24,9 +24,13 @@ The following code example demonstrates the redaction of PDF documents from the
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Removing-sensitive-content-from-the-PDF-document/.NET/Removing-sensitive-content-from-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load the existing PDF document
-FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the first page from the document
PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;
@@ -37,17 +41,19 @@ page.AddRedaction(redaction);
//Redact the contents from the PDF document
document.Redact();
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document
-document.Save(stream);
-//Close the document
+//Save and close the PDF document
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load a PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get first page from the document
@@ -66,6 +72,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Redaction
+
'Load a PDF document
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get first page from the document
@@ -96,9 +107,14 @@ The following code example explains how to add overlay text in the redacted area
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Display-text-on-the-redacted-area/.NET/Display-text-on-the-redacted-area/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load the existing PDF document
-FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the first page from the document
PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;
@@ -113,17 +129,20 @@ page.AddRedaction(redaction);
//Redact the contents from the PDF document
document.Redact();
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document
-document.Save(stream);
-//Close the document
+//Save and close the PDF document
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load a PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get first page from the document
@@ -146,6 +165,12 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Redaction
+
'Load a PDF document
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get first page from the document
@@ -180,9 +205,14 @@ The following code example explains how to redact the information from a page by
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Draw-image-on-the-redacted-area-in-PDF-document/.NET/Draw-image-on-the-redacted-area-in-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load the existing PDF document
-FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the first page from the document
PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;
@@ -196,17 +226,20 @@ page.AddRedaction(redaction);
//Redact the contents from the PDF document
document.Redact();
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document
-document.Save(stream);
-//Close the document
+//Save and close the PDF document
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load a PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get first page from the document
@@ -228,6 +261,12 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Redaction
+
'Load a PDF document
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get first page from the document
@@ -261,9 +300,14 @@ The following code example explains how to redact the information from a page by
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Draw-pattern-on-the-redacted-area-in-PDF-document/.NET/Draw-pattern-on-the-redacted-area-in-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load the existing PDF document
-FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the first page from the document
PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;
@@ -299,17 +343,19 @@ page.AddRedaction(redaction);
//Redact the contents from the PDF document
document.Redact();
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the documents
-document.Save(stream);
-//Close the documents
+//Save and close the PDF document
+document.Save("Output.pdf");
document.Close(true);
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load a PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get first page from the document
@@ -354,6 +400,12 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Redaction
+
'Load a PDF document
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get first page from the document
@@ -410,9 +462,13 @@ The following code example explains how to redact the information from a page wi
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Fill-color-on-the-redacted-area-in-a-PDF/.NET/Fill-color-on-the-redacted-area-in-a-PDF/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load the existing PDF document
-FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the first page from the document
PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;
@@ -425,17 +481,19 @@ page.AddRedaction(redaction);
//Redact the contents from the PDF document
document.Redact();
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document
-document.Save(stream);
-//Close the document
+//Save and close the PDF document
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load a PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get first page from the document
@@ -456,6 +514,12 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Redaction
+
'Load a PDF document
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get first page from the document
@@ -488,9 +552,13 @@ The following code snippet explains how to redact the information from a page wi
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Redaction-without-fill-color-and-appearance/.NET/Redaction-without-fill-color-and-appearance/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load the existing PDF document
-FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the first page from the document
PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;
@@ -502,17 +570,19 @@ page.AddRedaction(redaction);
//Redact the contents from the PDF document
document.Redact();
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document
-document.Save(stream);
-//Close the document
+//Save and close the PDF document
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load a PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get first page from the document
@@ -531,6 +601,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Redaction
+
'Load a PDF document
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get first page from the document
@@ -561,6 +636,11 @@ The following code example demonstrates how to apply a appearance fill color to
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Redaction-fill-color-customization/.NET/Redaction-fill-color-customization/Program.cs" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf;
+using Syncfusion.Drawing;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -593,16 +673,19 @@ annot.SetAppearance(true);
//Add the annotation to the page
page.Annotations.Add(annot);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the document.
+//Save and close the PDF document
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf;
+using Syncfusion.Drawing;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -644,6 +727,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf
+Imports System.Drawing
+
' Create a new PDF document
Dim document As PdfDocument = New PdfDocument()
' Create a new page
@@ -696,9 +784,13 @@ The code snippet to illustrate the same is given below.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Get-the-redaction-progress-from-PDF-document/.NET/Get-the-redaction-progress-from-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load an existing PDF document
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the first page
PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -708,11 +800,8 @@ PdfRedaction redaction = new PdfRedaction(new RectangleF(37, 94, 50, 10), System
page.AddRedaction(redaction);
loadedDocument.RedactionProgress += redaction_TrackProgress;
-//Create the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-loadedDocument.Save(stream);
-//Close the document
+//Save and close the PDF document
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
//Event handler for Track redaction process
@@ -725,6 +814,11 @@ void redaction_TrackProgress(object sender, RedactionProgressEventArgs arguments
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load a PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Load the first page
@@ -751,6 +845,11 @@ MessageBox.Show(String.Format("Redaction Process " + arguments.Progress + " % co
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Redaction
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Load the first page
@@ -763,8 +862,7 @@ page.Redactions.Add(redaction)
loadedDocument.RedactionProgress += redaction_TrackProgress
'Save the document
-Dim stream As New MemoryStream()
-loadedDocument.Save(stream)
+loadedDocument.Save("Output.pdf")
'Close the document
loadedDocument.Close(True)
@@ -786,9 +884,13 @@ Using [PdfRedactionResult](https://help.syncfusion.com/cr/document-processing/Sy
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Get-the-result-of-redaction-with-other-information/.NET/Get-the-result-of-redaction-with-other-information/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load an existing PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the first page.
PdfLoadedPage page = loadedDocument.Pages[0];
@@ -807,17 +909,19 @@ else
Console.WriteLine("Content not redacted properly...");
}
-//Create the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-loadedDocument.Save(stream);
-//Close the document
+//Save and close the PDF document
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load an existing PDF document
PdfLoadedDocument lDoc = new PdfLoadedDocument("input.pdf");
//Load the first page
@@ -847,6 +951,11 @@ lDoc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Redaction
+
'Load an existing PDF
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Load the first page
@@ -868,8 +977,7 @@ End If
Next
'Save the document
-Dim stream As New MemoryStream()
-loadedDocument.Save(stream)
+loadedDocument.Save("Output.pdf")
'Close the document
loadedDocument.Close(True)
@@ -889,9 +997,13 @@ The code snippet to illustrate the same is given below.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Redact-text-content-alone-on-the-redated-area/.NET/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load an existing PDF document
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
PdfRedaction redaction = new PdfRedaction(new RectangleF(150, 150, 60, 24), Color.Transparent);
//Only the text within the redaction bounds should be redacted.
redaction.TextOnly = true;
@@ -900,17 +1012,18 @@ foreach (PdfLoadedPage loadedPage in document.Pages)
loadedPage.AddRedaction(redaction);
}
document.Redact();
-//Create the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into stream
-loadedDocument.Save(stream);
-//Close the document
+//Save and close the PDF document
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Redaction;
+
//Load a PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
PdfRedaction redaction = new PdfRedaction(new RectangleF(150, 150, 60, 24), Color.Transparent);
@@ -930,6 +1043,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Redaction
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Create PDF redaction for the page
@@ -940,8 +1058,7 @@ For Each loadedPage As PdfLoadedPage In document.Pages
Next
document.Redact()
'Save the document
-Dim stream As New MemoryStream()
-loadedDocument.Save(stream)
+loadedDocument.Save("Output.pdf")
'Close the document
loadedDocument.Close(True)
@@ -962,11 +1079,13 @@ The following code snippet explains how to find text by regular expression patte
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Redaction/Find-text-by-regular-expression-pattern-and-redact-it-from-PDF-document/.NET/Find_text_by_regular_expression/Program.cs" %}
- //Create stream from an existing PDF document.
- FileStream docStream = new FileStream(Path.GetFullPath("Input.pdf"), FileMode.Open, FileAccess.Read);
+ using Syncfusion.Pdf.Parsing;
+ using Syncfusion.Pdf.Redaction;
+ using Syncfusion.Pdf;
+ using System.Text.RegularExpressions;
//Load the existing PDF document.
- PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the first page from the document.
PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;
@@ -1001,17 +1120,19 @@ The following code snippet explains how to find text by regular expression patte
//Redact the contents from the PDF document.
document.Redact();
- //Creating the stream object
- MemoryStream stream = new MemoryStream();
- //Save the document
- document.Save(stream);
- //Close the document
+ //Save and close the PDF document
+ document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+ using Syncfusion.Pdf.Parsing;
+ using Syncfusion.Pdf.Redaction;
+ using Syncfusion.Pdf;
+ using System.Text.RegularExpressions;
+
//Load a PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
@@ -1052,11 +1173,13 @@ The following code snippet explains how to find text by regular expression patte
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create stream from an existing PDF document.
- Dim docStream As New FileStream(Path.GetFullPath("Input.pdf"), FileMode.Open, FileAccess.Read)
+ Imports Syncfusion.Pdf.Parsing
+ Imports Syncfusion.Pdf.Redaction
+ Imports Syncfusion.Pdf
+ Imports System.Text.RegularExpressions
'Load the existing PDF document.
- Dim document As New PdfLoadedDocument(docStream)
+ Dim document As New PdfLoadedDocument("Input.pdf")
'Get the first page from the document.
Dim page As PdfLoadedPage = TryCast(document.Pages(0), PdfLoadedPage)
@@ -1087,10 +1210,8 @@ The following code snippet explains how to find text by regular expression patte
'Redact the contents from the PDF document.
document.Redact()
- 'Creating the stream object
- Dim stream As New MemoryStream()
'Save the document
- document.Save(stream)
+ document.Save("Output.pdf")
'Close the document
document.Close(True)
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Security.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Security.md
index 6947d09c0..c4f7837f2 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Security.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Security.md
@@ -26,6 +26,11 @@ User password: Prevents people from opening or viewing a PDF document. Once the
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Encrypt-PDF-with-RC4-using-user-password/.NET/Encrypt-PDF-with-RC4-using-user-password/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -46,16 +51,19 @@ security.UserPassword = "password";
//Draw the text.
graphics.DrawString("Encrypted with RC4 128bit", font, brush, new PointF(0, 40));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -84,6 +92,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -124,6 +137,11 @@ Owner password: Sets PDF document restrictions, which can include printing, cont
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Encrypt-PDF-with-RC4-using-owner-password/.NET/Encrypt-PDF-with-RC4-using-owner-password/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -147,16 +165,19 @@ security.UserPassword = "password";
//Draw the text.
graphics.DrawString("This document is protected with owner password", font, brush, new PointF(0, 40));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -188,6 +209,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -229,6 +255,11 @@ You can encrypt PDF document by specifying the [Algorithm](https://help.syncfusi
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Encrypt-PDF-with-AES-using-user-password/.NET/Encrypt-PDF-with-AES-using-user-password/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -249,16 +280,19 @@ security.UserPassword = "password";
//Draw the text.
graphics.DrawString("Encrypted with AES 256bit", font, brush, new PointF(0, 40));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -287,6 +321,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -323,6 +362,11 @@ You can protect the PDF document from printing, editing, copying with the [Owner
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Encrypt-PDF-with-AES-using-owner-password/.NET/Encrypt-PDF-with-AES-using-owner-password/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -346,16 +390,19 @@ security.UserPassword = "password";
//Draw the text.
graphics.DrawString("This document is protected with owner password", font, brush, new PointF(0, 40));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -387,6 +434,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -432,6 +484,11 @@ Refer to the following code example for further details.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Secure_data%20_with%20_AES_GCM/.NET/Secure_data%20_with%20_AES_GCM/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
@@ -461,17 +518,19 @@ security.Algorithm = PdfEncryptionAlgorithm.AESGCM;
security.OwnerPassword = "ownerPassword";
security.UserPassword = "userPassword";
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
@@ -510,6 +569,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
' Create a new PDF document
Dim document As PdfDocument = New PdfDocument()
@@ -570,6 +634,11 @@ You can encrypt all the PDF content by specifying the [EncryptionOptions](https:
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Encrypt-all-contents-of-the-PDF-document/.NET/Encrypt-all-contents-of-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -592,16 +661,19 @@ security.UserPassword = "password";
//Draw the text.
graphics.DrawString("Encrypted with AES 256bit", font, brush, new PointF(0, 40));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -632,6 +704,11 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -676,6 +753,11 @@ N> Encrypt all contents except metadata is only supported in AES algorithms wit
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Encrypt-all-contents-except-metadata-of-the-PDF/.NET/Encrypt-all-contents-except-metadata-of-the-PDF/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -698,16 +780,19 @@ security.UserPassword = "password";
//Draw the text.
graphics.DrawString("Encrypted all contents except metadata with AES 256bit", font, brush, new PointF(0, 40));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the document.
-document.Close(true);
+//Save and close the document.
+document.Save("Output.pdf");
+document.Close();
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -738,6 +823,11 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -782,6 +872,11 @@ N> [UserPassword](https://help.syncfusion.com/cr/document-processing/Syncfusion.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Encrypt-only-attachment-in-the-PDF-document/.NET/Encrypt-only-attachment-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -812,16 +907,19 @@ attachment.MimeType = "application/txt";
//Add the attachment to the document.
document.Attachments.Add(attachment);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Security;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -860,6 +958,11 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Security
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -908,61 +1011,64 @@ The following code example demonstrates how to decrypt a PDF document and restor
{% tabs %}
-{% highlight c# tabtitle="C# [Cross-platform]" %}
+{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Decrypting-encrypted-PDF-document/.NET/Decrypting-encrypted-PDF-document/Program.cs" %}
-using (FileStream inputStream = new FileStream(@"Data/Input.pdf", FileMode.Open, FileAccess.Read))
-{
- // Load the encrypted PDF document from the input stream
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream, "syncfusion");
-
- // Set the document permissions to default (removes any restrictions)
- loadedDocument.Security.Permissions = PdfPermissionsFlags.Default;
-
- // Clear the owner and user passwords to decrypt the document
- loadedDocument.Security.OwnerPassword = string.Empty;
- loadedDocument.Security.UserPassword = string.Empty;
-
- using (FileStream outputStream = new FileStream(@"Output/Output.pdf", FileMode.Create, FileAccess.Write))
- {
- // Save the decrypted PDF document to the output stream
- loadedDocument.Save(outputStream);
- }
- // Close the loaded PDF document and release resources
- loadedDocument.Close(true);
-}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
+ // Load the encrypted PDF document from the input stream
+ PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf", "syncfusion");
+
+ // Set the document permissions to default (removes any restrictions)
+ loadedDocument.Security.Permissions = PdfPermissionsFlags.Default;
+
+ // Clear the owner and user passwords to decrypt the document
+ loadedDocument.Security.OwnerPassword = string.Empty;
+ loadedDocument.Security.UserPassword = string.Empty;
+
+ //Save and close the document.
+ loadedDocument.Save("Output.pdf");
+ loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
-using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
-{
- // Load the encrypted PDF document from the input stream
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream, "syncfusion");
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
- // Set the document permissions to default (removes any restrictions)
- loadedDocument.Security.Permissions = PdfPermissionsFlags.Default;
+ // Load the encrypted PDF document from the input stream
+ PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf", "syncfusion");
- // Clear the owner and user passwords to decrypt the document
- loadedDocument.Security.OwnerPassword = string.Empty;
- loadedDocument.Security.UserPassword = string.Empty;
+ // Set the document permissions to default (removes any restrictions)
+ loadedDocument.Security.Permissions = PdfPermissionsFlags.Default;
- // Save the decrypted PDF document to the output stream
- loadedDocument.Save("Output.pdf");
+ // Clear the owner and user passwords to decrypt the document
+ loadedDocument.Security.OwnerPassword = string.Empty;
+ loadedDocument.Security.UserPassword = string.Empty;
- // Close the loaded PDF document and release resources
- loadedDocument.Close(true);
-}
+ //Save and close the document.
+ loadedDocument.Save("Output.pdf");
+ loadedDocument.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Open the encrypted PDF document using FileStream
-Using inputStream As New FileStream(Path.GetFullPath("Data/Input.pdf"), FileMode.Open, FileAccess.Read)
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
' Load the encrypted PDF document from the input stream with password
- Dim loadedDocument As New PdfLoadedDocument(inputStream, "syncfusion")
+ Dim loadedDocument As New PdfLoadedDocument("Input.pdf", "syncfusion")
' Set the document permissions to default (removes any restrictions)
loadedDocument.Security.Permissions = PdfPermissionsFlags.Default
@@ -977,13 +1083,11 @@ Using inputStream As New FileStream(Path.GetFullPath("Data/Input.pdf"), FileMode
' Close the loaded PDF document and release resources
loadedDocument.Close(True)
-End Using
-
{% endhighlight %}
{% endtabs %}
-You can download a complete working sample from GitHub.
+You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Security/Decrypting-encrypted-PDF-document/.NET).
## Opening an encrypt-only-attachment document
@@ -1001,11 +1105,11 @@ The following code example explains how to load an encrypt-only-attachment docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Load-an-encrypt-only-attachment-document/.NET/Load-an-encrypt-only-attachment-document/Program.cs" %}
-//Get the stream from an existing PDF document.
-FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
//Load the PDF document.
-PdfLoadedDocument document = new PdfLoadedDocument(docStream, "password");
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf", "password");
//Accessing the attachments.
foreach (PdfAttachment attachment in document.Attachments)
@@ -1022,11 +1126,11 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
-//Get the stream from an existing PDF document.
-FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
//Load the PDF document.
-PdfLoadedDocument document = new PdfLoadedDocument(docStream, "password");
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf", "password");
//Accessing the attachments.
foreach (PdfAttachment attachment in document.Attachments)
@@ -1043,11 +1147,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Get the stream from an existing PDF document.
-Dim docStream As New FileStream(Path.GetFullPath("Data/Input.pdf"), FileMode.Open, FileAccess.Read)
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Interactive
' Load the PDF document.
-Dim document As New PdfLoadedDocument(docStream, "password")
+Dim document As New PdfLoadedDocument("Input.pdf", "password")
' Accessing the attachments.
For Each attachment As PdfAttachment In document.Attachments
@@ -1073,11 +1177,11 @@ The following code example illustrates how to provide the password when accessin
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Set-user-password-when-accessing-the-attachment/.NET/Set-user-password-when-accessing-the-attachment/Program.cs" %}
-//Get stream from an existing PDF document.
-FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
//Load the PDF document.
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
document.OnPdfPassword += Document_OnPdfPassword;
@@ -1104,11 +1208,11 @@ void Document_OnPdfPassword(object sender, OnPdfPasswordEventArgs args)
{% highlight c# tabtitle="C# [Windows-specific]" %}
-//Get stream from an existing PDF document.
-FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
//Load the PDF document.
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
document.OnPdfPassword += Document_OnPdfPassword;
@@ -1135,11 +1239,11 @@ void Document_OnPdfPassword(object sender, OnPdfPasswordEventArgs args)
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Get stream from an existing PDF document.
-Dim docStream As New FileStream(Path.GetFullPath("Data/Input.pdf"), FileMode.Open, FileAccess.Read)
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Interactive
' Load the PDF document.
-Dim document As New PdfLoadedDocument(docStream)
+Dim document As New PdfLoadedDocument("Input.pdf")
' Add the event handler for PDF password.
AddHandler document.OnPdfPassword, AddressOf Document_OnPdfPassword
@@ -1175,9 +1279,11 @@ N> [UserPassword](https://help.syncfusion.com/cr/document-processing/Syncfusion.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Protect-attachments-in-existing-PDF-document/.NET/Protect-attachments-in-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//PDF document security.
PdfSecurity security = document.Security;
@@ -1189,9 +1295,8 @@ security.UserPassword = "password";
//Specifies encryption option.
security.EncryptionOptions = PdfEncryptionOptions.EncryptOnlyAttachments;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -1199,6 +1304,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
@@ -1221,6 +1329,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Load the PDF document.
Dim document As New PdfLoadedDocument("Input.pdf")
@@ -1253,9 +1364,11 @@ You can protect an existing PDF document with both [UserPassword](https://help.s
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Protect-an-existing-PDF-document/.NET/Protect-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//PDF document security.
PdfSecurity security = document.Security;
@@ -1266,16 +1379,17 @@ security.Algorithm = PdfEncryptionAlgorithm.AES;
security.OwnerPassword = "ownerPassword256";
security.UserPassword = "userPassword256";
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the document.
+//Save and close the document.
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
@@ -1297,6 +1411,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Load an existing document.
Dim document As New PdfLoadedDocument("Input.pdf")
@@ -1328,22 +1445,26 @@ You can change the [UserPassword](https://help.syncfusion.com/cr/document-proces
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Change-password-of-the-PDF-document/.NET/Change-password-of-the-PDF-document/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream, "password");
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf", "password");
//Change the user password
loadedDocument.Security.UserPassword = "NewPassword";
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Close the document
+//Save the password changed PDF document.
+loadedDocument.Save("Output.pdf");
+//Close the document.
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the password protected PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf","password");
//Change the user password.
@@ -1358,6 +1479,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Load the password protected PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf", "password")
'Change the user password
@@ -1429,22 +1553,25 @@ You can change the permission of the PDF document using the [Permissions](https:
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Change-the-permission-of-the-PDF-document/.NET/Change-the-permission-of-the-PDF-document/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream, "syncfusion");
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf", "syncfusion");
//Change the permission
loadedDocument.Security.Permissions = PdfPermissionsFlags.CopyContent | PdfPermissionsFlags.AssembleDocument;
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Close the PDF document
+//Save and Close the PDF document
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the password protected PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf", "syncfusion");
//Change the permission
@@ -1458,6 +1585,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Load the password protected PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf", "syncfusion")
'Change the permission
@@ -1481,22 +1611,25 @@ You can remove the [UserPassword](https://help.syncfusion.com/cr/document-proces
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Remove-password-from-user-password-PDF-document/.NET/Remove-password-from-user-password-PDF-document/Program.cs" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream, "password");
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf", "password");
//Change the user password
loadedDocument.Security.UserPassword = string.Empty;
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Close the document
+//Save and Close the PDF document
+loadedDocument.Save("Output.pdf");
loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Parsing;
+using Syncfusion.Pdf.Security;
+
//Load the password protected PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf","password");
//Change the user password
@@ -1511,6 +1644,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Parsing
+Imports Syncfusion.Pdf.Security
+
'Load the password protected PDF document
Dim loadedDocument As New PdfLoadedDocument("Input.pdf", "password")
'Change the user password
@@ -1535,11 +1671,13 @@ You can determine whether the existing PDF document is password protected or not
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Security/Determine-whether-the-PDF-is-protected-or-not/.NET/Determine-whether-the-PDF-is-protected-or-not/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
try
{
//Load the PDF document
- FileStream docStream = new FileStream("Output.pdf", FileMode.Open, FileAccess.Read);
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+ PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
}
catch (PdfDocumentException exception)
{
@@ -1553,6 +1691,9 @@ catch (PdfDocumentException exception)
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
try
{
//Load the password protected PDF document without user password
@@ -1570,6 +1711,9 @@ catch (PdfDocumentException exception)
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
Try
'Load the password protected PDF document without user password
Dim loadedDocument As New PdfLoadedDocument("Output.pdf")
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Shapes.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Shapes.md
index 58980f3ae..eb9d8891e 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Shapes.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Shapes.md
@@ -31,6 +31,10 @@ You can draw a polygon in PDF document by using the [DrawPolygon](https://help.s
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-polygon-in-new-PDF-document/.NET/Draw-polygon-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -50,9 +54,8 @@ PointF[] points = { p1, p2, p3, p4, p5 };
//Draw the polygon on PDF document
page.Graphics.DrawPolygon(pen, brush, points);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the PDF document
+document.Save("Output.pdf");
//Close the instance of PdfDocument
document.Close(true);
@@ -60,6 +63,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -87,6 +94,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
@@ -122,9 +133,12 @@ The following code snippet explains how to draw a polygon in an existing PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-polygon-in-an-existing-PDF-document/.NET/Draw-a-polygon-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Load the PDF document as stream
-FileStream inputStream = new FileStream("Input.pdf", FileMode.Open);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
//Initialize PdfPen to draw the polygon
@@ -141,9 +155,8 @@ PointF[] points = { p1, p2, p3, p4, p5 };
//Draw the polygon on PDF document
loadedPage.Graphics.DrawPolygon(pen, brush, points);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the PDF document
+loadedDocument.Save("Output.pdf");
//Close the instance of PdfLoadedDocument
loadedDocument.Close(true);
@@ -151,6 +164,10 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
@@ -178,6 +195,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the page into PdfLoadedPage
@@ -215,6 +236,10 @@ You can draw a line in PDF document by using the [DrawLine](https://help.syncfus
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-line-in-new-PDF-document/.NET/Draw-a-line-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -228,9 +253,8 @@ PointF point2 = new PointF(10, 100);
//Draw the line on PDF document
page.Graphics.DrawLine(pen, point1, point2);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the PDF document
+document.Save("Output.pdf");
//Close the instance of PdfDocument
document.Close(true);
@@ -238,6 +262,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -259,6 +287,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
@@ -288,12 +320,15 @@ The following code snippet explains how to draw a line in an existing PDF docume
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-line-in-an-existing-PDF-document/.NET/Draw-a-line-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document as stream
-FileStream inputStream = new FileStream("Input.pdf", FileMode.Open);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load an existing PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
-
//Initialize pen to draw the line
PdfPen pen = new PdfPen(PdfBrushes.Black, 5f);
//Create the line points
@@ -302,9 +337,8 @@ PointF point2 = new PointF(10, 100);
//Draw the line on PDF document
loadedPage.Graphics.DrawLine(pen, point1, point2);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the PDF document
+loadedDocument.Save("Output.pdf");
//Close the instance of PdfLoadedDocument
loadedDocument.Close(true);
@@ -312,6 +346,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
@@ -333,6 +372,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the page into PdfLoadedPage
@@ -365,6 +409,10 @@ You can draw a curve in PDF document by using the [Draw](https://help.syncfusion
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-curve-in-new-PDF-document/.NET/Draw-a-curve-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -377,9 +425,8 @@ PdfBezierCurve bezier = new PdfBezierCurve(new PointF(0, 0), new PointF(100, 50)
//Draw the bezier curve on PDF document
bezier.Draw(graphics, new PointF(10, 10));
-//Save the PDF document to MemoryStream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the PDF document
+document.Save("Output.pdf");
//Close the instance of PdfDocument
document.Close(true);
@@ -387,6 +434,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -408,6 +459,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
@@ -437,22 +492,25 @@ The following code snippet explains how to draw a curve in an existing PDF docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-curve-in-an-existing-PDF-document/.NET/Draw-a-curve-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document as stream
-FileStream inputStream = new FileStream("Input.pdf", FileMode.Open);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load an existing PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
//Get the graphics of PdfLoadedPage
PdfGraphics graphics = loadedPage.Graphics;
//Create new instance of PdfBezierCurve
-PdfBezierCurve bezier = new PdfBezierCurve(new PointF(0, 0), new PointF(100, 50), new PointF(50, 50), new PointF(100, 100));
+PdfBezierCurve bezier = new PdfBezierCurve(new PointF(0, 0), new PointF(100, 50), new PointF(50, 50), new PointF(100, 100));
//Draw the bezier curve on PDF document
bezier.Draw(graphics, new PointF(10, 10));
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the PDF document
+loadedDocument.Save("Output.pdf");
//Close the instance of PdfLoadedDocument
loadedDocument.Close(true);
@@ -460,6 +518,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
@@ -481,6 +544,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the page into PdfLoadedPage
@@ -512,6 +580,10 @@ You can draw a path in PDF document by using the [DrawPath](https://help.syncfus
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-path-in-a-new-PDF-document/.NET/Draw-path-in-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -527,9 +599,8 @@ path.AddLine(new PointF(100, 200), new PointF(10, 100));
//Draw the PDF path on page
page.Graphics.DrawPath(PdfPens.Black, path);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the PDF document
+document.Save("Output.pdf");
//Close the instance of PdfDocument
document.Close(true);
@@ -537,6 +608,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -561,6 +636,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
@@ -593,9 +672,13 @@ The following code snippet explains how to draw path in an existing PDF document
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-path-in-an-existing-PDF-document/.NET/Draw-path-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document as stream
-FileStream inputStream = new FileStream("Input.pdf", FileMode.Open);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load an existing PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -609,9 +692,8 @@ path.AddLine(new PointF(100, 200), new PointF(10, 100));
//Draw the PDF path on page
loadedPage.Graphics.DrawPath(PdfPens.Black, path);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the PDF document
+loadedDocument.Save("Output.pdf");
//Close the instance of PdfLoadedDocument
loadedDocument.Close(true);
@@ -619,6 +701,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
@@ -643,6 +730,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the page into PdfLoadedPage
@@ -681,6 +773,10 @@ You can draw a rectangle in PDF document by using the [DrawRectangle](https://he
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-rectangle-in-a-new-PDF-document/.NET/Draw-a-rectangle-in-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -693,9 +789,8 @@ RectangleF bounds = new RectangleF(10, 10, 100, 50);
//Draw the rectangle on PDF document
page.Graphics.DrawRectangle(brush, bounds);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the PDF document
+document.Save("Output.pdf");
//Close the instance of PdfDocument
document.Close(true);
@@ -703,6 +798,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -724,6 +823,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
@@ -753,12 +856,16 @@ The following code snippet explains how to draw a rectangle in an existing PDF d
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-rectangle-in-an-existing-PDF-document/.NET/Draw-a-rectangle-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document as stream
-FileStream inputStream = new FileStream("Input.pdf", FileMode.Open);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+//Load an existing PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
+
//Initialize PdfSolidBrush for drawing the rectangle
PdfSolidBrush brush = new PdfSolidBrush(Color.Green);
//Set the bounds for rectangle
@@ -766,9 +873,8 @@ RectangleF bounds = new RectangleF(10, 10, 100, 50);
//Draw the rectangle on PDF document
loadedPage.Graphics.DrawRectangle(brush, bounds);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the PDF document
+loadedDocument.Save("Output.pdf");
//Close the instance of PdfLoadedDocument
loadedDocument.Close(true);
@@ -776,6 +882,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
@@ -797,6 +908,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the page into PdfLoadedPage
@@ -828,6 +944,10 @@ You can draw a pie in PDF document by using the [DrawPie](https://help.syncfusio
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-pie-in-new-PDF-document/.NET/Draw-a-pie-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -842,9 +962,8 @@ RectangleF rectangle = new RectangleF(10, 50, 200, 200);
//Draw the pie on PDF document
page.Graphics.DrawPie(pen, PdfBrushes.Green, rectangle, 180, 60);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the PDF document
+document.Save("Output.pdf");
//Close the instance of PdfDocument
document.Close(true);
@@ -852,6 +971,10 @@ document.Close(true);
{% highlight c# tabtitle="C#" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -875,6 +998,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
@@ -906,9 +1033,13 @@ The following code snippet explains how to draw a pie in an existing PDF documen
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-pie-in-an-existing-PDF-document/.NET/Draw-a-pie-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document as stream
-FileStream inputStream = new FileStream("Input.pdf", FileMode.Open);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -921,16 +1052,20 @@ RectangleF rectangle = new RectangleF(10, 50, 200, 200);
//Draw the pie on PDF document
loadedPage.Graphics.DrawPie(pen, PdfBrushes.Green, rectangle, 180, 60);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Close the instance of PdfLoadedDocument
-loadedDocument.Close(true);
+//Save the PDF document
+document.Save("Output.pdf");
+//Close the instance of PdfDocument
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
@@ -954,6 +1089,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the page into PdfLoadedPage
@@ -987,6 +1127,10 @@ You can draw an arc in PDF document by using the [DrawArc](https://help.syncfusi
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-an-arc-in-new-PDF-document/.NET/Draw-an-arc-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -1000,9 +1144,8 @@ RectangleF bounds = new RectangleF(20, 40, 200, 200);
//Draw the arc on PDF document
page.Graphics.DrawArc(pen, bounds, 270, 90);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the PDF document
+document.Save("Output.pdf");
//Close the instance of PdfDocument
document.Close(true);
@@ -1010,6 +1153,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -1033,6 +1180,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
@@ -1064,9 +1215,13 @@ The following code snippet explains how to draw an arc in an existing PDF docume
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-an-arc-in-an-existing-PDF-document/.NET/Draw-an-arc-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document as stream
-FileStream inputStream = new FileStream("Input.pdf", FileMode.Open);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load an existing PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -1079,9 +1234,8 @@ RectangleF bounds = new RectangleF(20, 40, 200, 200);
//Draw the arc on PDF document
loadedPage.Graphics.DrawArc(pen, bounds, 270, 90);
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the PDF document
+loadedDocument.Save("Output.pdf");
//Close the instance of PdfLoadedDocument
loadedDocument.Close(true);
@@ -1089,6 +1243,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
@@ -1112,6 +1271,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the page into PdfLoadedPage
@@ -1145,6 +1309,10 @@ You can draw a bezier in PDF document by using the [DrawBezier](https://help.syn
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-bazier-in-new-PDF-document/.NET/Draw-a-bazier-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -1155,9 +1323,8 @@ PdfPen pen = new PdfPen(PdfBrushes.Brown, 1f);
//Draw the bezier on PDF document
page.Graphics.DrawBezier(pen, new PointF(10, 10), new PointF(10, 50), new PointF(50, 80), new PointF(80, 10));
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the PDF document
+document.Save("Output.pdf");
//Close the instance of PdfDocument
document.Close(true);
@@ -1165,6 +1332,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -1184,6 +1355,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
@@ -1211,9 +1386,13 @@ The following code snippet explains how to draw a bezier in an existing PDF docu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-a-bazier-in-an-existing-PDF-document/.NET/Draw-a-bazier-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document as stream
-FileStream inputStream = new FileStream("Input.pdf", FileMode.Open);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -1222,9 +1401,8 @@ PdfPen pen = new PdfPen(PdfBrushes.Brown, 1f);
//Draw the bezier on PDF document
loadedPage.Graphics.DrawBezier(pen, new PointF(10, 10), new PointF(10, 50), new PointF(50, 80), new PointF(80, 10));
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the PDF document
+loadedDocument.Save("Output.pdf");
//Close the instance of PdfLoadedDocument
loadedDocument.Close(true);
@@ -1232,6 +1410,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
@@ -1251,6 +1434,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the page into PdfLoadedPage
@@ -1280,6 +1468,10 @@ You can draw an ellipse in PDF document by using the [DrawEllipse](https://help.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-an-ellipse-in-new-PDF-document/.NET/Draw-an-ellipse-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -1290,9 +1482,8 @@ PdfSolidBrush brush = new PdfSolidBrush(Color.Red);
//Draw ellipse on the page
page.Graphics.DrawEllipse(brush, new RectangleF(10, 10, 200, 100));
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the PDF document
+document.Save("Output.pdf");
//Close the instance of PdfDocument
document.Close(true);
@@ -1300,6 +1491,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -1319,6 +1514,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
@@ -1346,9 +1545,13 @@ The following code snippet explains how to draw an ellipse in an existing PDF do
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-an-ellipse-in-an-existing-PDF-document/.NET/Draw-an-ellipse-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document as stream
-FileStream inputStream = new FileStream("Input.pdf", FileMode.Open);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
+//Load an existing PDF document
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -1357,9 +1560,8 @@ PdfSolidBrush brush = new PdfSolidBrush(Color.Red);
//Draw ellipse on the page
loadedPage.Graphics.DrawEllipse(brush, new RectangleF(10, 10, 200, 100));
-//Saving the PDF to the MemoryStream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the PDF document
+loadedDocument.Save("Output.pdf");
//Close the instance of PdfLoadedDocument
loadedDocument.Close(true);
@@ -1367,6 +1569,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page into PdfLoadedPage
@@ -1386,6 +1593,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the page into PdfLoadedPage
@@ -1415,6 +1627,10 @@ You can also allow large shapes to paginate across pages by assigning ```Paginat
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Draw-large-shapes-across-multiple-pages/.NET/Draw-large-shapes-across-multiple-pages/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create Document
PdfDocument doc = new PdfDocument();
//Add new page
@@ -1432,16 +1648,18 @@ ellipse.Brush = PdfBrushes.Brown;
//Draw ellipse.
ellipse.Draw(page, 20, 20, format);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-//Closes the document
+//Save and close the PDF document
+doc.Save("Shapes.pdf");
doc.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create Document
PdfDocument doc = new PdfDocument();
//Add new page
@@ -1467,6 +1685,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create Document
Dim doc As New PdfDocument()
'Add new page
@@ -1504,6 +1726,10 @@ The following code example demonstrates applying a dash pattern to a line shape.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Shapes/Dash-pattern-in-shapes/.NET/Dash-pattern-in-shapes/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
// Create a new PDF document
PdfDocument document = new PdfDocument();
// Add a page to the document
@@ -1523,12 +1749,9 @@ dashPen.DashPattern = dashPattern;
// Draw a line with the custom dash pattern
graphics.DrawLine(dashPen, new Syncfusion.Drawing.PointF(10, 10), new PointF(300, 10));
-//Create file stream.
-using (FileStream outputFileStream = new FileStream("Output/Output.pdf", FileMode.Create, FileAccess.ReadWrite))
-{
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
-}
+
+//Save the PDF document to file stream.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -1536,6 +1759,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
// Create a new PDF document
PdfDocument document = new PdfDocument();
// Add a page to the document
@@ -1565,6 +1792,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
' Create a new PDF document
Dim document As New PdfDocument()
' Add a page to the document
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Tagged-PDF.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Tagged-PDF.md
index c85b41ebc..8959a48b1 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Tagged-PDF.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Tagged-PDF.md
@@ -28,6 +28,10 @@ The following code sample explains you how to add tag for the text element in PD
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Add-tag-for-the-text-element-in-PDF-document/.NET/Add-tag-for-the-text-element-in-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates new PDF document
PdfDocument doc = new PdfDocument();
//Set the document title
@@ -53,23 +57,18 @@ element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draws text
PdfLayoutResult result = element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width, 200));
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document and dispose it
+doc.Save("Output.pdf");
doc.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates new PDF document
PdfDocument doc = new PdfDocument();
//Set the document title
@@ -103,6 +102,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Creates new PDF document
Dim doc As PdfDocument = New PdfDocument()
'Set the document title
@@ -148,6 +151,10 @@ The following code explains how to add tag for image element in PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Add-tag-for-image-element-in-PDF-document/.NET/Add-tag-for-image-element-in-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates new PDF document
PdfDocument doc = new PdfDocument();
//Set the document title
@@ -172,23 +179,18 @@ bitmap.PdfTag = imageElement;
//Draw image
bitmap.Draw(page.Graphics, new PointF(50, 20));
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document and dispose it
+doc.Save("Image.pdf");
doc.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Image.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates new PDF document
PdfDocument doc = new PdfDocument();
//Set the document title
@@ -218,6 +220,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Creates new PDF document
Dim doc As PdfDocument = New PdfDocument()
'Set the document title
@@ -259,6 +265,10 @@ The following code explains how to add tag for shape element in the PDF document
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Adding-tag-to-shape-element-in-the-PDF-document/.NET/Adding-tag-to-shape-element-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates new PDF document
PdfDocument doc = new PdfDocument();
//Set the document title
@@ -284,23 +294,18 @@ line.PdfTag = element;
//Draws the line
line.Draw(page.Graphics);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document and dispose it
+doc.Save("Output.pdf");
doc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates new PDF document
PdfDocument doc = new PdfDocument();
//Set the document title
@@ -331,6 +336,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Creates new PDF document
Dim doc As PdfDocument = New PdfDocument()
'Set the document title
@@ -373,6 +382,11 @@ The following code explains how to add tag for the form fields in PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Adding-tag-to-form-fields-in-the-PDF-document/.NET/Adding-tag-to-form-fields-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Creates new PDF document
PdfDocument doc = new PdfDocument();
//Set document information
@@ -395,23 +409,19 @@ textBoxField.ToolTip = "TextBox field";
//Add the form field to the document.
doc.Form.Fields.Add(textBoxField);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document and dispose it
+doc.Save("Output.pdf");
doc.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Creates new PDF document
PdfDocument doc = new PdfDocument();
//Set the document information
@@ -442,6 +452,11 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Interactive
+
'Creates new PDF document
Dim doc As PdfDocument = New PdfDocument()
'Set the document information
@@ -484,6 +499,10 @@ The following code explains how to add tag for the annotations in PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Adding-tag-to-annotation-in-the-PDF-document/.NET/Adding-tag-to-annotation-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Creates new PDF document
PdfDocument doc = new PdfDocument();
//Set the document title
@@ -508,23 +527,18 @@ popupAnnotation.Icon = PdfPopupIcon.NewParagraph;
//Adds this annotation to a new page
page.Annotations.Add(popupAnnotation);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document and dispose it
+doc.Save("Output.pdf");
doc.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "PopupAnnotation.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Creates new PDF document
PdfDocument doc = new PdfDocument();
//Set the document title
@@ -558,6 +572,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
'Creates new PDF document
Dim doc As PdfDocument = New PdfDocument()
'Set the document title
@@ -603,6 +621,11 @@ The following code example shows how to add tag for hyperlink in PDF document
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Add-tag-for-hyperlink-in-the-PDF-document/.NET/Add-tag-for-hyperlink-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
document.DocumentInformation.Title = "Link";
@@ -630,24 +653,21 @@ textLink.Brush = PdfBrushes.Blue;
//Draw the hyperlink in PDF page
textLink.DrawTextWebLink(page, new PointF(10, 40));
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document
+document.Save("Output.pdf");
+//Close the document
document.Close(true);
fontStream.Dispose();
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
document.DocumentInformation.Title = "Link";
@@ -685,6 +705,11 @@ fontStream.Dispose();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Interactive
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument()
document.DocumentInformation.Title = "Link"
@@ -733,6 +758,10 @@ The following code sample explains how to add tag support for the template eleme
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Add-tags-to-template-in-PDF-document/.NET/Add-tags-to-template-in-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates a new PDF document
PdfDocument pdfDocument = new PdfDocument();
pdfDocument.DocumentInformation.Title = "TemplateDocument";
@@ -760,23 +789,18 @@ template.Graphics.DrawRectangle(brush, new RectangleF(0, 30, 150, 90));
//Draw the template on the page graphics of the document
pdfPage.Graphics.DrawPdfTemplate(template, PointF.Empty);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document and dispose it
+pdfDocument.Save("Output.pdf");
pdfDocument.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates a new PDF document
PdfDocument pdfDocument = new PdfDocument();
pdfDocument.DocumentInformation.Title = "TemplateDocument";
@@ -810,6 +834,10 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Creates a new PDF document
Dim pdfDocument As PdfDocument = New PdfDocument()
pdfDocument.DocumentInformation.Title = "TemplateDocument"
@@ -857,6 +885,11 @@ The following code snippet illustrates how to add tag for table element.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Add-tags-to-table-in-the-PDF-document/.NET/Add-tags-to-table-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Grid;
+
//Creates a new PDF document
PdfDocument pdfDocument = new PdfDocument();
pdfDocument.DocumentInformation.Title = "Table";
@@ -906,23 +939,19 @@ pdfGridRow.Cells[2].PdfTag = new PdfStructureElement(PdfTagType.TableDataCell);
//Draw the PdfGrid
pdfGrid.Draw(pdfPage, PointF.Empty);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document and dispose it
+pdfDocument.Save("Output.pdf");
pdfDocument.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Grid;
+
//Creates a new PDF document
PdfDocument pdfDocument = new PdfDocument();
pdfDocument.DocumentInformation.Title = "Table";
@@ -980,6 +1009,11 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Grid
+
'Creates a new PDF document
Dim pdfDocument As PdfDocument = New PdfDocument()
pdfDocument.DocumentInformation.Title = "Table"
@@ -1049,6 +1083,10 @@ The following code example illustrates how to add tag support for list element.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Add-the-tag-to-list-element-in-PDF-document/.NET/Add-the-tag-to-list-element-in-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Sets document title
@@ -1092,23 +1130,18 @@ for (int i = 0; i < products.Length; i++)
//Draw the list
pdfList.Draw(page, new RectangleF(0, 20, size.Width, size.Height));
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save and close the document
+document.Save("Output.pdf");
document.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Sets document title
@@ -1158,6 +1191,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument()
'Sets document title
@@ -1218,6 +1255,10 @@ You can apply tags to nested list elements using the [PdfStructureElement](https
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
// Create a new PDF document
PdfDocument document = new PdfDocument();
@@ -1285,12 +1326,8 @@ mainList.Items[1].SubList = subList;
// Draw the main list, which includes the nested sublist, on the PDF
mainList.Draw(page, new RectangleF(0, 30, size.Width, size.Height));
-//Create file stream.
-using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
-{
- //Save the PDF document to file stream.
- document.Save(outputFileStream);
-}
+//Save the PDF document
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -1298,6 +1335,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
// Create a new PDF document
PdfDocument document = new PdfDocument();
@@ -1374,6 +1415,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
' Create a new PDF document
Dim document As New PdfDocument()
@@ -1465,10 +1510,14 @@ The following code sample demonstrates how to create a well-tagged PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Well-Tagged-PDF/.NET/Well-Tagged-PDF/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A4);
-//Set Pdf File version 2.0
+//Set PDF File version 2.0
document.FileStructure.Version = PdfVersion.Version2_0;
//Set true to auto tag all elements in document
@@ -1499,21 +1548,23 @@ 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));
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
+//Save the document
+document.Save("Output.pdf");
//Closes the document
-document.Close(true);
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A4);
-//Set Pdf File version 2.0
+//Set PDF File version 2.0
document.FileStructure.Version = PdfVersion.Version2_0;
//Set true to auto tag all elements in document
@@ -1553,10 +1604,14 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Creates new PDF document
Dim doc As PdfDocument = New PdfDocument(PdfConformanceLevel.Pdf_A4)
-'Set Pdf File version 2.0
+'Set PDF File version 2.0
doc.FileStructure.Version = PdfVersion.Version2_0
'Set true to auto tag all elements in document
@@ -1608,10 +1663,14 @@ The following code sample demonstrates how to create a PDF with Universal Access
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/PDF-for-Universal-Accessibility/.NET/PDF-for-Universal-Accessibility/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
-//Set Pdf File version 2.0
+//Set PDF File version 2.0
document.FileStructure.Version = PdfVersion.Version2_0;
//Set true to auto tag all elements in document
@@ -1640,21 +1699,23 @@ 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));
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
+//Save the document
+document.Save("Output.pdf");
//Closes the document
-document.Close(true);
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
-//Set Pdf File version 2.0
+//Set PDF File version 2.0
document.FileStructure.Version = PdfVersion.Version2_0;
//Set true to auto tag all elements in document
@@ -1692,10 +1753,14 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Creates new PDF document
Dim doc As PdfDocument = New PdfDocument()
-'Set Pdf File version 2.0
+'Set PDF File version 2.0
doc.FileStructure.Version = PdfVersion.Version2_0
'Set true to auto tag all elements in document
@@ -1745,6 +1810,10 @@ The following code explains how to add tag for header and footers in the PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Add-tags-for-header-and-footer-in-the-PDF-document/.NET/Add-tags-for-header-and-footer-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates new PDF document
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document
@@ -1786,23 +1855,18 @@ compositeField.Draw(footer.Graphics, new PointF(470, 40));
//Add the footer template at the bottom
pdfDocument.Template.Bottom = footer;
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document and dispose it
+pdfDocument.Save("HeaderFooter.pdf");
pdfDocument.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "HeaderFooter.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates new PDF document
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document
@@ -1850,6 +1914,10 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Creates new PDF document
Dim pdfDocument As PdfDocument = New PdfDocument()
'Add a page to the PDF document
@@ -1909,6 +1977,10 @@ The following code example illustrates how to order the tagged elements in a PDF
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Order-the-tagged-elements-in-a-PDF-document/.NET/Order-the-tagged-elements-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Sets document title
@@ -1951,23 +2023,18 @@ element2.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
element2.PdfTag = paraStruct2;
element2.Draw(page.Graphics, new PointF(0, 100));
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document and dispose it
+document.Save("Output.pdf");
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Sets document title
@@ -2019,6 +2086,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument()
'Sets document title
@@ -2083,6 +2154,10 @@ N> Enabling the auto-tag feature will never add alternate texts/descriptions for
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Auto-tag-the-elements-in-a-PDF-document/.NET/Auto-tag-the-elements-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates new PDF document
PdfDocument document = new PdfDocument();
//Set true to auto tag all elements in document
@@ -2106,23 +2181,18 @@ PdfTextElement element2 = new PdfTextElement("This is paragraph THREE.", new Pdf
element2.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
element2.Draw(page.Graphics, new PointF(0, 100));
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document and dispose it
+document.Save("Output.pdf");
document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "AutoTag.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates new PDF document
PdfDocument document = new PdfDocument();
//Set true to auto tag all elements in document
@@ -2154,6 +2224,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Creates new PDF document
Dim document As PdfDocument = New PdfDocument()
'Set true to auto tag all elements in document
@@ -2212,10 +2286,12 @@ The following code sample shows how to preserve document structured tags in the
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Converting-word-document-to-Tagged-PDF/.NET/Converting-word-document-to-Tagged-PDF/Program.cs" %}
-//Open the file as Stream
-FileStream docStream = new FileStream(@"D:\Template.docx", FileMode.Open, FileAccess.Read);
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocIORenderer;
+using Syncfusion.Pdf;
+
//Loads file stream into Word document
-WordDocument wordDocument = new WordDocument(docStream, Syncfusion.DocIO.FormatType.Automatic);
+WordDocument wordDocument = new WordDocument("Template.docx", Syncfusion.DocIO.FormatType.Automatic);
//Instantiation of DocIORenderer for Word to PDF conversion
DocIORenderer render = new DocIORenderer();
@@ -2225,19 +2301,20 @@ render.Settings.AutoTag = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
-//Releases all resources used by the Word document and DocIO Renderer objects
-render.Dispose();
-wordDocument.Dispose();
-//Saves the PDF file
-MemoryStream outputStream = new MemoryStream();
-pdfDocument.Save(outputStream);
-//Closes the instance of PDF document object
-pdfDocument.Close();
+//Saves the PDF file to file system
+pdfDocument.Save("WordtoPDF.pdf");
+//Closes the instance of document objects
+pdfDocument.Close(true);
+wordDocument.Close();
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.DocIO.DLS;
+using Syncfusion.DocIORenderer;
+using Syncfusion.Pdf;
+
//Loads an existing Word document
WordDocument wordDocument = new WordDocument("Sample.docx", FormatType.Docx);
@@ -2259,6 +2336,10 @@ wordDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.DocIO.DLS
+Imports Syncfusion.DocIORenderer
+Imports Syncfusion.Pdf
+
'Loads an existing Word document
Dim wordDocument As New WordDocument("Sample.docx", FormatType.Docx)
@@ -2304,6 +2385,10 @@ The following code sample demonstrates how to create custom role mapping documen
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Tagged%20PDF/Custom-Role-Mapping/.NET/Custom-Role-Mapping/Program.cs" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using Syncfusion.Drawing;
+
// Create a new PDF document
PdfDocument doc = new PdfDocument();
@@ -2344,10 +2429,8 @@ element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
// Draw text on the page
PdfLayoutResult result = element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width, 200));
-// Save the document into a memory stream (Cross-platform compatibility)
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-stream.Position = 0; // Reset stream position for further processing if needed
+// Save the document
+doc.Save("Output.pdf");
// Close the document to release resources
doc.Close(true);
@@ -2355,6 +2438,10 @@ doc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using System.Drawing;
+
// Create a new PDF document
PdfDocument doc = new PdfDocument();
@@ -2405,6 +2492,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
' Create a new PDF document
Dim doc As New PdfDocument()
@@ -2464,10 +2555,13 @@ You can extract the existing tag details by using the [StructureElement](https:/
{% highlight c# tabtitle="C# [Cross-platform]" %}
-//Get the stream from the document.
-FileStream documentStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using System.Drawing;
+
//Load the existing PDF document.
-PdfLoadedDocument document = new PdfLoadedDocument(documentStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the structure element root from the document.
PdfStructureElement rootElement = document.StructureElement;
//Get the child elements for the element.
@@ -2493,6 +2587,11 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using System.Drawing;
+
//Load the existing PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the structure element root from the document.
@@ -2522,6 +2621,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load the existing PDF document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the structure element root from the document.
@@ -2557,10 +2661,13 @@ You can also extract the accessibility tags page-wise with the help of the [Stru
{% highlight c# tabtitle="C# [Cross-platform]" %}
-//Get the stream from the document.
-FileStream documentStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using System.Drawing;
+
//Load the existing PDF document.
-PdfLoadedDocument document = new PdfLoadedDocument(documentStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the first page from the document.
PdfLoadedPage loadedPage = document.Pages[0] as PdfLoadedPage;
//Get the structure elements associated with the page.
@@ -2590,6 +2697,11 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+using System.Drawing;
+
//Load the existing PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the first page from the document.
@@ -2622,6 +2734,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+
'Load the existing PDF document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Get the first page from the document.
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Text-Extraction.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Text-Extraction.md
index 2c4e45eef..5f0638fb1 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Text-Extraction.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Text-Extraction.md
@@ -22,10 +22,11 @@ The following code snippet explains how to extract the texts from a page.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text%20Extraction/Extract-the-texts-from-a-page-in-the-PDF-document/.NET/Extract-the-texts-from-a-page-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Sample.pdf", FileMode.Open, FileAccess.Read);
-//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the first page.
PdfPageBase page = loadedDocument.Pages[0];
@@ -38,8 +39,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the first page.
PdfPageBase page = loadedDocument.Pages[0];
@@ -52,8 +56,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Load the first page.
Dim page As PdfPageBase = loadedDocument.Pages(0)
@@ -78,10 +85,11 @@ The below code illustrates how to extract the text from entire PDF document:
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text%20Extraction/Extract-text-from-the-entire-PDF-document/.NET/Extract-text-from-the-entire-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Sample.pdf", FileMode.Open, FileAccess.Read);
-//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Loading page collections
PdfLoadedPageCollection loadedPages = loadedDocument.Pages;
@@ -98,8 +106,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
// Load an existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Loading page collections
PdfLoadedPageCollection loadedPages = loadedDocument.Pages;
@@ -116,8 +127,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
' Load an existing PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
' Loading page collections
Dim loadedPages As PdfLoadedPageCollection = loadedDocument.Pages
@@ -145,10 +159,11 @@ Please refer the following code snippet to extract the text with layout.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text%20Extraction/Extract-the-text-with-layout-in-a-PDF-document/.NET/Extract-the-text-with-layout-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Sample.pdf", FileMode.Open, FileAccess.Read);
-//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load first page.
PdfPageBase page = loadedDocument.Pages[0];
@@ -157,9 +172,8 @@ string extractedTexts = page.ExtractText(true);
//Close the document.
loadedDocument.Close(true);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document
+loadedDocument.Save("Output.pdf");
//Closes the document
loadedDocument.Close(true);
@@ -167,8 +181,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load first page.
PdfPageBase page = loadedDocument.Pages[0];
@@ -181,15 +198,20 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-//Load an existing PDF.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
-//Load first page.
-PdfPageBase page = loadedDocument.Pages[0];
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
-//Extract text from first page.
-string extractedTexts = page.ExtractText(true);
-//close the document
-loadedDocument.Close(true);
+' Load an existing PDF
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
+
+' Load the first page
+Dim page As PdfPageBase = loadedDocument.Pages(0)
+
+' Extract text from the first page
+Dim extractedTexts As String = page.ExtractText(True)
+
+' Close the document
+loadedDocument.Close(True)
{% endhighlight %}
@@ -211,8 +233,11 @@ You can get the line and its properties that contains texts by using [TextLine](
//PDF supports getting the lines and its properties using TextLine only in WinForms, WPF and Xamarin platforms. Instead of TextLine, TextLineCollection can be used in ASP.NET Core.
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
// Load the existing PDF document
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Get the first page of the loaded PDF document
PdfPageBase page = loadedDocument.Pages[0];
var lineCollection = new TextLineCollection();
@@ -232,8 +257,11 @@ foreach (var line in lineCollection.TextLine)
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
// Load the existing PDF document
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Get the first page of the loaded PDF document
PdfPageBase page = loadedDocument.Pages[0];
TextLines lineCollection = new TextLines();
@@ -250,8 +278,12 @@ string text = line.Text;
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
' Load the existing PDF document
-Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument(fileName)
+Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
' Get the first page of the loaded PDF document
Dim page As PdfPageBase = loadedDocument.Pages(0)
Dim lineCollection As TextLines = New TextLines()
@@ -281,8 +313,12 @@ You can get the single word and its properties by using [TextWord](https://help.
//PDF supports getting the word and its properties using TextWord only in WinForms, WPF and Xamarin platforms. Instead of TextLine, TextLineCollection can be used in ASP.NET Core.
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
// Load the existing PDF document
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Get the first page of the loaded PDF document
PdfPageBase page = loadedDocument.Pages[0];
var lineCollection = new TextLineCollection();
@@ -304,8 +340,12 @@ foreach (var line in lineCollection.TextLine)
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
// Load the existing PDF document
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Get the first page of the loaded PDF document
PdfPageBase page = loadedDocument.Pages[0];
TextLines lineCollection = new TextLines();
@@ -325,8 +365,12 @@ List textWordCollection = line.WordCollection;
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+Imports System.Drawing
+
' Load the existing PDF document
-Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument(fileName)
+Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
' Get the first page of the loaded PDF document
Dim page As PdfPageBase = loadedDocument.Pages(0)
Dim lineCollection As TextLines = New TextLines()
@@ -356,8 +400,12 @@ You can retrieve a single character and its properties, including bounds, font n
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text%20Extraction/Get-text-glyph-details-from-extract-text/.NET/Get-text-glyph-details-from-extract-text/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
// Load the existing PDF document
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Get the first page of the loaded PDF document
PdfPageBase page = loadedDocument.Pages[0];
TextLineCollection lineCollection = new TextLineCollection();
@@ -393,8 +441,12 @@ Color glyphColor = textGlyph.TextColor;
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+Imports System.Drawing
+
' Load the existing PDF document
-Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument(stream)
+Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
' Get the first page of the loaded PDF document
Dim page As PdfPageBase = loadedDocument.Pages(0)
Dim lineCollection As New TextLineCollection()
@@ -441,9 +493,11 @@ The code example provided below demonstrates the utilization of the [FindText](h
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Find-text-in-PDF-document/.NET/Find-text-in-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Returns page number and rectangle positions of the text maches.
Dictionary> matchRects = new Dictionary>();
loadedDocument.FindText("document", out matchRects);
@@ -454,6 +508,9 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Returns page number and rectangle positions of the text maches.
@@ -466,6 +523,9 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Parsing
+
'Load an existing PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Input.pdf")
'Returns page number and rectangle positions of the text maches.
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Text.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Text.md
index 864810cdb..18c4d8516 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Text.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Text.md
@@ -20,6 +20,10 @@ You can add text in the new PDF document by using [DrawString](https://help.sync
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Drawing-text-in-a-new-PDF-document/.NET/Drawing-text-in-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -32,17 +36,18 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream.
-document.Save(stream);
-//Close the document.
+//Save the document and dispose it
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -64,6 +69,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -98,6 +107,10 @@ Please refer to the below code example to understand how to save and restore the
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/refs/heads/master/Text/Saving-and-Restoring-the-PdfGraphics/.NET/Saving-and-Restoring-the-PdfGraphics/Saving-and-Restoring-the-PdfGraphics/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
// Create a new PDF document
using (PdfDocument pdfDocument = new PdfDocument())
{
@@ -116,11 +129,8 @@ using (PdfDocument pdfDocument = new PdfDocument())
graphics.Restore();
// Draw text that is not influenced by transformations
graphics.DrawString("This text is not rotated.", font, PdfBrushes.Black, new PointF(0, 100));
- using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
- {
- //Save the PDF document to file stream.
- pdfDocument.Save(outputFileStream);
- }
+ // Save the document to a file
+ pdfDocument.Save("Output.pdf");
}
@@ -128,6 +138,10 @@ using (PdfDocument pdfDocument = new PdfDocument())
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
// Create a new PDF document
using (PdfDocument pdfDocument = new PdfDocument())
{
@@ -153,6 +167,11 @@ using (PdfDocument pdfDocument = new PdfDocument())
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+ Imports Syncfusion.Pdf
+ Imports Syncfusion.Pdf.Graphics
+ Imports System.Drawing
+
' Create a PDF document
Using pdfDocument As New PdfDocument()
' Add Pages to the document
@@ -171,8 +190,9 @@ using (PdfDocument pdfDocument = new PdfDocument())
graphics.Restore()
' Draw text that is not influenced by transformations
graphics.DrawString("This text is not rotated.", font, PdfBrushes.Black, New PointF(0, 100))
- ' Save the document to a file
+ ' Save and close the document to a file
pdfDocument.Save("Output.pdf")
+ pdfDocument.Close(True)
{% endhighlight %}
@@ -190,9 +210,13 @@ The following code snippet illustrates how to add text in the existing PDF docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Draw-text-in-an-existing-PDF-document/.NET/Draw-text-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument doc = new PdfLoadedDocument(docStream);
+PdfLoadedDocument doc = new PdfLoadedDocument("Input.pdf");
//Get first page from document.
PdfLoadedPage page = doc.Pages[0] as PdfLoadedPage;
//Create PDF graphics for the page.
@@ -203,10 +227,8 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream.
-doc.Save(stream);
+//Save the document.
+doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
@@ -214,6 +236,11 @@ doc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load a PDF document.
PdfLoadedDocument doc = new PdfLoadedDocument("input.pdf");
//Get first page from document.
@@ -235,6 +262,11 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+Imports Syncfusion.Pdf.Parsing
+
'Load a PDF document.
Dim doc As New PdfLoadedDocument("input.pdf")
'Get first page from document
@@ -278,6 +310,10 @@ You can add text using the standard PDF fonts, by initializing [PdfFont](https:/
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Draw-text-in-PDF-document-using-standard-fonts/.NET/Draw-text-in-PDF-document-using-standard-fonts/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -290,17 +326,18 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream.
-document.Save(stream);
-//Close the document.
+//Save the document and dispose it
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -322,6 +359,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -353,6 +394,9 @@ You can add text using the TrueType fonts installed in the system, by initializi
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -374,6 +418,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -401,6 +448,9 @@ You can add text using the font file from local file system by providing the pat
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Draw-text-in-a-PDF-using-TrueType-fonts/.NET/Draw-text-in-a-PDF-using-TrueType-fonts/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -414,17 +464,17 @@ PdfFont font = new PdfTrueTypeFont(fontStream, 14);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream.
-document.Save(stream);
-//Close the document.
+//Save the document and dispose it
+document.Save("Output.pdf");
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -446,6 +496,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -477,6 +530,9 @@ You can add text using CJK fonts, initializing [PdfFont](https://help.syncfusion
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Draw-text-in-a-PDF-using-CJK-fonts/.NET/Draw-text-in-a-PDF-using-CJK-fonts/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -489,10 +545,8 @@ PdfFont font = new PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20);
//Draw the text.
graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -500,6 +554,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -521,6 +578,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -552,6 +612,10 @@ The Essential® PDF allows you to measure the size of a string whi
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Measure-the-text-in-PDF-document/.NET/Measure-the-text-in-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create the new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -567,17 +631,19 @@ SizeF size = font.MeasureString(text);
//Draw string to th ePDF page
graphics.DrawString(text, font, PdfBrushes.Black, new RectangleF(PointF.Empty, size));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-document.Save(stream);
-//Close the document
+//Save the document.
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create the new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -602,6 +668,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create the new PDF document
Dim document As New PdfDocument()
'Add a page to the document
@@ -639,6 +709,10 @@ Refer to the following code example for further information.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Measure-tilting-space-in-PDF/.NET/Measure-tilting-space-in-PDF/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
PdfDocument document = new PdfDocument();
//Add a page to the document
PdfPage page = document.Pages.Add();
@@ -655,18 +729,20 @@ string text = "Hello World!";
SizeF size = font.MeasureString(text, format);
//Draw the text to the PDF document.
page.Graphics.DrawString(text, font, PdfBrushes.Black, new RectangleF(0, 0, size.Width, size.Height));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document as stream
-document.Save(stream);
-//Close the document
-document.Close(true);
+//Save the document.
+document.Save("Output.pdf");
+//Close the document.
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
- //Create a new PDF document
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
+//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
PdfPage page = document.Pages.Add();
@@ -690,6 +766,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create the new PDF document
Dim document As PdfDocument = New PdfDocument()
'Add a page to the document
@@ -707,9 +787,8 @@ Dim text As String = "Hello World!"
Dim size As SizeF = font.MeasureString(text, format)
'Draw the text to the PDF document.
page.Graphics.DrawString(text, font, PdfBrushes.Black, New RectangleF(0, 0, size.Width, size.Height))
-Dim stream As MemoryStream = New MemoryStream()
-Save the document as stream
-document.Save(stream)
+Save the document
+document.Save("Output.pdf")
Close the document
document.Close(True)
@@ -735,6 +814,10 @@ N> To render a Unicode text in the PDF document the chosen font should have the
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -760,6 +843,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
@@ -795,6 +882,10 @@ The Essential® PDF allows you to draw the right-to-left language
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Draw-Right-To-Left-text-in-a-PDF-document/.NET/Draw-Right-To-Left-text-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
@@ -827,10 +918,8 @@ format.Alignment = PdfTextAlignment.Left;
//Draw string with left-to-right format
graphics.DrawString(text, font, PdfBrushes.Black, new RectangleF(0, 100, page.GetClientSize().Width, page.GetClientSize().Height), format);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-doc.Save(stream);
+//Save the document
+doc.Save("Output.pdf");
//Close the document
doc.Close(true);
@@ -838,6 +927,10 @@ doc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
@@ -877,6 +970,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document
Dim doc As PdfDocument = New PdfDocument()
'Add a page to the document
@@ -977,6 +1074,10 @@ The following code example illustrates how to render the HTML string in a PDF do
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Adding-HTML-styled-text-to-PDF-document/.NET/Adding-HTML-styled-text-to-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
@@ -997,16 +1098,19 @@ format.Break = PdfLayoutBreakType.FitPage;
//Draw htmlString.
richTextElement.Draw(page, new RectangleF(0, 20, page.GetClientSize().Width, page.GetClientSize().Height), format);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-//Close the document
+//Save the document
+doc.Save("Output.pdf");
+//Close the document
doc.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
@@ -1038,6 +1142,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
@@ -1078,6 +1186,9 @@ Essential® PDF allows you to create multi-column text in PDF docu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Creating-a-multicolumn-PDF-document/.NET/Creating-a-multicolumn-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a PDF document instance
PdfDocument document = new PdfDocument();
//Add page to the document
@@ -1094,10 +1205,8 @@ textElement = new PdfTextElement(text, new PdfStandardFont(PdfFontFamily.TimesRo
//Draw the text in the second column
textElement.Draw(page, new RectangleF(page.GetClientSize().Width / 2, 0, page.GetClientSize().Width / 2, page.GetClientSize().Height));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -1105,6 +1214,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a PDF document instance
PdfDocument document = new PdfDocument();
//Add page to the document
@@ -1129,6 +1241,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a PDF document instance
Dim document As New PdfDocument()
'Add page to the document
@@ -1165,6 +1280,9 @@ The following code example demonstrates how to add elements relatively and also
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Add-text-across-multiple-pages/.NET/Add-text-across-multiple-pages/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a PDF document instance
PdfDocument document = new PdfDocument();
//Add page to the document
@@ -1188,10 +1306,8 @@ PdfLayoutResult result = textElement.Draw(page, new RectangleF(0, 0, page.GetCli
//Draw the second paragraph from the first paragraph end position
result = textElement.Draw(page, new RectangleF(0, result.Bounds.Bottom + paragraphGap, page.GetClientSize().Width / 2, page.GetClientSize().Height), layoutFormat);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -1199,6 +1315,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a PDF document instance
PdfDocument document = new PdfDocument();
//Add page to the document
@@ -1230,6 +1349,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+
'Create a PDF document instance
Dim document As New PdfDocument()
'Add page to the document
@@ -1280,6 +1402,10 @@ The following code example illustrates how to insert RTF text in PDF document.
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
@@ -1307,6 +1433,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
@@ -1345,6 +1475,10 @@ Essential® PDF allows you to create an ordered list in the docume
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Adding-an-ordered-list-to-PDF-document/.NET/Adding-an-ordered-list-to-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new instance of PdfDocument class.
PdfDocument document = new PdfDocument();
//Add a new page to the document.
@@ -1374,10 +1508,8 @@ foreach (string s in products)
}
pdfList.Draw(page, new RectangleF(0, 20, size.Width, size.Height));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -1385,6 +1517,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new instance of PdfDocument class.
PdfDocument document = new PdfDocument();
//Add a new page to the document.
@@ -1422,6 +1558,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new instance of PdfDocument class.
Dim document As New PdfDocument()
'Add a new page to the document.
@@ -1469,6 +1609,10 @@ Essential® PDF also provides support to create an unordered List
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Adding-an-unordered-list-to-PDF-document/.NET/Adding-an-unordered-list-to-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new instance of PdfDocument class.
PdfDocument document = new PdfDocument();
//Add a new page to the document.
@@ -1502,10 +1646,8 @@ list.TextIndent = 10;
//Draw list
list.Draw(page, new RectangleF(0, 10, size.Width, size.Height));
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -1513,6 +1655,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new instance of PdfDocument class.
PdfDocument document = new PdfDocument();
//Add a new page to the document.
@@ -1554,6 +1700,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new instance of PdfDocument class.
Dim document As New PdfDocument()
'Add a new page to the document.
@@ -1611,6 +1761,10 @@ Essential® PDF allows you to replace the fonts in an existing PDF
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Creates a new PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Replace font
@@ -1624,6 +1778,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Creates a new PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Replace font
@@ -1653,6 +1811,9 @@ The following code snippet illustrates how to get the bound of a text from PDF d
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.PdfViewer;
+
PdfViewerControl documentViewer = new PdfViewerControl();
//Load the PDF document
documentViewer.Load("Input.pdf");
@@ -1666,6 +1827,9 @@ documentViewer.Dispose();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing;
+Imports Syncfusion.PdfViewer;
+
Dim documentViewer As New PdfViewerControl()
'Load the PDF document
documentViewer.Load("Input.pdf")
@@ -1687,6 +1851,10 @@ Essential® PDF allows you to add complex script language text in
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Drawing-complex-script-language-text-to-PDF/.NET/Drawing-complex-script-language-text-to-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
@@ -1704,16 +1872,19 @@ format.ComplexScript = true;
//Draw the text
graphics.DrawString("สวัสดีชาวโลก", pdfFont, PdfBrushes.Black, new RectangleF(0, 0, page.GetClientSize().Width, page.GetClientSize().Height), format);
-//Save the PDF document
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-//Close the PDF document
+//Save the document
+doc.Save("Output.pdf");
+//Close the document
doc.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using System.Drawing;
+
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
@@ -1740,6 +1911,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document
Dim doc As New PdfDocument()
'Add a page to the document
@@ -1774,9 +1949,12 @@ You can add the complex script language text in an existing PDF document by usin
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Add-complex-script-to-an-existing-PDF-document/.NET/Add-complex-script-to-an-existing-PDF-document/Program.cs" %}
-FileStream inputFileStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+
//Load a PDF document
-PdfLoadedDocument doc = new PdfLoadedDocument(inputFileStream);
+PdfLoadedDocument doc = new PdfLoadedDocument("Input.pdf");
//Get first page from the document
PdfLoadedPage page = doc.Pages[0] as PdfLoadedPage;
@@ -1792,16 +1970,19 @@ format.ComplexScript = true;
//Draw the text
graphics.DrawString("สวัสดีชาวโลก", pdfFont, PdfBrushes.Black, new RectangleF(0, 0, page.Size.Width, page.Size.Height), format);
-//Save the PDF document
-MemoryStream stream = new MemoryStream();
-await doc.Save(stream);
-//Close the PDF document
+//Save the document
+doc.Save("Output.pdf");
+//Close the document
doc.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using System.Drawing;
+
//Load a PDF document
PdfLoadedDocument doc = new PdfLoadedDocument("input.pdf");
//Get first page from the document
@@ -1828,6 +2009,10 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Load a PDF document
Dim doc As New PdfLoadedDocument("input.pdf")
'Get first page from the document
@@ -1864,6 +2049,10 @@ Essential® PDF supports drawing text on a PDF document with OpenT
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Draw-text-using-OpenTypeFont-in-PDF-document/.NET/Draw-text-using-OpenTypeFont-in-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page
@@ -1884,16 +2073,19 @@ RectangleF rect = new RectangleF(0, 0, clipBounds.Width, clipBounds.Height);
//Draw the text
page.Graphics.DrawString(text, font, brush, rect);
-//Save the PDF document
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the PDF document
+//Save the document.
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using System.Drawing;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -1919,6 +2111,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document
Dim document As PdfDocument = New PdfDocument
'Add a page to the document
@@ -1954,6 +2150,10 @@ The Essential® PDF allows you to draw text using a different type
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Drawing-text-with-baseline-alignment-in-a-PDF/.NET/Drawing-text-with-baseline-alignment-in-a-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page to the document
@@ -1981,23 +2181,19 @@ graphics.DrawString("Hello World!", font, PdfBrushes.Black, new PointF(0, 50), f
graphics.DrawString("Hello World!", font1, PdfBrushes.Black, new PointF(65, 50), format);
graphics.DrawString("Hello World!", font2, PdfBrushes.Black, new PointF(220, 50), format);
graphics.DrawString("Hello World!", font3, PdfBrushes.Black, new PointF(320, 50), format);
-//Save the PDF document
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
-//Close the PDF document
-doc.Close(true);
-
-//Defining the content type for PDF file.
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Output.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
+//Save the document
+doc.Save("Output.pdf");
+//Close the document
+doc.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using System.Drawing;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -2032,6 +2228,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document
Dim document As New PdfDocument()
'Add a page to the document
@@ -2078,6 +2278,10 @@ The following code sample explains this.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -2099,19 +2303,19 @@ graphics.DrawRectangle(PdfPens.Black, new RectangleF(10, 10, 200, 20));
//Draw the text
graphics.DrawString("Right-Alignment", font, PdfBrushes.Red, new RectangleF(10, 10, 200, 20), format);
-//Create a file stream to save the document
-using (FileStream fs = new FileStream("Output.pdf", FileMode.Create, FileAccess.Write))
-{
- //Save the document to the file stream
- document.Save(fs);
-}
-//Close the document
+//Save the document.
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using System.Drawing;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
@@ -2143,6 +2347,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document
Dim document As New PdfDocument()
'Add a page to the document
@@ -2186,6 +2394,10 @@ N>To enable this functionality in .NET Core, ensure that the following encoding
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Add-text-encoding-using-standard-PDF-fonts/.NET/Add-text-encoding-using-standard-PDF-fonts/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Adding a new page to the PDF document
@@ -2200,10 +2412,8 @@ font.SetTextEncoding(Encoding.GetEncoding("Windows-1250"));
//Draw string to a PDF page.
graphics.DrawString("äÖíßĆŇ", font, PdfBrushes.Black, PointF.Empty);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into stream.
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -2211,6 +2421,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using System.Drawing;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Adding a new page to the PDF document.
@@ -2234,6 +2448,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Adding a new page to the PDF document.
@@ -2269,6 +2487,10 @@ The following code example demonstrates how to access the remainder text when th
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+
// Create a new PDF document
PdfDocument document = new PdfDocument();
@@ -2311,6 +2533,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using System.Drawing;
+
// Create a new PDF document
PdfDocument document = new PdfDocument();
@@ -2353,6 +2579,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
' Create a new PDF document
Dim document As New PdfDocument()
@@ -2406,6 +2636,10 @@ The following code example illustrates this.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Customizing-truetype-fonts-in-a-PDF/.NET/Customizing-truetype-fonts-in-a-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Drawing;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -2417,11 +2651,11 @@ FileStream fontStream = new FileStream("Arial.ttf", FileMode.Open, FileAccess.Re
// Initialize the PdfFontSettings
PdfFontSettings fontSettings = new PdfFontSettings(10, PdfFontStyle.Bold, true, true, true);
PdfFont pdfFont = new PdfTrueTypeFont(fontStream, fontSettings);
-//Draw the text. graphics.DrawString("Hello World!!!", pdfFont, PdfBrushes.Black, new PointF(0, 0));
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document into stream.
-document.Save(stream);
+//Draw the text.
+graphics.DrawString("Hello World!!!", pdfFont, PdfBrushes.Black, new PointF(0, 0));
+
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -2429,6 +2663,10 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using System.Drawing;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
@@ -2438,7 +2676,8 @@ PdfGraphics graphics = page.Graphics;
// Initialize the PdfFontSettings
PdfFontSettings fontSettings = new PdfFontSettings(10, PdfFontStyle.Bold, true, true, true);
PdfFont pdfFont = new PdfTrueTypeFont(new Font("Arial"), fontSettings);
-//Draw the text. graphics.DrawString("Hello World!!!", pdfFont, PdfBrushes.Black, new PointF(0, 0));
+//Draw the text.
+graphics.DrawString("Hello World!!!", pdfFont, PdfBrushes.Black, new PointF(0, 0));
//Save the document.
document.Save("Output.pdf");
//Close the document.
@@ -2448,6 +2687,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument
'Add a page to the document.
@@ -2476,7 +2719,6 @@ You can download a complete working sample from [GitHub](https://github.com/Sync
**LineLimit:** When LineLimit is enabled, the provided string will be laid out within the specified bounds. If the LineLimit property is disabled, the layout will continue to fill any remaining space. The default value of the LineLimit property is true.
-
**NoClip:** If we enable the NoClip option, it will show the text without cutting any words. If we disable the NoClip option, any text outside the fitting area will be hidden.
The following code example illustrates this.
@@ -2485,6 +2727,10 @@ The following code example illustrates this.
{% highlight c# tabtitle="C# [Cross-platform]" %}
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Graphics;
+ using Syncfusion.Drawing;
+
// Create a new PdfStringFormat and set its properties
PdfStringFormat format = new PdfStringFormat();
//Set no clip
@@ -2512,10 +2758,8 @@ The following code example illustrates this.
// Draw the string inside the rectangle with the specified font, brush, and format
graphics.DrawString("PDF text line 1 \r\nPDF text line 3", font, PdfBrushes.Black, new RectangleF(100, 100, 100, 20), format);
- //Creating the stream object.
- MemoryStream stream = new MemoryStream();
- //Save the document into stream.
- document.Save(stream);
+ //Save the document.
+ document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -2524,6 +2768,10 @@ The following code example illustrates this.
{% highlight c# tabtitle="C# [Windows-specific]" %}
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Graphics;
+ using System.Drawing;
+
// Create a new PdfStringFormat and set its properties
PdfStringFormat format = new PdfStringFormat();
//Set no clip
@@ -2560,6 +2808,10 @@ The following code example illustrates this.
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+ Imports Syncfusion.Pdf
+ Imports Syncfusion.Pdf.Graphics
+ Imports System.Drawing
+
' Create a new PdfStringFormat and set its properties
Dim format As New PdfStringFormat()
' Set no clip
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-Watermarks.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-Watermarks.md
index d3422ab4d..78ca24559 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-Watermarks.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-Watermarks.md
@@ -20,6 +20,10 @@ The below code illustrates how to draw the text watermark in new PDF document us
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Watermark/Adding-text-watermark-in-PDF-document/.NET/Adding-text-watermark-in-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document.
@@ -35,23 +39,18 @@ graphics.SetTransparency(0.25f);
graphics.RotateTransform(-40);
graphics.DrawString("Imported using Essential PDF", font, PdfPens.Red, PdfBrushes.Red, new PointF(-150, 450));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-stream.Position = 0;
-//Close the document.
+//Save and close the document.
+pdfDocument.Save("Watermark.pdf");
pdfDocument.Close(true);
-//Defining the content type for PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Watermark.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document.
@@ -75,6 +74,10 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim pdfDocument As New PdfDocument()
'Add a page to the PDF document.
@@ -109,9 +112,13 @@ The below code illustrates how to draw the text watermark in an existing PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Watermark/Add-text-watermark-in-an-existing-PDF-document/.NET/Add-text-watermark-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get first page from document.
PdfPageBase loadedPage = loadedDocument.Pages[0];
//Create PDF graphics for the page.
@@ -124,27 +131,23 @@ PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
PdfGraphicsState state = graphics.Save();
graphics.SetTransparency(0.25f);
graphics.RotateTransform(-40);
-graphics.DrawString("Imported using Essential PDF", font, PdfPens.Red, PdfBrushes.Red, new PointF(-150,
+graphics.DrawString("Imported using Essential PDF", font, PdfPens.Red, PdfBrushes.Red, new PointF(-150, 450));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document.
+//Save and close the document.
+loadedDocument.Save("Watermark.pdf");
loadedDocument.Close(true);
-//Defining the content type for PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Watermark.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get first page from document.
PdfPageBase loadedPage = loadedDocument.Pages[0];
//Create PDF graphics for the page.
@@ -166,8 +169,13 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports System.Drawing
+
'Load an existing PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get first page from document.
Dim loadedPage As PdfPageBase = loadedDocument.Pages(0)
'Create PDF graphics for the page.
@@ -203,6 +211,10 @@ The below code sample illustrates how to add image watermark in PDF document, us
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Watermark/Adding-image-watermark-in-PDF-document/.NET/Adding-image-watermark-in-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document.
@@ -219,23 +231,18 @@ graphics.SetTransparency(0.25f);
//Draw the image.
graphics.DrawImage(image, new PointF(0, 0), pdfPage.Graphics.ClientSize);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-pdfDocument.Save(stream);
-stream.Position = 0;
-//Close the document.
+//Save and close the document.
+pdfDocument.Save("Watermark.pdf");
pdfDocument.Close(true);
-//Defining the content type for PDF file.
-string contentType = "application/pdf";
-//Define the file name.
-string fileName = "Watermark.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name.
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+
//Create a new PDF document.
PdfDocument pdfDocument = new PdfDocument();
//Add a page to the PDF document.
@@ -258,6 +265,10 @@ pdfDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports System.Drawing
+
'Create a new PDF document.
Dim pdfDocument As New PdfDocument()
'Add a page to the PDF document.
@@ -291,9 +302,13 @@ The below code illustrates how to draw the image watermark in existing PDF docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Watermark/Draw-the-image-watermark-in-an-existing-PDF-document/.NET/Draw-the-image-watermark-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get first page from document
PdfPageBase loadedPage = loadedDocument.Pages[0];
//Create PDF graphics for the page
@@ -307,25 +322,21 @@ graphics.SetTransparency(0.25f);
//Draw the image
graphics.DrawImage(image, new PointF(0, 0), loadedPage.Graphics.ClientSize);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-stream.Position = 0;
-//Close the document
+//Save and close the document.
+loadedDocument.Save("watermark.pdf");
loadedDocument.Close(true);
-//Defining the content type for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Watermark.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get first page from document.
PdfPageBase loadedPage = loadedDocument.Pages[0];
//Create PDF graphics for the page.
@@ -346,8 +357,13 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports System.Drawing
+
'Load the document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get first page from document.
Dim loadedPage As PdfPageBase = loadedDocument.Pages(0)
'Create PDF graphics for the page
@@ -382,9 +398,13 @@ The following code example explains how to add a watermark annotation in the PDF
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Annotation/Add-watermark-annotation-in-the-PDF-document/.NET/Add-watermark-annotation-in-the-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
-FileStream docStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the page
PdfLoadedPage lpage = loadedDocument.Pages[0] as PdfLoadedPage;
@@ -397,16 +417,19 @@ watermark.Appearance.Normal.Graphics.DrawString("Watermark Text", new PdfStandar
//Adds the annotation to page
lpage.Annotations.Add(watermark);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
-//Close the document
-loadedDocument.Close(true);
+//Saves the document.
+loadedDocument.Save("WatermarkAnnotation.pdf");
+loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Get the page
@@ -429,6 +452,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Parsing
+Imports System.Drawing
+
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedDocument("input.pdf")
'Get the page
@@ -460,9 +488,12 @@ You can remove the Watermark annotation from the annotation collection, represen
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Watermark/Removing-watermark-annotation-in-PDF-document/.NET/Remove-watermark-annotation-in-the-PDF-document/Program.cs" %}
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Graphics;
+ using Syncfusion.Pdf.Parsing;
+
//Load the PDF document
- FileStream docStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read);
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+ PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Iterate through the annotations collection and remove PdfLoadedWatermark annotations
foreach (PdfPageBase page in loadedDocument.Pages)
{
@@ -477,16 +508,18 @@ You can remove the Watermark annotation from the annotation collection, represen
}
}
- //Save the document into stream
- MemoryStream stream = new MemoryStream();
- loadedDocument.Save(stream);
- //Close the document
- loadedDocument.Close(true);
+ //Saves the document to disk.
+ loadedDocument.Save("WatermarkAnnotation.pdf");
+ loadedDocument.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Graphics;
+ using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
// Iterate through the annotations collection and remove PdfLoadedWatermark annotations
@@ -511,6 +544,10 @@ You can remove the Watermark annotation from the annotation collection, represen
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+ Imports Syncfusion.Pdf
+ Imports Syncfusion.Pdf.Graphics
+ Imports Syncfusion.Pdf.Parsing
+
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedDocument("input.pdf")
' Iterate through the annotations collection and remove PdfLoadedWatermark annotations
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-XFA.MD b/Document-Processing/PDF/PDF-Library/NET/Working-with-XFA.MD
index f64c310e9..92cc4fa51 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-XFA.MD
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-XFA.MD
@@ -24,6 +24,8 @@ The following code example explains how to add a new page using [PdfXfaPage](htt
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-a-new-page-in-a-PDF-XFA-document/.NET/Add-a-new-page-in-a-PDF-XFA-document/Program.cs" %}
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -38,16 +40,16 @@ mainForm.Fields.Add(textElement);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Save the PDF document to stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//Close the document.
document.Close();
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -71,6 +73,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Xfa
+
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -110,6 +114,10 @@ The below sample illustrates how to create a new PDF document with XFA page size
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Create-a-new-PDF-document-with-XFA-page-size/.NET/Create-a-new-PDF-document-with-XFA-page-size/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Set the page size.
@@ -128,9 +136,8 @@ mainForm.Fields.Add(textElement);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Save the PDF document to stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -138,6 +145,10 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Set the page size.
@@ -165,6 +176,10 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Xfa
+
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Set the page size.
@@ -200,6 +215,10 @@ You can create a custom page size to the PDF document by using following code sn
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Create-a-custom-page-size-to-the-PDF-document/.NET/Create-a-custom-page-size-to-the-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Set the page size.
@@ -218,9 +237,8 @@ mainForm.Fields.Add(textElement);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Save the PDF document to stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -228,6 +246,10 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Set the page size.
@@ -255,6 +277,10 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Xfa
+
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Set the page size
@@ -290,6 +316,10 @@ You can change page orientation from portrait to landscape by using [PdfXfaPageO
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Change-page-orientation-from-portrait-to-landscape-in-PDF/.NET/Change-page-orientation-from-portrait-to-landscape-in-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Set the page size.
@@ -310,9 +340,8 @@ mainForm.Fields.Add(textElement);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Save the PDF document to stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -320,6 +349,10 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Set the page size.
@@ -349,6 +382,10 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Xfa
+
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Set the page size
@@ -388,6 +425,10 @@ To create a dynamic XFA forms using [PdfXfaType](https://help.syncfusion.com/cr/
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Create-a-dynamic-XFA-forms-in-a-PDF-document/.NET/Create-a-dynamic-XFA-forms-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Set the page size.
@@ -406,9 +447,8 @@ mainForm.Fields.Add(textElement);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Save the PDF document to stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -416,6 +456,10 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Set the page size.
@@ -443,6 +487,10 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Xfa
+
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Set the page size
@@ -480,6 +528,10 @@ To create a static XFA forms using [PdfXfaType](https://help.syncfusion.com/cr/d
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Create-a-static-XFA-forms-in-a-PDF-document/.NET/Create-a-static-XFA-forms-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Set the page size.
@@ -498,9 +550,8 @@ mainForm.Fields.Add(textElement);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Save the PDF document to stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream, PdfXfaType.Static);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -508,6 +559,10 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Set the page size.
@@ -535,6 +590,10 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Xfa
+
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Set the page size
@@ -574,6 +633,9 @@ The below code snippet illustrates how to add a textbox field to a new PDF docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-a-textbox-field-to-a-new-PDF-document/.NET/Add-a-textbox-field-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -592,9 +654,8 @@ mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Save the PDF document to stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -602,6 +663,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -629,6 +693,9 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
@@ -664,10 +731,11 @@ The below code snippet illustrates how to add a textbox field to an existing PDF
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-a-textbox-field-to-an-existing-PDF-document/.NET/Add-a-textbox-field-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -680,10 +748,8 @@ textBoxField.ToolTip = "First Name";
//Add the field to the existing XFA form.
loadedForm.Fields.Add(textBoxField);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
//Save the document.
-loadedDocument.Save(stream);
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -691,6 +757,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -714,6 +783,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document.
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form.
@@ -747,6 +819,9 @@ The below code snippet illustrates how to add a numeric field to a new PDF docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-a-XFA-numeric-field-to-a-new-PDF-document/.NET/Add-a-XFA-numeric-field-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -763,9 +838,8 @@ mainForm.Fields.Add(numericField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Save the PDF document to stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -773,6 +847,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -798,6 +875,9 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.
+
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
@@ -831,10 +911,11 @@ The below code snippet illustrates how to add the numeric field to an existing P
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-numeric-field-to-an-existing-PDF-document/.NET/Add-the-XFA-numeric-field-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -845,10 +926,8 @@ numericField.Caption.Text = "Numeric Field";
//Add the field to the existing XFA form.
loadedForm.Fields.Add(numericField);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
//Save the document.
-loadedDocument.Save(stream);
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -856,6 +935,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -877,6 +959,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -908,6 +993,9 @@ The below code snippet illustrates how to add a combo box field to a new PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-a-combobox-field-to-a-new-PDF-document/.NET/Add-a-combobox-field-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -929,10 +1017,8 @@ mainForm.Fields.Add(comboBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
//Save the document.
-document.Save(stream, PdfXfaType.Dynamic);
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -940,6 +1026,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -969,6 +1058,9 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Create a new PDF XFA document
Dim document As PdfXfaDocument = New PdfXfaDocument()
'Add a new XFA page
@@ -1006,10 +1098,11 @@ The below code snippet illustrates how to add the combo box field to an existing
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-combobox-field-to-an-existing-PDF-document/.NET/Add-the-combobox-field-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -1024,10 +1117,8 @@ comboBoxField.Items.Add("Documentation.");
//Add the field to the existing XFA form.
loadedForm.Fields.Add(comboBoxField);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
//Save the document.
-loadedDocument.Save(stream);
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -1035,6 +1126,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -1060,6 +1154,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -1095,6 +1192,9 @@ The below code snippet illustrates how to add a list box field to a new PDF docu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-listbox-field-to-a-new-PDF-document/.NET/Add-the-XFA-listbox-field-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -1117,10 +1217,8 @@ mainForm.Fields.Add(listBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
//Save the document.
-document.Save(stream, PdfXfaType.Dynamic);
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -1128,6 +1226,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -1159,6 +1260,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -1198,10 +1301,11 @@ The below code snippet illustrates how to add the list box field to an existing
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-listbox-field-to-an-existing-PDF-document/.NET/Add-the-XFA-listbox-field-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -1218,10 +1322,8 @@ listBoxField.Items.Add("German");
//Add the field to the existing XFA form.
loadedForm.Fields.Add(listBoxField);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
//Save the document.
-loadedDocument.Save(stream);
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -1229,6 +1331,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -1256,6 +1361,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -1293,6 +1401,9 @@ The below code snippet illustrates how to add a check box field to a new PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-checkbox-field-to-a-new-PDF-document/.NET/Add-the-XFA-checkbox-field-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -1310,10 +1421,8 @@ mainForm.Fields.Add(checkBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
//Save the document.
-document.Save(stream, PdfXfaType.Dynamic);
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -1321,6 +1430,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -1347,6 +1459,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -1381,10 +1495,11 @@ The below code snippet illustrates how to add the check box field to an existing
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-checkbox-field-to-an-existing-PDF-document/.NET/Add-the-XFA-checkbox-field-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -1396,10 +1511,8 @@ checkBoxField.CheckedStyle = PdfXfaCheckedStyle.Cross;
//Add the field to the existing XFA form.
loadedForm.Fields.Add(checkBoxField);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
//Save the document.
-loadedDocument.Save(stream);
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -1407,6 +1520,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -1429,6 +1545,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -1461,6 +1580,9 @@ The below code snippet illustrates how to add a radio button field to a new PDF
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-radio-button-field-to-a-new-PDF-document/.NET/Add-the-XFA-radio-button-field-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -1486,10 +1608,8 @@ mainForm.Fields.Add(group);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
//Save the document.
-document.Save(stream, PdfXfaType.Dynamic);
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -1497,6 +1617,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -1531,6 +1654,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -1573,10 +1698,11 @@ The below code snippet illustrates how to add the radio button field to an exist
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-radio-button-field-to-an-existing-PDF-document/.NET/Add-the-XFA-radio-button-field-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -1596,10 +1722,8 @@ group.Items.Add(radioButtonField2);
//Add the field to the existing XFA form.
loadedForm.Fields.Add(group);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -1607,6 +1731,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -1637,6 +1764,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -1677,6 +1807,9 @@ The below code snippet illustrates how to add a date time field to a new PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-datetime-field-in-a-new-PDF-document/.NET/Add-the-XFA-datetime-field-in-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -1695,17 +1828,17 @@ mainForm.Fields.Add(dateTimeField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -1733,6 +1866,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -1768,10 +1903,11 @@ The below code snippet illustrates how to add the date time field to an existing
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-datetime-field-in-an-existing-PDF-document/.NET/Add-the-XFA-datetime-field-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -1784,10 +1920,8 @@ dateTimeField.ToolTip = "Date Time";
//Add the field to the existing XFA form.
loadedForm.Fields.Add(dateTimeField);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -1795,6 +1929,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -1818,6 +1955,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -1851,6 +1991,9 @@ The below code snippet illustrates how to add a button field to a new PDF docume
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-button-field-to-a-new-PDF-document/.NET/Add-the-XFA-button-field-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -1867,17 +2010,17 @@ mainForm.Fields.Add(buttonField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -1903,6 +2046,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -1936,10 +2081,11 @@ The below code snippet illustrates how to add the button field to an existing PD
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-button-field-to-an-existing-PDF-document/.NET/Add-the-XFA-button-field-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -1950,10 +2096,8 @@ buttonField.Content = "Click";
//Add the field to the existing XFA form.
loadedForm.Fields.Add(buttonField);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -1961,6 +2105,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -1982,6 +2129,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -2013,6 +2163,9 @@ The below code snippet illustrates how to add a text element to a new PDF docume
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-text-element-to-a-new-PDF-document/.NET/Add-the-XFA-text-element-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -2029,10 +2182,8 @@ mainForm.Fields.Add(textElement);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -2040,6 +2191,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -2065,6 +2219,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -2098,10 +2254,11 @@ The below code snippet illustrates how to add a text element to an existing PDF
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-text-element-to-an-existing-PDF-document/.NET/Add-the-XFA-text-element-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -2112,10 +2269,8 @@ textElement.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 14, PdfFontStyle
//Add the text element to the existing XFA form.
loadedForm.Fields.Add(textElement);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -2123,6 +2278,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -2144,6 +2302,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -2175,6 +2336,9 @@ The below code snippet illustrates how to add the rectangle field to a new PDF d
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-rectangle-field-to-a-new-PDF-document/.NET/Add-the-XFA-rectangle-field-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -2191,17 +2355,17 @@ mainForm.Fields.Add(rectangle);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -2227,6 +2391,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -2260,10 +2426,11 @@ The below code snippet illustrates how to add the rectangle field to an existing
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-rectangle-field-to-an-existing-PDF-document/.NET/Add-the-XFA-rectangle-field-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -2274,10 +2441,8 @@ rectangle.Border.FillColor = new PdfXfaSolidBrush(Color.FromArgb(0,255,0,0));
//Add the rectangle to the existing XFA form.
loadedForm.Fields.Add(rectangle);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -2285,6 +2450,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form
@@ -2306,6 +2474,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -2337,6 +2508,9 @@ The below code snippet illustrates how to add the circle field to a new PDF docu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-circle-field-to-a-new-PDF-document/.NET/Add-the-XFA-circle-field-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -2353,17 +2527,17 @@ mainForm.Fields.Add(circle);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -2389,6 +2563,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -2422,10 +2598,11 @@ The below code snippet illustrates how to add the circle field to an existing PD
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-circle-field-to-an-existing-PDF-document/.NET/Add-circle-field-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -2436,10 +2613,8 @@ circle.Border.FillColor = new PdfXfaSolidBrush(Color.FromArgb(0,255,0,0));
//Add the circle to the existing XFA form.
loadedForm.Fields.Add(circle);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -2447,6 +2622,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -2468,6 +2646,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -2499,6 +2680,9 @@ The below code snippet illustrates how to add a line to a new PDF document using
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-line-to-a-new-PDF-document/.NET/Add-the-XFA-line-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -2515,17 +2699,17 @@ mainForm.Fields.Add(line);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -2551,6 +2735,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -2584,10 +2770,11 @@ The below code snippet illustrates how to add a line to an existing PDF document
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-XFA-line-to-an-existing-PDF-document/.NET/Add-XFA-line-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -2598,10 +2785,8 @@ line.Color = new PdfColor(Color.FromArgb(0,255,0,0));
//Add the line to the existing XFA form.
loadedForm.Fields.Add(line);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -2609,6 +2794,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm.pdf");
//Load the existing XFA form.
@@ -2630,6 +2818,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm.pdf")
'Load the existing XFA form
@@ -2661,6 +2852,9 @@ The below code snippet illustrates how to add an image to a new PDF document usi
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-image-to-a-new-PDF-document/.NET/Add-the-XFA-image-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -2677,17 +2871,17 @@ mainForm.Fields.Add(image);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream, PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
-
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
@@ -2711,6 +2905,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add a new XFA page
@@ -2742,24 +2938,23 @@ The below code snippet illustrates how to add an image to an existing PDF docume
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-XFA-image-to-an-existing-PDF-document/.NET/Add-the-XFA-image-to-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Load the image as stream.
-MemoryStream imageStream = new MemoryStream(File.ReadAllBytes(imageFileName));
+MemoryStream imageStream = new MemoryStream(File.ReadAllBytes("Image.png"));
//Create a image and add the properties.
PdfXfaImage image = new PdfXfaImage("imgage1", imageStream);
//Add the image to the existing XFA form.
loadedForm.Fields.Add(image);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -2767,6 +2962,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
@@ -2786,6 +2984,9 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
+
'Load the existing XFA document
Dim loadedDocument As New PdfLoadedXfaDocument("XfaForm1.pdf")
'Load the existing XFA form
@@ -2822,6 +3023,9 @@ You can set the flow direction to an XFA form while creating, using [PdfXfaFlowD
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Set-the-horizontal-flow-direction-in-XFA-forms/.NET/Set-the-horizontal-flow-direction-in-XFA-forms/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -2846,10 +3050,8 @@ mainForm.Fields.Add(textBoxField1);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Add the field to the XFA form.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -2857,6 +3059,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -2890,6 +3095,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -2933,6 +3140,9 @@ You can set the flow direction to an XFA form while creating, using [PdfXfaFlowD
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Set-the-vertical-flow-direction-in-XFA-forms/.NET/Set-the-vertical-flow-direction-in-XFA-forms/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -2957,17 +3167,18 @@ mainForm.Fields.Add(textBoxField1);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
-
+
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3001,6 +3212,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -3044,6 +3257,9 @@ You can rotate a form field in XFA document, using [PdfXfaRotateAngle](https://h
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Rotating-the-XFA-form-fields-in-a-PDF-document/.NET/Rotating-the-XFA-form-fields-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3064,10 +3280,8 @@ mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -3075,6 +3289,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3104,6 +3321,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -3143,6 +3362,9 @@ You can validate the date time fields of the input text by enabling the [Require
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Validating-the-XFA-datetime-field-in-a-PDF-document/.NET/Validating-the-XFA-datetime-field-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3163,10 +3385,8 @@ mainForm.Fields.Add(dateTimeField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -3174,6 +3394,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3203,6 +3426,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -3244,6 +3469,9 @@ Please refer the below link for numeric pattern format in detail,
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Customizing-the-XFA-numeric-field-in-a-PDF-document/.NET/Customizing-the-XFA-numeric-field-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3262,10 +3490,8 @@ mainForm.Fields.Add(numericField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -3273,6 +3499,9 @@ document.Close();
{% highlight c# tabtitle="C#" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3337,6 +3566,9 @@ You can add the nested sub forms by using [PdfXfaForm](https://help.syncfusion.c
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-XFA-nested-subforms-in-a-PDF-document/.NET/Add-XFA-nested-subforms-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3366,10 +3598,8 @@ mainForm.Fields.Add(form1);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -3377,6 +3607,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3415,6 +3648,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -3487,10 +3722,8 @@ mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -3498,6 +3731,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3525,6 +3761,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -3562,6 +3800,9 @@ You can add the vertical alignments in XFA form fields through [VerticalAlignmen
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-vertical-alignments-in-XFA-form-fields/.NET/Add-the-vertical-alignments-in-XFA-form-fields/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3580,10 +3821,8 @@ mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -3591,6 +3830,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3618,6 +3860,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -3655,6 +3899,9 @@ You can add margin to the XFA form fields by using [Margins](https://help.syncfu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Adding-margins-to-the-XFA-form-fields/.NET/Adding-margins-to-the-XFA-form-fields/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3674,10 +3921,8 @@ mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -3685,6 +3930,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3713,6 +3961,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -3751,6 +4001,9 @@ You can add padding to the XFA form fields by using [padding](https://help.syncf
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-the-padding-to-XFA-form-fields/.NET/Add-the-padding-to-XFA-form-fields/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3769,10 +4022,8 @@ mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -3780,6 +4031,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3807,6 +4061,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -3844,6 +4100,9 @@ You can add border to the XFA fields by using [Border](https://help.syncfusion.c
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Add-border-to-the-XFA-form-fields/.NET/Add-border-to-the-XFA-form-fields/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3863,10 +4122,8 @@ mainForm.Fields.Add(textBoxField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -3874,6 +4131,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -3902,6 +4162,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -3944,10 +4206,11 @@ Please refer the below sample for filling the XFA text box field using [PdfLoade
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Filling-the-XFA-textbox-field-in-an-existing-PDF-document/.NET/Filling-the-XFA-textbox-field-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -3956,10 +4219,8 @@ PdfLoadedXfaTextBoxField loadedTextBox = (loadedForm.Fields["subform1[0]"] as Pd
//fill the text box.
loadedTextBox.Text = "First Name";
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -3967,6 +4228,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -3986,6 +4250,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4015,10 +4281,11 @@ You can fill the XFA numeric field by using [PdfLoadedXfaNumericField](https://h
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Filling-the-XFA-numeric-field-in-an-existing-PDF-document/.NET/Filling-the-XFA-numeric-field-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -4027,10 +4294,8 @@ PdfLoadedXfaNumericField loadedNumericField = (loadedForm.Fields["subform1[0]"]
//fill the numeric field.
loadedNumericField.NumericValue = 945322;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4038,6 +4303,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -4057,6 +4325,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4086,10 +4356,11 @@ You can fill the XFA combo box field by using [PdfLoadedXfaComboBoxField](https:
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Filling-the-XFA-combobox-field-in-an-existing-PDF-document/.NET/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -4098,10 +4369,8 @@ PdfLoadedXfaComboBoxField loadedComboBoxField = (loadedForm.Fields["subform1[0]"
//Set the combo box selected index.
loadedComboBoxField.SelectedIndex = 1;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4109,6 +4378,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -4128,6 +4400,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4155,10 +4429,11 @@ You can fill and save hidden items in XFA combo box field by using [HiddenItems]
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Fill-and-save-hidden-items-in-XFA-combobox-field/.NET/Fill-and-save-hidden-items-in-XFA-combobox-field/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -4170,10 +4445,8 @@ loadedComboBoxField.SelectedValue = loadedComboBoxField.HiddenItems[0];
List hiddenValues = new List();
hiddenValues = loadedComboBoxField.HiddenItems;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4181,6 +4454,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("Input.pdf");
//Load the existing XFA form.
@@ -4203,6 +4479,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("Input.pdf")
'Load the existing XFA form
@@ -4235,10 +4513,11 @@ You can fill the XFA list box field by using [PdfLoadedXfaListBoxField](https://
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Fill-the-XFA-listbox-field-in-an-existing-PDF-document/.NET/Fill-the-XFA-listbox-field-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -4247,10 +4526,8 @@ PdfLoadedXfaListBoxField loadedListBoxField = (loadedForm.Fields["subform1[0]"]
//Set the list box selected index.
loadedListBoxField.SelectedIndex = 1;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4258,6 +4535,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -4277,6 +4557,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4304,10 +4586,11 @@ You can also select the multiple values by using [SelectedItems](https://help.sy
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Select-multiple-values-in-an-existing-XFA-listbox-field/.NET/Select-multiple-values-in-an-existing-XFA-listbox-field/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -4316,10 +4599,8 @@ PdfLoadedXfaListBoxField loadedListBoxField = (loadedForm.Fields["subform1[0]"]
//Set the list box selected items.
loadedListBoxField.SelectedItems = new string[] { "English", "Spanish" };
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4327,6 +4608,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -4346,6 +4630,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4375,10 +4661,11 @@ You can fill the XFA date time field by using [PdfLoadedXfaDateTimeField](https:
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Fill-the-XFA-datetime-field-in-an-existing-PDF-document/.NET/Fill-the-XFA-datetime-field-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -4387,10 +4674,8 @@ PdfLoadedXfaDateTimeField loadedDateTimeField = (loadedForm.Fields["subform1[0]"
//Set the value.
loadedDateTimeField.Value = DateTime.Now;
-//Save the document to memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Output.pdf");
//Close the document.
loadedDocument.Close();
@@ -4398,6 +4683,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -4417,6 +4705,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4446,10 +4736,11 @@ You can fill the XFA check box field by using [PdfLoadedXfaCheckBoxField](https:
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Fill-the-XFA-checkbox-field-in-an-existing-PDF-document/.NET/Fill-the-XFA-checkbox-field-in-an-existing-PDF-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -4458,10 +4749,8 @@ PdfLoadedXfaCheckBoxField loadedCheckBox = (loadedForm.Fields["subform1[0]"] as
//Check the check box.
loadedCheckBox.IsChecked = true;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4469,6 +4758,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -4488,6 +4780,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4517,10 +4811,11 @@ You can fill the XFA radio button field by using [PdfLoadedXfaRadioButtonField](
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Fill-the-XFA-radiobutton-field-in-an-existing-PDF-document/.NET/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -4531,10 +4826,8 @@ PdfLoadedXfaRadioButtonField loadedRadioButtonField = loadedRadioButtonGroup.Fie
//Check the radio button.
loadedRadioButtonField.IsChecked = true;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4542,6 +4835,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -4563,6 +4859,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4596,6 +4894,9 @@ The below code snippet illustrates how to set the [ReadOnly](https://help.syncfu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Removing-editing-capability-of-form-fields-in-a-new-PDF/.NET/Removing-editing-capability-of-form-fields-in-a-new-PDF/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -4614,10 +4915,8 @@ mainForm.ReadOnly = true;
//Add the XFA form to the document.
document.XfaForm = mainForm;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-document.Save(stream,PdfXfaType.Dynamic);
+//Save the document.
+document.Save("XfaForm.pdf",PdfXfaType.Dynamic);
//Close the document.
document.Close();
@@ -4625,6 +4924,9 @@ document.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add new XFA page.
@@ -4652,6 +4954,8 @@ document.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Create a new PDF XFA document
Dim document As New PdfXfaDocument()
'Add new XFA page
@@ -4687,19 +4991,18 @@ The below code snippet illustrates how to set the [ReadOnly](https://help.syncfu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Remove-editing-capability-to-an-existing-form-fields/.NET/Remove-editing-capability-to-an-existing-form-fields/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Set the form as read only.
loadedForm.ReadOnly = true;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4707,6 +5010,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -4723,6 +5029,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4757,6 +5065,9 @@ The following code snippet illustrates how to flatten the XFA form field.
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing document.
PdfLoadedXfaDocument ldoc = new PdfLoadedXfaDocument("input.pdf");
//Set flatten.
@@ -4771,6 +5082,8 @@ ldoc.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing document
Dim ldoc As New PdfLoadedXfaDocument("input.pdf")
'Set flatten
@@ -4795,10 +5108,11 @@ You can remove the dynamic XFA form fields by using [Remove](https://help.syncfu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Removing-the-dynamic-form-fields-from-an-existing-PDF/.NET/Removing-the-dynamic-form-fields-from-an-existing-PDF/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -4807,10 +5121,8 @@ PdfLoadedXfaTextBoxField loadedText = (loadedForm.Fields["subform1[0]"] as PdfLo
//Remove the field.
loadedForm.Fields.Remove(loadedText);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4818,6 +5130,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -4837,6 +5152,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4866,10 +5183,11 @@ You can modify the existing dynamic XFA fields like Width, Height and Text by us
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Modidy-the-existing-fields-in-XFA-document/.NET/Modidy-the-existing-fields-in-XFA-document/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Load the existing XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
@@ -4881,10 +5199,8 @@ loadedText.Height = 30;
//Set the caption text.
loadedText.Caption.Text = "Second Name";
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4892,6 +5208,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing PDF document.
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form.
@@ -4914,6 +5233,8 @@ loadedDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
@@ -4948,19 +5269,18 @@ The following sample illustrates how to clear the date time field in an existing
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/XFA/Clear-XFA-datetime-field-value-in-an-existing-XFA-document/.NET/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+using Syncfusion.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA document.
-PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(docStream);
+PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("XfaForm1.pdf");
//Get the date time field.
PdfLoadedXfaDateTimeField dateTimeField = loadedDocument.XfaForm.TryGetFieldByCompleteName("form[0].subform[0].dateTime[0]") as PdfLoadedXfaDateTimeField;
//Clear the date time field value.
dateTimeField.ClearValue();
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document to memory stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("XfaForm.pdf");
//Close the document.
loadedDocument.Close();
@@ -4968,6 +5288,9 @@ loadedDocument.Close();
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
+using Syncfusion.Pdf.Xfa;
+
//Load the existing XFA PDF document.
PdfLoadedXfaDocument loadedXfaDocument = new PdfLoadedXfaDocument("input.pdf");
//Get the date time field.
@@ -4983,7 +5306,8 @@ loadedXfaDocument.Close();
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the existing XFA PDF document
+Imports System.Drawing
+Imports Syncfusion.Pdf.Xfa'Load the existing XFA PDF document
Dim loadedXfaDocument As PdfLoadedXfaDocument = New PdfLoadedXfaDocument("input.pdf")
'Get the date time field
Dim dateTimeField As PdfLoadedXfaDateTimeField = TryCast(loadedXfaDocument.XfaForm.TryGetFieldByCompleteName("form[0].subform[0].dateTime[0]"), PdfLoadedXfaDateTimeField)
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-ZUGFeRD-invoice.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-ZUGFeRD-invoice.md
index 8be1a1b8e..d0746ee48 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-ZUGFeRD-invoice.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-ZUGFeRD-invoice.md
@@ -162,6 +162,9 @@ Using **PDF/A-3b** conformance, you can create a **ZUGFeRD invoice PDF** by spec
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/ZUGFeRD/Factur-X/.NET/Factur-X/Program.cs" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf;
+
//Create a new PDF document
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3B);
@@ -184,17 +187,18 @@ attachment.MimeType = "text/xml";
//Add attachment to PDF document
document.Attachments.Add(attachment);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
+//Save the document
+document.Save("Output.pdf");
//Closes the document
-document.Close(true);
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf;
+
//Create a new PDF document
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3B);
@@ -226,6 +230,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf
+
' Create a new PDF document
Dim document As New PdfDocument(PdfConformanceLevel.Pdf_A3B)
@@ -266,6 +273,9 @@ The complete code to create ZUGFeRD invoice PDF document as follows.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/ZUGFeRD/Create-ZUGFeRD-compliment-PDF-invoice/.NET/Create-ZUGFeRD-compliment-PDF-invoice/Program.cs" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf;
+
//Create ZUGFeRD invoice PDF document
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3B);
//Set ZUGFeRD conformance level
@@ -281,25 +291,18 @@ attachment.MimeType = "application/xml";
//Add attachment to PDF document
document.Attachments.Add(attachment);
-//Creating the stream object
-MemoryStream stream = new MemoryStream();
-//Save the document into memory stream
-document.Save(stream);
-//If the position is not set to '0', then the PDF will be empty
-stream.Position = 0;
-//Close the document
-document.Close(true);
-//Defining the ContentType for PDF file
-string contentType = "application/pdf";
-//Define the file name
-string fileName = "Zugferd.pdf";
-//Creates a FileContentResult object by using the file contents, content type, and file name
-return File(stream, contentType, fileName);
+//Save the document
+document.Save("Output.pdf");
+//Closes the document
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf;
+
//Create ZUGFeRD invoice PDF document
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3B);
//Set ZUGFeRD conformance level
@@ -323,6 +326,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf
+
'Create ZUGFeRD invoice PDF document
Dim document As PdfDocument = New PdfDocument(PdfConformanceLevel.Pdf_A3B)
'Set ZUGFeRD conformance level
@@ -356,28 +362,32 @@ You can extract the ZUGFeRD invoice using [PdfAttachment](https://help.syncfusio
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/ZUGFeRD/Extract-ZUGFeRD-invoice-from-PDF-document/.NET/Extract-ZUGFeRD-invoice-from-PDF-document/Program.cs" %}
-//Get stream from an existing PDF document.
-FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
-//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+//Loads the PDF document
+PdfLoadedDocument document = new PdfLoadedDocument("Sample.pdf");
-//Iterates the attachments.
-foreach (PdfAttachment attachment in loadedDocument.Attachments)
+//Iterates the attachments
+foreach (PdfAttachment attachment in document.Attachments)
{
- //Extracts the ZUGFeRD invoice attachment and saves it to the disk.
- FileStream s = new FileStream("Output/" + attachment.FileName, FileMode.Create, FileAccess.Write);
- s.Write(attachment.Data, 0, attachment.Data.Length);
- s.Dispose();
+//Extracts the ZUGFeRD invoice attachment and saves it to the disk
+FileStream s = new FileStream(attachment.FileName, FileMode.Create);
+s.Write(attachment.Data, 0, attachment.Data.Length);
+s.Dispose();
}
-//Close the PDF document.
-loadedDocument.Close(true);
+//Saves and closes the document
+document.Save("Output.pdf");
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Loads the PDF document
PdfLoadedDocument document = new PdfLoadedDocument("Sample.pdf");
@@ -398,6 +408,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Loads the PDF document
Dim document As New PdfLoadedDocument("Sample.pdf")
diff --git a/Document-Processing/PDF/PDF-Library/NET/Working-with-forms.md b/Document-Processing/PDF/PDF-Library/NET/Working-with-forms.md
index cb5da10af..8f6961431 100644
--- a/Document-Processing/PDF/PDF-Library/NET/Working-with-forms.md
+++ b/Document-Processing/PDF/PDF-Library/NET/Working-with-forms.md
@@ -26,6 +26,11 @@ The below code snippet illustrates how to add a textbox field to a new PDF docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Add-a-textbox-field-to-a-new-PDF-document/.NET/Add-a-textbox-field-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to the PDF document.
@@ -38,10 +43,8 @@ textBoxField.ToolTip = "First Name";
//Add the form field to the document.
document.Form.Fields.Add(textBoxField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -49,6 +52,11 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Drawing;
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Graphics;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to the PDF document.
@@ -70,7 +78,12 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create a new PDF document.
+Imports Syncfusion.Drawing
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Graphics
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As PdfDocument = New PdfDocument()
'Add a new page to the PDF document.
Dim page As PdfPage = document.Pages.Add()
@@ -99,9 +112,12 @@ The below code snippet illustrates how to add the textbox to an existing PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Add-the-textbox-to-an-existing-PDF-document/.NET/Add-the-textbox-to-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if (loadedDocument.Form == null)
loadedDocument.CreateForm();
@@ -115,10 +131,8 @@ textBoxField.ToolTip = "First Name";
//Add the form field to the existing PDF document.
loadedDocument.Form.Fields.Add(textBoxField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Form.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -126,8 +140,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if(loadedDocument.Form==null)
loadedDocument.CreateForm();
@@ -150,8 +168,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the existing PDF document
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Create the form if the form does not exist in the loaded document
If loadedDocument.Form Is Nothing Then
loadedDocument.CreateForm()
@@ -187,6 +209,9 @@ Please refer the below code snippet for adding the combo box in new PDF document
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Adding-combo-box-in-the-new-PDF-document/.NET/Adding-combo-box-in-the-new-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -205,10 +230,8 @@ comboBoxField.Items.Add(new PdfListFieldItem("Documentation", "content"));
//Add combo box to the form.
document.Form.Fields.Add(comboBoxField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -216,6 +239,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -242,8 +268,11 @@ document.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-
-'Create a new PDF document
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to PDF document
Dim page As PdfPage = document.Pages.Add()
@@ -278,9 +307,12 @@ Please refer the below code snippet for adding the combo box in existing PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Adding-the-combo-box-in-existing-PDF-document/.NET/Adding-the-combo-box-in-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if (loadedDocument.Form == null)
loadedDocument.CreateForm();
@@ -300,10 +332,8 @@ comboBoxField.Items.Add(new PdfListFieldItem("Documentation", "content"));
//Add combo box to the form.
loadedDocument.Form.Fields.Add(comboBoxField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Form.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -311,8 +341,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if(loadedDocument.Form==null)
loadedDocument.CreateForm();
@@ -341,8 +375,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the existing PDF document
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Create the form if the form does not exist in the loaded document
If loadedDocument.Form Is Nothing Then
loadedDocument.CreateForm()
@@ -382,29 +420,28 @@ Use the [TextAlignment](https://help.syncfusion.com/cr/document-processing/Syncf
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Annotation/Set-text-alignment-in-a-Combo-Box-field/.NET/Set-text-alignment-in-a-Combo-Box-field/Program.cs" %}
- // Load an existing document from a file stream.
- using (FileStream fileStream = new FileStream("SourceForm.pdf", FileMode.Open, FileAccess.Read))
- {
- PdfLoadedDocument doc = new PdfLoadedDocument(fileStream);
- // Load an existing combo box field by its name.
- PdfLoadedComboBoxField comboField = doc.Form.Fields["EmployeeCombo"] as PdfLoadedComboBoxField;
- // Set text alignment to center for the combo box field.
- comboField.TextAlignment = PdfTextAlignment.Center;
-
- // Save the updated document to a file stream.
- using (FileStream outputStream = new FileStream("Form.pdf", FileMode.Create, FileAccess.Write))
- {
- doc.Save(outputStream);
- }
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Interactive;
+ using Syncfusion.Pdf.Parsing;
- // Close the document.
- doc.Close(true);
- }
+ // Load an existing document.
+ PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
+ // Load an existing combo box field by its name.
+ PdfLoadedComboBoxField comboField = doc.Form.Fields["EmployeeCombo"] as PdfLoadedComboBoxField;
+ // Set text alignment to center for the combo box field.
+ comboField.TextAlignment = PdfTextAlignment.Center;
+ // Save the updated document.
+ doc.Save("Form.pdf");
+ doc.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Interactive;
+ using Syncfusion.Pdf.Parsing;
+
// Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Load an existing combo box field by its name.
@@ -418,8 +455,11 @@ Use the [TextAlignment](https://help.syncfusion.com/cr/document-processing/Syncf
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-
- ' Load an existing document.
+
+ Imports Syncfusion.Pdf
+ Imports Syncfusion.Pdf.Interactive
+
+ 'Load the PDF document.
Dim doc As New PdfLoadedDocument("SourceForm.pdf")
' Load an existing combo box field by its name.
Dim comboField As PdfLoadedComboBoxField = TryCast(doc.Form.Fields("EmployeeCombo"), PdfLoadedComboBoxField)
@@ -445,6 +485,9 @@ Please refer the below code snippet for adding the radio button in new PDF docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Adding-radio-button-in-new-PDF-document/.NET/Adding-radio-button-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -463,16 +506,16 @@ radioButtonItem2.Bounds = new Syncfusion.Drawing.RectangleF(100, 170, 20, 20);
employeesRadioList.Items.Add(radioButtonItem1);
employeesRadioList.Items.Add(radioButtonItem2);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-document.Save(stream);
+//Save the document.
+document.Save("Form.pdf");
//Close the document.
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
//Create a new PDF document.
PdfDocument document = new PdfDocument();
@@ -500,8 +543,11 @@ document.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-
-'Create a new PDF document.
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to PDF document.
Dim page As PdfPage = document.Pages.Add()
@@ -536,9 +582,12 @@ The below code snippet illustrates how to add the radio button in existing PDF d
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Add-radio-button-in-existing-PDF-document/.NET/Add-radio-button-in-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if (loadedDocument.Form == null)
loadedDocument.CreateForm();
@@ -558,10 +607,8 @@ radioButtonItem2.Bounds = new Syncfusion.Drawing.RectangleF(100, 170, 20, 20);
employeesRadioList.Items.Add(radioButtonItem1);
employeesRadioList.Items.Add(radioButtonItem2);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Form.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -569,8 +616,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if(loadedDocument.Form==null)
loadedDocument.CreateForm();
@@ -599,8 +650,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the existing PDF document
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Create the form if the form does not exist in the loaded document
If loadedDocument.Form Is Nothing Then
loadedDocument.CreateForm()
@@ -640,6 +695,9 @@ You can choose default value for radio button field using [SelectedIndex](https:
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/refs/heads/master/Forms/Default-value-for-radio-button-field/.NET/Default_Value_For_Radio_Button/Program.cs" %}
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Interactive;
+
// Create a new PDF document
PdfDocument document = new PdfDocument();
// Add a new page to the PDF document
@@ -672,16 +730,18 @@ You can choose default value for radio button field using [SelectedIndex](https:
// Add the radio button list to the form
document.Form.Fields.Add(employeesRadioList);
- //Save the document into stream.
- MemoryStream stream = new MemoryStream();
- document.Save(stream);
- //Close the document.
- document.Close(true);
+//Save the document.
+document.Save("Form.pdf");
+//Close the document.
+document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Interactive;
+
// Create a new PDF document
PdfDocument document = new PdfDocument();
// Add a new page to the PDF document
@@ -723,7 +783,10 @@ You can choose default value for radio button field using [SelectedIndex](https:
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
- ' Create a new PDF document
+ Imports Syncfusion.Pdf
+ Imports Syncfusion.Pdf.Interactive
+
+ 'Load the PDF document.
Dim document As New PdfDocument()
' Add a new page to the PDF document
Dim page As PdfPage = document.Pages.Add()
@@ -777,6 +840,9 @@ Please refer the below code snippet for adding the list box field in new PDF doc
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Add-listbox-field-in-new-PDF-document/.NET/Add-listbox-field-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -797,10 +863,8 @@ listBoxField.MultiSelect = true;
//Add the list box into PDF document.
document.Form.Fields.Add(listBoxField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-document.Save(stream);
+//Save the document.
+document.Save("Form.pdf");
//Close the document.
document.Close(true);
@@ -808,6 +872,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -836,8 +903,11 @@ document.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-
-'Create a new PDF document.
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to PDF document.
Dim page As PdfPage = document.Pages.Add()
@@ -874,9 +944,12 @@ Please refer the below code snippet for adding the list box field in existing PD
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Add-listbox-field-in-an-existing-PDF-document/.NET/Add-listbox-field-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if (loadedDocument.Form == null)
loadedDocument.CreateForm();
@@ -898,10 +971,8 @@ listBoxField.MultiSelect = true;
//Add the list box into PDF document.
loadedDocument.Form.Fields.Add(listBoxField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Form.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -909,8 +980,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if(loadedDocument.Form==null)
loadedDocument.CreateForm();
@@ -941,8 +1016,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the existing PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Create the form if the form does not exist in the loaded document.
If loadedDocument.Form Is Nothing Then
loadedDocument.CreateForm()
@@ -986,6 +1065,9 @@ Please refer the below code snippet for adding the check box field in new PDF do
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Add-checkbox-field-in-new-PDF-document/.NET/Add-checkbox-field-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -999,10 +1081,8 @@ checkBoxField.Bounds = new Syncfusion.Drawing.RectangleF(0, 20, 10, 10);
//Add the form field to the document.
document.Form.Fields.Add(checkBoxField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-document.Save(stream);
+//Save the document.
+document.Save("Form.pdf");
//Close the document.
document.Close(true);
@@ -1010,6 +1090,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -1031,8 +1114,11 @@ document.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-
-'Create a new PDF document.
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to PDF document.
Dim page As PdfPage = document.Pages.Add()
@@ -1062,8 +1148,12 @@ Please refer the below code snippet for adding the check box field in existing P
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Adding-checkbox-field-in-an-existing-PDF-document/.NET/Adding-checkbox-field-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if(loadedDocument.Form==null)
loadedDocument.CreateForm();
@@ -1087,35 +1177,41 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
-'Load the existing PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
-'Create the form if the form does not exist in the loaded document.
-If loadedDocument.Form Is Nothing Then
-loadedDocument.CreateForm()
-End If
-'Load the page.
-Dim loadedPage As PdfLoadedPage = TryCast(loadedDocument.Pages(0), PdfLoadedPage)
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
-'Create Check Box field.
-Dim checkBoxField As New PdfCheckBoxField(loadedPage, "CheckBox")
-'Set check box properties.
-checkBoxField.ToolTip = "Check Box"
-checkBoxField.Bounds = New RectangleF(0, 20, 10, 10)
-'Add the form field to the existing document.
-loadedDocument.Form.Fields.Add(checkBoxField)
+//Load the existing PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
+//Create the form if the form does not exist in the loaded document.
+if(loadedDocument.Form==null)
+ loadedDocument.CreateForm();
+//Load the page.
+PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
-'Save the document.
-loadedDocument.Save("Form.pdf")
-'close the document.
-loadedDocument.Close(True)
+//Create Check Box field.
+PdfCheckBoxField checkBoxField = new PdfCheckBoxField(loadedPage, "CheckBox");
+//Set check box properties.
+checkBoxField.ToolTip = "Check Box";
+checkBoxField.Bounds = new RectangleF(0, 20, 10, 10);
+//Add the form field to the existing document.
+loadedDocument.Form.Fields.Add(checkBoxField);
+
+//Save the document.
+loadedDocument.Save("Form.pdf");
+//Close the document.
+loadedDocument.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if (loadedDocument.Form == null)
loadedDocument.CreateForm();
@@ -1130,10 +1226,8 @@ checkBoxField.Bounds = new Syncfusion.Drawing.RectangleF(0, 20, 10, 10);
//Add the form field to the existing document.
loadedDocument.Form.Fields.Add(checkBoxField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Form.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -1153,6 +1247,9 @@ Please refer the below code snippet for adding the signature field in new PDF do
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Add-signature-field-in-a-new-PDF-document/.NET/Add-signature-field-in-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -1166,10 +1263,8 @@ signatureField.ToolTip = "Signature";
//Add the form field to the document.
document.Form.Fields.Add(signatureField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-document.Save(stream);
+//Save the document.
+document.Save("Form.pdf");
//Close the document.
document.Close(true);
@@ -1177,6 +1272,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -1199,7 +1297,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create a new PDF document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to PDF document.
Dim page As PdfPage = document.Pages.Add()
@@ -1229,9 +1330,12 @@ Please refer the below code snippet for adding the signature field in existing P
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Adding-the-signatre-field-in-existing-PDF-document/.NET/Adding-the-signatre-field-in-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if (loadedDocument.Form == null)
loadedDocument.CreateForm();
@@ -1246,10 +1350,8 @@ signatureField.ToolTip = "Signature";
//Add the form field to the existing document.
loadedDocument.Form.Fields.Add(signatureField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Form.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -1257,8 +1359,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if(loadedDocument.Form==null)
loadedDocument.CreateForm();
@@ -1282,8 +1388,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the existing PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Create the form if the form does not exist in the loaded document.
If loadedDocument.Form Is Nothing Then
loadedDocument.CreateForm()
@@ -1318,6 +1428,9 @@ The signedDate parameter in the [PdfSignature](https://help.syncfusion.com/cr/do
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Digital%20Signature/Customize-the-signed-date/.NET/Customize-the-signed-date/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Adds a new page.
@@ -1327,9 +1440,8 @@ PdfSignature signature = new PdfSignature(page, "Signature", new DateTime(2020,
signature.TimeStampServer = new TimeStampServer(new Uri("http://timestamp.digicert.com"));
signature.SignedName = "Test";
signature.Bounds = new RectangleF(new PointF(0, 0), new SizeF(200, 100));
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+document.Save("Form.pdf");
//Close the document.
document.Close(true);
@@ -1337,6 +1449,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Adds a new page.
@@ -1354,8 +1469,11 @@ document.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-
-'Creates a new PDF document.
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Adds a new page.
Dim page As PdfPage = document.Pages.Add()
@@ -1385,6 +1503,9 @@ The below code illustrates how to add the button field in new PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Add-the-button-field-in-a-new-PDF-document/.NET/Add-the-button-field-in-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -1398,10 +1519,8 @@ buttonField.Text = "Click";
//Add the form field to the document.
document.Form.Fields.Add(buttonField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-document.Save(stream);
+//Save the document.
+document.Save("Form.pdf");
//Close the document.
document.Close(true);
@@ -1409,6 +1528,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -1430,8 +1552,11 @@ document.Close(true);
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-
-'Create a new PDF document.
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to PDF document.
Dim page As PdfPage = document.Pages.Add()
@@ -1461,9 +1586,12 @@ Please refer the below code snippet for adding the button field in existing PDF
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Adding-button-field-in-an-existing-PDF-document/.NET/Adding-button-field-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if (loadedDocument.Form == null)
loadedDocument.CreateForm();
@@ -1477,10 +1605,8 @@ buttonField.Text = "Click";
//Add the form field to the existing document.
loadedDocument.Form.Fields.Add(buttonField);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the PDF document to stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Form.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -1488,8 +1614,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Create the form if the form does not exist in the loaded document.
if (loadedDocument.Form == null)
loadedDocument.CreateForm();
@@ -1510,10 +1640,14 @@ loadedDocument.Close(true);
{% endhighlight %}
-{% highlight c# tabtitle="C# [Windows-specific]" %}
+{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
-'Load the existing PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Create the form if the form does not exist in the loaded document.
If loadedDocument.Form Is Nothing Then
loadedDocument.CreateForm()
@@ -1547,6 +1681,9 @@ You can add a complex script language text in PDF AcroForm fields by using the [
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
@@ -1570,16 +1707,18 @@ document.Form.Fields.Add(textField);
//Set default appearance as false.
document.Form.SetDefaultAppearance(false);
-//Save the PDF document.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the PDF document.
+//Save the document.
+document.Save("Form.pdf");
+//Close the document.
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
@@ -1611,7 +1750,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create a new PDF document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
@@ -1657,6 +1799,9 @@ The following code example illustrates how to add complex script support for all
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
@@ -1680,16 +1825,18 @@ document.Form.SetDefaultAppearance(false);
//Enable complex script layout for form.
document.Form.ComplexScript = true;
-//Save the PDF document.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-//Close the PDF document.
+//Save the document.
+document.Save("Form.pdf");
+//Close the document.
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
@@ -1721,7 +1868,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create a new PDF document
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new PDF page
Dim page As PdfPage = document.Pages.Add()
@@ -1758,9 +1909,11 @@ You can also flatten the existing form fields with complex script layout by usin
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Flatten-the-existing-form-fields-with-complex-script/.NET/Flatten-the-existing-form-fields-with-complex-script/Program.cs" %}
-//Load the existing PDF document.
-FileStream inputFileStream = new FileStream("Form.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputFileStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+//Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the existing PDF form.
PdfLoadedForm lForm = loadedDocument.Form as PdfLoadedForm;
//Set the complex script layout.
@@ -1768,10 +1921,8 @@ lForm.ComplexScript = true;
//Set flatten.
lForm.Flatten = true;
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
//Save the document.
-loadedDocument.Save(stream);
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -1779,6 +1930,10 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Form.pdf");
//Get the existing PDF form.
@@ -1797,7 +1952,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the existing PDF document
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Form.pdf")
'Get the existing PDF form
Dim lForm As PdfLoadedForm = TryCast(loadedDocument.Form, PdfLoadedForm)
@@ -1835,9 +1994,12 @@ You can fill a text box field using [Text](https://help.syncfusion.com/cr/docume
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Filling-the-textbox-field-in-an-existing-PDF-document/.NET/Filling-the-textbox-field-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -1845,9 +2007,8 @@ PdfLoadedForm loadedForm = loadedDocument.Form;
PdfLoadedTextBoxField loadedTextBoxField = loadedForm.Fields[0] as PdfLoadedTextBoxField;
loadedTextBoxField.Text = "First Name";
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -1855,8 +2016,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -1873,8 +2038,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
@@ -1901,9 +2070,12 @@ You can fill a combo box field using [SelectedValue](https://help.syncfusion.com
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Fill-the-combobox-field-in-an-existing-PDF-document/.NET/Fill-the-combobox-field-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -1912,9 +2084,8 @@ PdfLoadedComboBoxField loadedComboboxField = loadedForm.Fields[1] as PdfLoadedCo
//Select the item.
loadedComboboxField.SelectedIndex = 1;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -1922,8 +2093,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -1941,8 +2116,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
@@ -1970,9 +2149,12 @@ You can fill a radio button field using [SelectedValue](https://help.syncfusion.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Fill-radio-button-field-in-an-existing-PDF-document/.NET/Fill-radio-button-field-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -1981,9 +2163,8 @@ PdfLoadedRadioButtonListField loadedRadioButtonField = loadedForm.Fields[3] as P
//Select the item.
loadedRadioButtonField.SelectedIndex = 1;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -1991,8 +2172,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2010,8 +2195,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
@@ -2039,9 +2228,12 @@ The below code snippet illustrates how to fill the list box field in an existing
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Fill-list-box-field-in-an-existing-PDF-document/.NET/Fill-list-box-field-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2050,9 +2242,8 @@ PdfLoadedListBoxField loadedListBox = loadedForm.Fields[2] as PdfLoadedListBoxFi
//Fill list box and Modify the list box select index.
loadedListBox.SelectedIndex = new int[2] { 1, 2 };
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -2060,8 +2251,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2079,8 +2274,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the existing PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
@@ -2108,9 +2307,12 @@ You can fill a check box field by enabling [Checked](https://help.syncfusion.com
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Fill-the-checkbox-field-in-an-existing-PDF-document/.NET/Fill-the-checkbox-field-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2121,9 +2323,8 @@ loadedCheckBoxField.Items[0].Checked = true;
//Check the checkbox if it is not grouped.
loadedCheckBoxField.Checked = true;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -2131,8 +2332,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2152,8 +2357,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
@@ -2183,9 +2392,12 @@ The below code snippet illustrates how to fill the signature field with certific
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Fill-the-signature-field-in-an-existing-PDF/.NET/Fill-the-signature-field-in-an-existing-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2199,9 +2411,8 @@ loadedSignatureField.Signature = new PdfSignature();
loadedSignatureField.Signature.Certificate = certificate;
loadedSignatureField.Signature.Reason = "Reason";
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -2209,8 +2420,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2232,8 +2447,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
Dim loadedPage As PdfLoadedPage = TryCast(loadedDocument.Pages(0), PdfLoadedPage)
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
@@ -2269,9 +2488,12 @@ The following code snippet illustrates how to fill XFA forms via Acroform API.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Fill-the-XFA-forms-fields-via-acroform-API/.NET/Fill-the-XFA-forms-fields-via-acroform-API/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the existing Acroform.
PdfLoadedForm acroform = loadedDocument.Form;
//Enable XFA form filling.
@@ -2285,10 +2507,8 @@ PdfLoadedTextBoxField lastName = acroform.Fields["LastName"] as PdfLoadedTextBox
//Set text.
lastName.Text = "Bistro";
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Form.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -2296,6 +2516,10 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the existing XFA PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Form.pdf");
//Get the existing Acroform.
@@ -2320,7 +2544,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the existing XFA PDF document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("Form.pdf")
'Get the existing Acroform.
Dim acroform As PdfLoadedForm = loadedDocument.Form
@@ -2356,9 +2584,12 @@ The following code example illustrates this.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Enumarate-form-fields-in-a-PDF-document/.NET/Enumarate-form-fields-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm form = document.Form;
@@ -2373,9 +2604,8 @@ for (int i = 0; i < fields.Count; i++)
}
}
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+document.Save("Form.pdf");
//Close the document.
document.Close(true);
@@ -2383,8 +2613,12 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument document = new PdfLoadedDocument(fileName);
+PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm form = document.Form;
@@ -2407,8 +2641,12 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim document As New PdfLoadedDocument(fileName)
+Dim document As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim form As PdfLoadedForm = document.Form
@@ -2445,6 +2683,9 @@ By default, the value is set to true. This is illustrated in the following code
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Auto-naming-of-form-fields-in-a-PDF-document/.NET/Auto-naming-of-form-fields-in-a-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to the PDF document.
@@ -2469,10 +2710,8 @@ textBoxField1.Text = "Doe";
//Add form field to the document.
document.Form.Fields.Add(textBoxField1);
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -2480,6 +2719,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to the PDF document.
@@ -2513,7 +2755,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create a new PDF document
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to the PDF document
Dim page As PdfPage = document.Pages.Add()
@@ -2563,9 +2809,12 @@ The following code snippet explains how to modify an existing form field in a PD
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Modify-the-existing-form-field-in-PDF-document/.NET/Modify-the-existing-form-field-in-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2577,9 +2826,8 @@ loadedTextBoxField.SpellCheck = true;
loadedTextBoxField.Text = "New text of the field.";
loadedTextBoxField.Password = false;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -2587,8 +2835,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2609,8 +2861,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
@@ -2643,9 +2899,12 @@ Please refer to the code example below to set the check box item.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Export_checkbox_values/.NET/Export_checkbox_values/Program.cs" %}
-//Load the PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2657,17 +2916,19 @@ PdfLoadedCheckBoxItem pdfLoadedCheckBoxItem = loadedCheckBoxField.Items[0] as Pd
//Set the Export value
pdfLoadedCheckBoxItem.ExportValue = "123";
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document.
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -2692,6 +2953,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
@@ -2724,9 +2989,12 @@ You can retrieve/modify the fore and background color of existing form fields in
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Modifying-fore-and-backcolor-of-existing-form-fields/.NET/Modifying-fore-and-backcolor-of-existing-form-fields/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2741,9 +3009,8 @@ PdfColor backColor = loadedTextBoxField.BackColor;
//Set the background color.
loadedTextBoxField.BackColor = new PdfColor(Color.Green);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -2751,8 +3018,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -2774,10 +3045,14 @@ loadedDocument.Close(true);
{% endhighlight %}
-{% highlight c# tabtitle="C# [Windows-specific]" %}
+{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
@@ -2813,9 +3088,12 @@ The following code example illustrates how to get option values from acroform ra
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Get-option-value-from-acroform-radio-button/.NET/Get-option-value-from-acroform-radio-button/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument doc = new PdfLoadedDocument(docStream);
+PdfLoadedDocument doc = new PdfLoadedDocument("Input.pdf");
//Gets the loaded form.
PdfLoadedForm form = doc.Form;
//Set default appearance to false.
@@ -2833,9 +3111,8 @@ foreach (PdfLoadedRadioButtonItem item in radioButtonField.Items)
}
}
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
+//Save the document.
+doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
@@ -2843,6 +3120,10 @@ doc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
//Gets the loaded form.
@@ -2870,7 +3151,11 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load an existing document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
Dim doc As New PdfLoadedDocument("SourceForm.pdf")
'Gets the loaded form.
Dim form As PdfLoadedForm = doc.Form
@@ -2907,9 +3192,12 @@ The following code snippet demonstrates how to retrieving an existing widget ann
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Loop through each page in the loaded PDF document.
foreach (PdfLoadedPage page in loadedDocument.Pages)
{
@@ -2942,6 +3230,10 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Loop through each page in the loaded PDF document.
@@ -2976,7 +3268,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Load the PDF document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
' Loop through each page in the loaded PDF document.
@@ -3020,9 +3316,12 @@ Refer to the code snippet below to retrieve a custom value from a form field usi
{% highlight c# tabtitle="C# [Cross-platform]" %}
-// Load the PDF document using a file stream
-FileStream docStream = new FileStream(@"Input.pdf", FileMode.Open, FileAccess.Read);
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the first page of the document
PdfField field = loadedDocument.Form.Fields[0] as PdfField;
@@ -3051,7 +3350,11 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
-// Load the PDF document using a file stream
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
+// Load the PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Gets the first page of the document
@@ -3082,7 +3385,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Load the PDF document
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
' Get the first form field from the document
@@ -3121,9 +3428,12 @@ The below code snippet explains how to get the field from collection using [TryG
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Get-the-field-from-collection-using-TryGetField/.NET/Get-the-field-from-collection-using-TryGetField/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument doc = new PdfLoadedDocument(docStream);
+PdfLoadedDocument doc = new PdfLoadedDocument("Input.pdf");
//Load the form from the loaded document.
PdfLoadedForm form = doc.Form;
@@ -3136,9 +3446,8 @@ if (fieldCollection.TryGetField("f1-1", out loadedField))
(loadedField as PdfLoadedTextBoxField).Text = "1";
}
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-doc.Save(stream);
+//Save the document.
+doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
@@ -3146,8 +3455,12 @@ doc.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the document.
-PdfLoadedDocument doc = new PdfLoadedDocument(fileName);
+PdfLoadedDocument doc = new PdfLoadedDocument("Input.pdf");
//Load the form from the loaded document.
PdfLoadedForm form = doc.Form;
@@ -3168,8 +3481,12 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Load the form from the loaded document.
Dim form As PdfLoadedForm = loadedDocument.Form
@@ -3201,9 +3518,12 @@ Please refer the below code snippet to get the field value from collection using
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Get-the-field-from-collection-using-TryGetValue/.NET/Get-the-field-from-collection-using-TryGetValue/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the form from the loaded document.
PdfLoadedForm form = loadedDocument.Form;
@@ -3213,9 +3533,8 @@ string fieldValue = string.Empty;
//Get the field value using TryGetValue Method.
fieldCollection.TryGetValue("FirstName", out fieldValue);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -3223,8 +3542,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(filename);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the form from the loaded document.
PdfLoadedForm form = loadedDocument.Form;
@@ -3242,8 +3565,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load the document.
-Dim loadedDocument As New PdfLoadedDocument(filename)
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Load the form from the loaded document.
Dim form As PdfLoadedForm = loadedDocument.Form
@@ -3273,11 +3600,12 @@ The below code illustrates get the pages of a form fields.
{% highlight c# tabtitle="C# [Cross-platform]" %}
-// Use the 'using' statement to automatically dispose of the FileStream when done.
-using (FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read))
-{
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Interactive;
+ using Syncfusion.Pdf.Parsing;
+
// Load the PDF document from the stream.
- PdfLoadedDocument document = new PdfLoadedDocument(docStream);
+ PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
// Get all the form fields in the PDF.
PdfLoadedForm loadedForm = document.Form;
@@ -3306,12 +3634,15 @@ using (FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAcc
// Close the PDF document.
document.Close(true);
-}
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
// Load the PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
@@ -3347,7 +3678,11 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Load the PDF document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
Dim document As New PdfLoadedDocument("Input.pdf")
' Get all the form fields in the PDF.
@@ -3389,9 +3724,12 @@ The below code illustrates how to remove the form fields from the existing PDF d
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Remove-the-form-fields-form-the-existing-PDF-document/.NET/Remove-the-form-fields-form-the-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the page.
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
//Get the loaded form.
@@ -3403,9 +3741,8 @@ loadedForm.Fields.Remove(loadedTextBoxField);
//Remove the field at index 0.
loadedForm.Fields.RemoveAt(0);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -3413,8 +3750,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C#" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the page.
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;
//Get the loaded form.
@@ -3433,10 +3774,14 @@ loadedDocument.Close(true);
{% endhighlight %}
-{% highlight vb.net tabtitle="VB.NET" %}
+{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
-'Load the PDF document
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Load the page
Dim loadedPage As PdfLoadedPage = TryCast(loadedDocument.Pages(0), PdfLoadedPage)
'Get the loaded form
@@ -3469,6 +3814,9 @@ Please refer the sample for flattening the form fields in new PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Removing-editing-capability-of-form-fields/.NET/Removing-editing-capability-of-form-fields/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -3483,9 +3831,8 @@ document.Form.Flatten = true;
//Add the form field to the document.
document.Form.Fields.Add(textBoxField);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+document.Save("Form.pdf");
//Close the document.
document.Close(true);
@@ -3493,6 +3840,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -3516,7 +3866,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create a new PDF document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to PDF document.
Dim page As PdfPage = document.Pages.Add()
@@ -3547,9 +3900,12 @@ Please refer the sample for flattening the form fields in existing PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Flattening-form-fields-in-an-existing-PDF-document/.NET/Flattening-form-fields-in-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
PdfLoadedFormFieldCollection fields = loadedForm.Fields;
@@ -3559,9 +3915,8 @@ loadedTextBoxField.Text = "Text";
//Flatten the whole form.
loadedForm.Flatten = true;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -3569,8 +3924,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm = loadedDocument.Form;
PdfLoadedFormFieldCollection fields = loadedForm.Fields;
@@ -3588,8 +3947,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
Dim fields As PdfLoadedFormFieldCollection = loadedForm.Fields
@@ -3619,18 +3982,19 @@ Please refer the code sample to flatten the form fields before saving the PDF do
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Flattening-form-fields-in-an-existing-PDF-document/.NET/Flattening-form-fields-in-an-existing-PDF-document/Program.cs" %}
-//Load an existing PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
//Flatten the form fields.
loadedForm.FlattenFields();
-//Create memory stream.
-MemoryStream stream = new MemoryStream();
-//Save the document into stream.
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("Output.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -3638,6 +4002,10 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load a PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Get the loaded form.
@@ -3654,6 +4022,10 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
@@ -3681,6 +4053,9 @@ The below code snippet illustrates how to set the [ReadOnly](https://help.syncfu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Set-readonly-property-to-a-new-PDF-document/.NET/Set-readonly-property-to-a-new-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -3698,9 +4073,8 @@ textBoxField.Text = "john";
//Add the form field to the document.
document.Form.Fields.Add(textBoxField);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+document.Save("Form.pdf");
//Close the document.
document.Close(true);
@@ -3708,6 +4082,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -3734,7 +4111,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create a new PDF document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to PDF document.
Dim page As PdfPage = document.Pages.Add()
@@ -3768,17 +4148,19 @@ The below code snippet illustrates how to set the [ReadOnly](https://help.syncfu
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Set-the-ReadOnly-property-to-an-existing-PDF-document/.NET/Set-the-ReadOnly-property-to-an-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
//Set the form as read only.
loadedForm.ReadOnly = true;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -3786,8 +4168,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
//Set the form as read only.
@@ -3802,8 +4188,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
'Set the form as read only.
@@ -3833,17 +4223,18 @@ The below code illustrates how to import FDF file to PDF.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Importing-FDF-file-to-PDF-document/.NET/Importing-FDF-file-to-PDF-document/Program.cs" %}
-//Get stream from an existing PDF document.
-FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get stream from an existing PDF document.
FileStream fdfStream = new FileStream("ImportFDF.fdf", FileMode.Open, FileAccess.Read);
//Import the FDF stream.
loadedDocument.Form.ImportDataFDF(fdfStream, true);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -3851,8 +4242,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the existing form.
PdfLoadedForm loadedForm = loadedDocument.Form;
//Load the FDF file.
@@ -3866,8 +4261,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load an existing document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Load the existing form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
'Load the FDF file.
@@ -3894,10 +4293,12 @@ The below code illustrates how to export FDF file from PDF document.
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Export-FDF-file-from-PDF-document/.NET/Export-FDF-file-from-PDF-document/Program.cs" %}
-//Get stream from an existing PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-//Load the PDF document from stream.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
+//Load the PDF document.
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load an existing form.
PdfLoadedForm loadedForm = loadedDocument.Form;
//Load the FDF file.
@@ -3911,8 +4312,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C#" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load an existing form.
PdfLoadedForm loadedForm = loadedDocument.Form;
//Export the existing PDF document to FDF file.
@@ -3922,10 +4327,14 @@ loadedDocument.Close(true);
{% endhighlight %}
-{% highlight vb.net tabtitle="VB.NET" %}
+{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
-'Load an existing document
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+'Load the PDF document.
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Load an existing form
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
'Export the existing PDF document to FDF file
@@ -3947,6 +4356,9 @@ You can set the export value of the check box field in PDF forms using [PdfCheck
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a new page to the PDF document.
@@ -3985,17 +4397,18 @@ checkBoxField2.BackColor = Color.YellowGreen;
// Add to form
form.Fields.Add(checkBoxField2);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document.
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a new page to the PDF document.
@@ -4043,7 +4456,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Create a new PDF document
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to the PDF document
Dim page As PdfPage = document.Pages.Add()
@@ -4102,6 +4518,9 @@ The following code example illustrates how to enable or disable unison functiona
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a new page to the PDF document.
@@ -4136,17 +4555,18 @@ reportFrequencyRadioList.Items.Add(monthlyItem);
// Add the radio button list field to the document's form fields
document.Form.Fields.Add(reportFrequencyRadioList);
-//Save the document into stream
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
-stream.Position = 0;
-//Closes the document
+//Save the document.
+document.Save("Output.pdf");
+//Close the document.
document.Close(true);
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a new page to the PDF document.
@@ -4190,7 +4610,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Create a new PDF document
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to the PDF document
Dim page As PdfPage = document.Pages.Add()
@@ -4273,9 +4696,12 @@ The following code snippet explains how to set appearance to the PDF form fields
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Set-appearance-to-the-PDF-form-fields/.NET/Set-appearance-to-the-PDF-form-fields/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
//Set the default appearance.
@@ -4285,9 +4711,8 @@ loadedForm.SetDefaultAppearance(false);
PdfLoadedTextBoxField loadedTextBoxField = loadedForm.Fields[0] as PdfLoadedTextBoxField;
loadedTextBoxField.Text ="text";
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -4295,8 +4720,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
//Set the default appearance.
@@ -4315,8 +4744,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
'Set the default appearance.
@@ -4371,6 +4804,9 @@ The following code snippet explains how to set the visibility of form fields in
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page of the document.
@@ -4387,10 +4823,8 @@ firstNameTextBox.Visibility = PdfFormFieldVisibility.Visible;
page.Graphics.DrawString("First Name", font, PdfBrushes.Black, 10, 55);
//Add the textbox in document.
document.Form.Fields.Add(firstNameTextBox);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -4398,6 +4832,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page of the document.
@@ -4414,10 +4851,8 @@ firstNameTextBox.Visibility = PdfFormFieldVisibility.Visible;
page.Graphics.DrawString("First Name", font, PdfBrushes.Black, 10, 55);
//Add the textbox in document.
document.Form.Fields.Add(firstNameTextBox);
-//Creating the stream object.
-MemoryStream stream = new MemoryStream();
-//Save the document as stream.
-document.Save(stream);
+//Save the document.
+document.Save("Output.pdf");
//Close the document.
document.Close(true);
@@ -4425,7 +4860,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create a new PDF document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Creates a new page and adds it as the last page of the document.
Dim page As PdfPage = document.Pages.Add()
@@ -4441,10 +4879,9 @@ firstNameTextBox.Visibility = PdfFormFieldVisibility.Visible
page.Graphics.DrawString("First Name", font, PdfBrushes.Black, 10, 55)
'Add the textbox in document.
document.Form.Fields.Add(firstNameTextBox)
-'Creating the stream object.
-Dim stream As New MemoryStream()
-'Save the document as stream.
-document.Save(stream)
+
+'Save the document.
+document.Save("Output.pdf")
'Close the document.
document.Close(True)
@@ -4464,11 +4901,12 @@ The following code example demonstrates how to modify these indicator colors pro
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Customize-indicator-colors/.NET/Customize-indicator-colors/Program.cs" %}
-// Open the input PDF file stream.
-using (FileStream fileStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read))
-{
+ using Syncfusion.Pdf;
+ using Syncfusion.Pdf.Interactive;
+ using Syncfusion.Pdf.Parsing;
+
// Load the PDF document from the input stream.
- PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileStream);
+ PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
// Access the existing form fields in the PDF.
PdfLoadedForm form = loadedDocument.Form;
@@ -4492,20 +4930,20 @@ using (FileStream fileStream = new FileStream("Input.pdf", FileMode.Open, FileAc
}
// Disable the default appearance to allow custom rendering of form fields.
form.SetDefaultAppearance(false);
- // Create the output file stream.
- using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite))
- {
- // Save the modified PDF document to the new file stream.
- loadedDocument.Save(outputFileStream);
- }
+
+ // Save the modified PDF document
+ loadedDocument.Save("Output.pdf");
// Close the PDF document.
loadedDocument.Close(true);
-}
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
// Load the PDF document from the input PDF file.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
@@ -4541,7 +4979,11 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-' Load the PDF document from the input PDF file.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
' Access the form fields in the loaded PDF document.
@@ -4585,9 +5027,12 @@ The following code illustrates how to set [AutoResizeText](https://help.syncfusi
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Auto-resize-the-text-of-textboxfield-in-a-PDF/.NET/Auto-resize-the-text-of-textboxfield-in-a-PDF/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -4598,9 +5043,8 @@ loadedField.AutoResizeText = true;
//Flatten the form.
form.Flatten = true;
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -4608,6 +5052,10 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load an existing document.
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
//Read the text box field.
@@ -4629,7 +5077,11 @@ doc.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Load an existing document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
+'Load the PDF document.
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
Dim form As PdfLoadedForm = doc.Form
@@ -4663,6 +5115,9 @@ The below code illustrates how to enable the default appearance in new PDF docum
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Enable-default-appearance-in-new-PDF-document/.NET/Enable-default-appearance-in-new-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -4677,9 +5132,8 @@ document.Form.Fields.Add(textBoxField);
//Enable the default Appearance.
document.Form.SetDefaultAppearance(false);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-document.Save(stream);
+//Save the document.
+document.Save("Form.pdf");
//Close the document.
document.Close(true);
@@ -4687,6 +5141,9 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new page to PDF document.
@@ -4710,7 +5167,10 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Create a new PDF document.
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+
+'Load the PDF document.
Dim document As New PdfDocument()
'Add a new page to PDF document.
Dim page As PdfPage = document.Pages.Add()
@@ -4741,9 +5201,12 @@ The below code illustrates how to enable the default appearance in existing PDF
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Forms/Enable-default-appearance-in-existing-PDF-document/.NET/Enable-default-appearance-in-existing-PDF-document/Program.cs" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-FileStream docStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -4753,9 +5216,8 @@ loadedTextBoxField.Text = "First Name";
//Enable the default Appearance.
loadedDocument.Form.SetDefaultAppearance(false);
-//Save the document into stream.
-MemoryStream stream = new MemoryStream();
-loadedDocument.Save(stream);
+//Save the document.
+loadedDocument.Save("flatten.pdf");
//Close the document.
loadedDocument.Close(true);
@@ -4763,8 +5225,12 @@ loadedDocument.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using Syncfusion.Pdf;
+using Syncfusion.Pdf.Interactive;
+using Syncfusion.Pdf.Parsing;
+
//Load the PDF document.
-PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);
+PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Get the loaded form.
PdfLoadedForm loadedForm = loadedDocument.Form;
@@ -4783,8 +5249,12 @@ loadedDocument.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports Syncfusion.Pdf
+Imports Syncfusion.Pdf.Interactive
+Imports Syncfusion.Pdf.Parsing
+
'Load the PDF document.
-Dim loadedDocument As New PdfLoadedDocument(fileName)
+Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
'Get the loaded form.
Dim loadedForm As PdfLoadedForm = loadedDocument.Form
diff --git a/Document-Processing/Word/Word-Processor/angular/accessibility.md b/Document-Processing/Word/Word-Processor/angular/accessibility.md
index f8958627f..65663f34e 100644
--- a/Document-Processing/Word/Word-Processor/angular/accessibility.md
+++ b/Document-Processing/Word/Word-Processor/angular/accessibility.md
@@ -16,7 +16,7 @@ The accessibility compliance for the Document editor component is outlined below
| -- | -- |
| [WCAG 2.2 Support](https://ej2.syncfusion.com/angular/documentation/common/accessibility#accessibility-standards) |
|
| [Section 508 Support](https://ej2.syncfusion.com/angular/documentation/common/accessibility#accessibility-standards) |
|
-| [Screen Reader Support](https://ej2.syncfusion.com/angular/documentation/common/accessibility#screen-reader-support) |
|
+| [Screen Reader Support](https://ej2.syncfusion.com/angular/documentation/common/accessibility#screen-reader-support) |
|
| [Right-To-Left Support](https://ej2.syncfusion.com/angular/documentation/common/accessibility#right-to-left-support) |
|
| [Color Contrast](https://ej2.syncfusion.com/angular/documentation/common/accessibility#color-contrast) |
|
| [Mobile Device Support](https://ej2.syncfusion.com/angular/documentation/common/accessibility#mobile-device-support) |
|
diff --git a/Document-Processing/Word/Word-Processor/angular/how-to/export-document-as-pdf.md b/Document-Processing/Word/Word-Processor/angular/how-to/export-document-as-pdf.md
index 7ce2f6924..475f72d64 100644
--- a/Document-Processing/Word/Word-Processor/angular/how-to/export-document-as-pdf.md
+++ b/Document-Processing/Word/Word-Processor/angular/how-to/export-document-as-pdf.md
@@ -17,8 +17,9 @@ In this article, we are going to see how to export the document as PDF format. Y
Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as pdf using [`exportAsImage`](https://ej2.syncfusion.com/angular/documentation/api/document-editor/#exportasimage) API. Here, all pages will be converted to image and inserted as pdf pages(works like print as PDF).
>Note:
-* You can install the pdf export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
-* There is one limitation we can’t search the text because we are exporting the pdf as image.
+* The Document Editor exports PDFs by converting pages into images on the client side, which may slightly increase file size compared to text-based PDFs.
+* Text search is not supported in the exported PDF, as the content is stored as images.
+* You can install the pdf export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
The following example code illustrates how to export the document as pdf in client-side.
diff --git a/Document-Processing/Word/Word-Processor/angular/styles.md b/Document-Processing/Word/Word-Processor/angular/styles.md
index 40795a2e9..040334bdb 100644
--- a/Document-Processing/Word/Word-Processor/angular/styles.md
+++ b/Document-Processing/Word/Word-Processor/angular/styles.md
@@ -18,7 +18,7 @@ A Style in document editor should have the following properties:
* **name**: Name of the style. All styles in a document have a unique name, which is used as an identifier when applying the style.
* **type**: Specifies the document elements that the style will target. For example, paragraph or character.
-* **next**: Specifies that the current style inherits the style set to this property. This is how hierarchical styles are defined.
+* **next**: Specifies the style that should be automatically applied to a new paragraph created after the current one.
* **link**: Provides a relation between the paragraph and character style.
* **characterFormat**: Specifies the properties of paragraph and character style.
* **paragraphFormat**: Specifies the properties of paragraph style.
diff --git a/Document-Processing/Word/Word-Processor/asp-net-core/how-to/export-document-as-pdf.md b/Document-Processing/Word/Word-Processor/asp-net-core/how-to/export-document-as-pdf.md
index 79aebabb6..a18c7b9c1 100644
--- a/Document-Processing/Word/Word-Processor/asp-net-core/how-to/export-document-as-pdf.md
+++ b/Document-Processing/Word/Word-Processor/asp-net-core/how-to/export-document-as-pdf.md
@@ -1,6 +1,6 @@
---
layout: post
-title: Export PDF Document in Document Editor Component |Syncfusion
+title: Export PDF in Document Editor Component |Syncfusion
description: Learn here all about export document as PDF in Syncfusion Document Editor component of Syncfusion Essential JS 2 and more.
platform: document-processing
control: Export Document As PDF
@@ -14,9 +14,12 @@ This article explains how to export the document as PDF format. You can export t
## Export the document as PDF in client-side
-Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as PDF using `exportAsImage` API. Here, all pages will be converted to image and inserted as PDF pages (works like print as PDF). There is one limitation, the text can't be searched because the PDF is exported as image.
+Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as PDF using `exportAsImage` API. Here, all pages will be converted to image and inserted as PDF pages (works like print as PDF).
-N> You can install the PDF export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
+>Note:
+* The Document Editor exports PDFs by converting pages into images on the client side, which may slightly increase file size compared to text-based PDFs.
+* Text search is not supported in the exported PDF, as the content is stored as images.
+* You can install the PDF export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
{% tabs %}
diff --git a/Document-Processing/Word/Word-Processor/asp-net-core/styles.md b/Document-Processing/Word/Word-Processor/asp-net-core/styles.md
index 27bd641e5..b7754f394 100644
--- a/Document-Processing/Word/Word-Processor/asp-net-core/styles.md
+++ b/Document-Processing/Word/Word-Processor/asp-net-core/styles.md
@@ -8,7 +8,7 @@ documentation: ug
---
-# Styles
+# Styles in Document Editor Control
Styles are useful for applying a set of formatting consistently throughout the document. In document editor, styles are created and added to a document programmatically or via the built-in Styles dialog.
@@ -18,7 +18,7 @@ A Style in document editor should have the following properties:
* **name**: Name of the style. All styles in a document have a unique name, which is used as an identifier when applying the style.
* **type**: Specifies the document elements that the style will target. For example, paragraph or character.
-* **next**: Specifies that the current style inherits the style set to this property. This is how hierarchical styles are defined.
+* **next**: Specifies the style that should be automatically applied to a new paragraph created after the current one.
* **link**: Provides a relation between the paragraph and character style.
* **characterFormat**: Specifies the properties of paragraph and character style.
* **paragraphFormat**: Specifies the properties of paragraph style.
diff --git a/Document-Processing/Word/Word-Processor/asp-net-mvc/how-to/export-document-as-pdf.md b/Document-Processing/Word/Word-Processor/asp-net-mvc/how-to/export-document-as-pdf.md
index d1a280574..5ffe74ec0 100644
--- a/Document-Processing/Word/Word-Processor/asp-net-mvc/how-to/export-document-as-pdf.md
+++ b/Document-Processing/Word/Word-Processor/asp-net-mvc/how-to/export-document-as-pdf.md
@@ -1,6 +1,6 @@
---
layout: post
-title: Export PDF Document in ASP.NET MVC Document Editor Component |Syncfusion
+title: Export PDF in ASP.NET MVC Document Editor Component |Syncfusion
description: Learn here all about export document as PDF in Syncfusion ASP.NET MVC Document Editor component of Syncfusion Essential JS 2 and more.
platform: document-processing
control: Export Document As PDF
@@ -14,9 +14,12 @@ This article explains how to export the document as PDF format. You can export t
## Export the document as PDF in client-side
-Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as PDF using `exportAsImage` API. Here, all pages will be converted to image and inserted as PDF pages (works like print as PDF). There is one limitation, the text can't be searched because the PDF is exported as image.
+Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as PDF using `exportAsImage` API. Here, all pages will be converted to image and inserted as PDF pages (works like print as PDF).
-N> You can install the PDF export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
+>Note:
+* The Document Editor exports PDFs by converting pages into images on the client side, which may slightly increase file size compared to text-based PDFs.
+* Text search is not supported in the exported PDF, as the content is stored as images.
+* You can install the PDF export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
{% tabs %}
@@ -82,4 +85,4 @@ public void ExportPdf([FromBody] SaveParameter data)
```
-Get the complete working sample in this [`link`](https://github.com/SyncfusionExamples/Export-document-as-PDF-in-Document-Editor/).
\ No newline at end of file
+Get the complete working sample in this [`link`](https://github.com/SyncfusionExamples/Export-document-as-PDF-in-Document-Editor/).
diff --git a/Document-Processing/Word/Word-Processor/asp-net-mvc/styles.md b/Document-Processing/Word/Word-Processor/asp-net-mvc/styles.md
index f87df2f8c..db13eb620 100644
--- a/Document-Processing/Word/Word-Processor/asp-net-mvc/styles.md
+++ b/Document-Processing/Word/Word-Processor/asp-net-mvc/styles.md
@@ -8,7 +8,7 @@ documentation: ug
---
-# Styles
+# Styles in Document Editor Control
Styles are useful for applying a set of formatting consistently throughout the document. In document editor, styles are created and added to a document programmatically or via the built-in Styles dialog.
@@ -18,7 +18,7 @@ A Style in document editor should have the following properties:
* **name**: Name of the style. All styles in a document have a unique name, which is used as an identifier when applying the style.
* **type**: Specifies the document elements that the style will target. For example, paragraph or character.
-* **next**: Specifies that the current style inherits the style set to this property. This is how hierarchical styles are defined.
+* **next**: Specifies the style that should be automatically applied to a new paragraph created after the current one.
* **link**: Provides a relation between the paragraph and character style.
* **characterFormat**: Specifies the properties of paragraph and character style.
* **paragraphFormat**: Specifies the properties of paragraph style.
diff --git a/Document-Processing/Word/Word-Processor/blazor/accessibility.md b/Document-Processing/Word/Word-Processor/blazor/accessibility.md
index 675369aaa..24c3be62f 100644
--- a/Document-Processing/Word/Word-Processor/blazor/accessibility.md
+++ b/Document-Processing/Word/Word-Processor/blazor/accessibility.md
@@ -17,7 +17,7 @@ The accessibility compliance for the Blazor Document Editor component is outline
| -- | -- |
| [WCAG 2.2 Support](https://blazor.syncfusion.com/documentation/common/accessibility#accessibility-standards) |
|
| [Section 508 Support](https://blazor.syncfusion.com/documentation/common/accessibility#accessibility-standards) |
|
-| [Screen Reader Support](https://blazor.syncfusion.com/documentation/common/accessibility#screen-reader-support) |
|
+| [Screen Reader Support](https://blazor.syncfusion.com/documentation/common/accessibility#screen-reader-support) |
|
| [Right-To-Left Support](https://blazor.syncfusion.com/documentation/common/accessibility#right-to-left-support) |
|
| [Color Contrast](https://blazor.syncfusion.com/documentation/common/accessibility#color-contrast) |
|
| [Mobile Device Support](https://blazor.syncfusion.com/documentation/common/accessibility#mobile-device-support) |
|
diff --git a/Document-Processing/Word/Word-Processor/blazor/styles.md b/Document-Processing/Word/Word-Processor/blazor/styles.md
index a8088c46e..e6d317ce6 100644
--- a/Document-Processing/Word/Word-Processor/blazor/styles.md
+++ b/Document-Processing/Word/Word-Processor/blazor/styles.md
@@ -17,7 +17,7 @@ A Style in document editor should have the following properties:
* **name**: Name of the style. All styles in a document have a unique name, which is used as an identifier when applying the style.
* **type**: Specifies the document elements that the style will target. For example, paragraph or character.
-* **next**: Specifies that the current style inherits the style set to this property. This is how hierarchical styles are defined.
+* **next**: Specifies the style that should be automatically applied to a new paragraph created after the current one.
* **link**: Provides a relation between the paragraph and character style.
* **characterFormat**: Specifies the properties of paragraph and character style.
* **paragraphFormat**: Specifies the properties of paragraph style.
diff --git a/Document-Processing/Word/Word-Processor/javascript-es5/accessibility.md b/Document-Processing/Word/Word-Processor/javascript-es5/accessibility.md
index 28eb64d02..92228fcc3 100644
--- a/Document-Processing/Word/Word-Processor/javascript-es5/accessibility.md
+++ b/Document-Processing/Word/Word-Processor/javascript-es5/accessibility.md
@@ -1,6 +1,6 @@
---
layout: post
-title: Accessibility in JavaScript (ES5) Document editor component | Syncfusion
+title: Accessibility in JavaScript (ES5) Document editor | Syncfusion
description: Learn here all about Accessibility in Syncfusion JavaScript (ES5) Document editor component of Syncfusion Essential JS 2 and more.
control: Accessibility
platform: document-processing
@@ -16,7 +16,7 @@ The accessibility compliance for the Document editor component is outlined below
| -- | -- |
| [WCAG 2.2 Support](https://ej2.syncfusion.com/javascript/documentation/common/accessibility#accessibility-standards) |
|
| [Section 508 Support](https://ej2.syncfusion.com/javascript/documentation/common/accessibility#accessibility-standards) |
|
-| [Screen Reader Support](https://ej2.syncfusion.com/javascript/documentation/common/accessibility#screen-reader-support) |
|
+| [Screen Reader Support](https://ej2.syncfusion.com/javascript/documentation/common/accessibility#screen-reader-support) |
|
| [Right-To-Left Support](https://ej2.syncfusion.com/javascript/documentation/common/accessibility#right-to-left-support) |
|
| [Color Contrast](https://ej2.syncfusion.com/javascript/documentation/common/accessibility#color-contrast) |
|
| [Mobile Device Support](https://ej2.syncfusion.com/javascript/documentation/common/accessibility#mobile-device-support) |
|
diff --git a/Document-Processing/Word/Word-Processor/javascript-es5/how-to/export-document-as-pdf.md b/Document-Processing/Word/Word-Processor/javascript-es5/how-to/export-document-as-pdf.md
index 8bd77ef01..bcf883f27 100644
--- a/Document-Processing/Word/Word-Processor/javascript-es5/how-to/export-document-as-pdf.md
+++ b/Document-Processing/Word/Word-Processor/javascript-es5/how-to/export-document-as-pdf.md
@@ -1,6 +1,6 @@
---
layout: post
-title: Export document as pdf in JavaScript (ES5) Document editor control | Syncfusion
+title: Export PDF in JavaScript (ES5) Document editor | Syncfusion
description: Learn here all about Export document as pdf in Syncfusion JavaScript (ES5) Document editor control of Syncfusion Essential JS 2 and more.
platform: document-processing
control: Export document as pdf
@@ -10,15 +10,16 @@ domainurl: ##DomainURL##
# Export document as pdf in JavaScript (ES5) Document editor control
-In this article, we are going to see how to export the document as Pdf format. You can export the document as Pdf in following ways:
+In this article, we are going to see how to export the document as PDF format. You can export the document as PDF in following ways:
## Export the document as pdf in client-side
-Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as pdf using [`exportAsImage`](https://ej2.syncfusion.com/javascript/documentation/api/document-editor#exportasimage) API. Here, all pages will be converted to image and inserted as pdf pages(works like print as PDF).
+Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as pdf using [`exportAsImage`](https://ej2.syncfusion.com/javascript/documentation/api/document-editor/#exportasimage) API. Here, all pages will be converted to image and inserted as pdf pages(works like print as PDF).
>Note:
+* The Document Editor exports PDFs by converting pages into images on the client side, which may slightly increase file size compared to text-based PDFs.
+* Text search is not supported in the exported PDF, as the content is stored as images.
* You can install the pdf export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
-* There is one limitation we can’t search the text because we are exporting the pdf as image.
The following example code illustrates how to export the document as pdf in client-side.
@@ -68,11 +69,11 @@ The following example code illustrates how to export the document as pdf in clie
## Export document as pdf in server-side using Syncfusion® DocIO
-With the help of [`Synfusion DocIO`](https://help.syncfusion.com/file-formats/docio/word-to-pdf), you can export the document as Pdf in server-side. Here, you can search the text.
+With the help of [`Syncfusion DocIO`](https://help.syncfusion.com/file-formats/docio/word-to-pdf), you can export the document as PDF in server-side. Here, you can search the text.
-The following way illustrates how to convert the document as Pdf:
+The following way illustrates how to convert the document as PDF:
-* Using [`serialize`](https://ej2.syncfusion.com/javascript/documentation/api/document-editor#serialize) API, convert the document as Sfdt and send it to server-side.
+* Using [`serialize`](https://ej2.syncfusion.com/javascript/documentation/api/document-editor/#serialize) API, convert the document as Sfdt and send it to server-side.
The following example code illustrates how to convert the document to sfdt and pass it to server-side.
@@ -104,7 +105,7 @@ document.getElementById('export').addEventListener('click', function () {
> The Web API hosted link `https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/` utilized in the Document Editor's serviceUrl property is intended solely for demonstration and evaluation purposes. For production deployment, please host your own web service with your required server configurations. You can refer and reuse the [GitHub Web Service example](https://github.com/SyncfusionExamples/EJ2-DocumentEditor-WebServices) or [Docker image](https://hub.docker.com/r/syncfusion/word-processor-server) for hosting your own web service and use for the serviceUrl property.
* Using Save API in server-side, you can convert the sfdt to stream.
-* Finally, convert the stream to Pdf using [`Syncfusion.DocIORenderer.Net.Core`](https://www.nuget.org/packages/Syncfusion.DocIORenderer.Net.Core) library.
+* Finally, convert the stream to PDF using [`Syncfusion.DocIORenderer.Net.Core`](https://www.nuget.org/packages/Syncfusion.DocIORenderer.Net.Core) library.
The following example code illustrates how to process the sfdt in server-side.
diff --git a/Document-Processing/Word/Word-Processor/javascript-es5/styles.md b/Document-Processing/Word/Word-Processor/javascript-es5/styles.md
index 8956f91f5..56527a2d6 100644
--- a/Document-Processing/Word/Word-Processor/javascript-es5/styles.md
+++ b/Document-Processing/Word/Word-Processor/javascript-es5/styles.md
@@ -18,7 +18,7 @@ A Style in Document Editor should have the following properties:
* **name**: Name of the style. All styles in a document have a unique name, which is used as an identifier when applying the style.
* **type**: Specifies the document elements that the style will target. For example, paragraph or character.
-* **next**: Specifies that the current style inherits the style set to this property. This is how hierarchical styles are defined.
+* **next**: Specifies the style that should be automatically applied to a new paragraph created after the current one.
* **link**: Provides a relation between the paragraph and character style.
* **characterFormat**: Specifies the properties of paragraph and character style.
* **paragraphFormat**: Specifies the properties of paragraph style.
@@ -206,7 +206,7 @@ let paragraphStyles = documentEditor.getStyles('Character');
## Modify an existing style
-You can modify a existing style with the specified style properties using [`createStyle`](https://ej2.syncfusion.com/javascript/documentation/api/document-editor/editor#createStyle) method. If modifyExistingStyle parameter is set to `true` the style properties is updated to the existing style.
+You can modify a existing style with the specified style properties using [`createStyle`](https://ej2.syncfusion.com/javascript/documentation/api/document-editor/editor/#createStyle) method. If modifyExistingStyle parameter is set to `true` the style properties is updated to the existing style.
The following illustrate to modify an existing style.
diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/accessibility.md b/Document-Processing/Word/Word-Processor/javascript-es6/accessibility.md
index e7b9c8f6b..a0444b172 100644
--- a/Document-Processing/Word/Word-Processor/javascript-es6/accessibility.md
+++ b/Document-Processing/Word/Word-Processor/javascript-es6/accessibility.md
@@ -1,6 +1,6 @@
---
layout: post
-title: Accessibility in JavaScript (ES6) Document editor component | Syncfusion
+title: Accessibility in JavaScript (ES6) Document editor | Syncfusion
description: Learn here all about Accessibility in Syncfusion JavaScript (ES6) Document editor component of Syncfusion Essential JS 2 and more.
control: Accessibility
platform: document-processing
@@ -16,7 +16,7 @@ The accessibility compliance for the Document editor component is outlined below
| -- | -- |
| [WCAG 2.2 Support](https://ej2.syncfusion.com/documentation/common/accessibility#accessibility-standards) |
|
| [Section 508 Support](https://ej2.syncfusion.com/documentation/common/accessibility#accessibility-standards) |
|
-| [Screen Reader Support](https://ej2.syncfusion.com/documentation/common/accessibility#screen-reader-support) |
|
+| [Screen Reader Support](https://ej2.syncfusion.com/documentation/common/accessibility#screen-reader-support) |
|
| [Right-To-Left Support](https://ej2.syncfusion.com/documentation/common/accessibility#right-to-left-support) |
|
| [Color Contrast](https://ej2.syncfusion.com/documentation/common/accessibility#color-contrast) |
|
| [Mobile Device Support](https://ej2.syncfusion.com/documentation/common/accessibility#mobile-device-support) |
|
diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/how-to/export-document-as-pdf.md b/Document-Processing/Word/Word-Processor/javascript-es6/how-to/export-document-as-pdf.md
index b89656784..5f99388ae 100644
--- a/Document-Processing/Word/Word-Processor/javascript-es6/how-to/export-document-as-pdf.md
+++ b/Document-Processing/Word/Word-Processor/javascript-es6/how-to/export-document-as-pdf.md
@@ -1,6 +1,6 @@
---
layout: post
-title: Export document as pdf in JavaScript (ES6) Document editor control | Syncfusion
+title: Export PDF in JavaScript (ES6) Document editor | Syncfusion
description: Learn here all about Export document as pdf in Syncfusion JavaScript (ES6) Document editor control of Syncfusion Essential JS 2 and more.
platform: document-processing
control: Export document as pdf
@@ -10,15 +10,16 @@ domainurl: ##DomainURL##
# Export document as pdf in JavaScript (ES6) Document editor control
-In this article, we are going to see how to export the document as Pdf format. You can export the document as Pdf in following ways:
+In this article, we are going to see how to export the document as PDF format. You can export the document as PDF in following ways:
## Export the document as pdf in client-side
-Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as pdf using [`exportAsImage`](https://ej2.syncfusion.com/documentation/api/document-editor#exportasimage) API. Here, all pages will be converted to image and inserted as pdf pages(works like print as PDF).
+Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as pdf using [`exportAsImage`](https://ej2.syncfusion.com/documentation/api/document-editor/#exportasimage) API. Here, all pages will be converted to image and inserted as pdf pages(works like print as PDF).
>Note:
-* You can install the pdf export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
-* There is one limitation we can’t search the text because we are exporting the pdf as image.
+* The Document Editor exports PDFs by converting pages into images on the client side, which may slightly increase file size compared to text-based PDFs.
+* Text search is not supported in the exported PDF, as the content is stored as images.
+* You can install the pdf export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
The following example code illustrates how to export the document as pdf in client-side.
@@ -97,11 +98,11 @@ document.getElementById('export').addEventListener('click', function () {
## Export document as pdf in server-side using Syncfusion® DocIO
-With the help of [`Synfusion DocIO`](https://help.syncfusion.com/file-formats/docio/word-to-pdf), you can export the document as Pdf in server-side. Here, you can search the text.
+With the help of [`Syncfusion DocIO`](https://help.syncfusion.com/file-formats/docio/word-to-pdf), you can export the document as PDF in server-side. Here, you can search the text.
-The following way illustrates how to convert the document as Pdf:
+The following way illustrates how to convert the document as PDF:
-* Using [`serialize`](https://ej2.syncfusion.com/documentation/api/document-editor#serialize) API, convert the document as Sfdt and send it to server-side.
+* Using [`serialize`](https://ej2.syncfusion.com/documentation/api/document-editor/#serialize) API, convert the document as Sfdt and send it to server-side.
The following example code illustrates how to convert the document to sfdt and pass it to server-side.
@@ -133,7 +134,7 @@ document.getElementById('export').addEventListener('click', function () {
> The Web API hosted link `https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/` utilized in the Document Editor's serviceUrl property is intended solely for demonstration and evaluation purposes. For production deployment, please host your own web service with your required server configurations. You can refer and reuse the [GitHub Web Service example](https://github.com/SyncfusionExamples/EJ2-DocumentEditor-WebServices) or [Docker image](https://hub.docker.com/r/syncfusion/word-processor-server) for hosting your own web service and use for the serviceUrl property.
* Using Save API in server-side, you can convert the sfdt to stream.
-* Finally, convert the stream to Pdf using [`Syncfusion.DocIORenderer.Net.Core`](https://www.nuget.org/packages/Syncfusion.DocIORenderer.Net.Core) library.
+* Finally, convert the stream to PDF using [`Syncfusion.DocIORenderer.Net.Core`](https://www.nuget.org/packages/Syncfusion.DocIORenderer.Net.Core) library.
The following example code illustrates how to process the sfdt in server-side.
diff --git a/Document-Processing/Word/Word-Processor/javascript-es6/styles.md b/Document-Processing/Word/Word-Processor/javascript-es6/styles.md
index ed1627bef..18a11c916 100644
--- a/Document-Processing/Word/Word-Processor/javascript-es6/styles.md
+++ b/Document-Processing/Word/Word-Processor/javascript-es6/styles.md
@@ -18,7 +18,7 @@ A Style in Document Editor should have the following properties:
* **name**: Name of the style. All styles in a document have a unique name, which is used as an identifier when applying the style.
* **type**: Specifies the document elements that the style will target. For example, paragraph or character.
-* **next**: Specifies that the current style inherits the style set to this property. This is how hierarchical styles are defined.
+* **next**: Specifies the style that should be automatically applied to a new paragraph created after the current one.
* **link**: Provides a relation between the paragraph and character style.
* **characterFormat**: Specifies the properties of paragraph and character style.
* **paragraphFormat**: Specifies the properties of paragraph style.
@@ -187,7 +187,7 @@ let paragraphStyles = documentEditor.getStyles('Character');
## Modify an existing style
-You can modify a existing style with the specified style properties using [`createStyle`](https://ej2.syncfusion.com/documentation/api/document-editor/editor#createStyle) method. If modifyExistingStyle parameter is set to `true` the style properties is updated to the existing style.
+You can modify a existing style with the specified style properties using [`createStyle`](https://ej2.syncfusion.com/documentation/api/document-editor/editor/#createStyle) method. If modifyExistingStyle parameter is set to `true` the style properties is updated to the existing style.
The following illustrate to modify an existing style.
diff --git a/Document-Processing/Word/Word-Processor/react/accessibility.md b/Document-Processing/Word/Word-Processor/react/accessibility.md
index 20cb00a98..fc61aca68 100644
--- a/Document-Processing/Word/Word-Processor/react/accessibility.md
+++ b/Document-Processing/Word/Word-Processor/react/accessibility.md
@@ -16,7 +16,7 @@ The accessibility compliance for the Document editor component is outlined below
| -- | -- |
| [WCAG 2.2 Support](https://ej2.syncfusion.com/react/documentation/common/accessibility#accessibility-standards) |
|
| [Section 508 Support](https://ej2.syncfusion.com/react/documentation/common/accessibility#accessibility-standards) |
|
-| [Screen Reader Support](https://ej2.syncfusion.com/react/documentation/common/accessibility#screen-reader-support) |
|
+| [Screen Reader Support](https://ej2.syncfusion.com/react/documentation/common/accessibility#screen-reader-support) |
|
| [Right-To-Left Support](https://ej2.syncfusion.com/react/documentation/common/accessibility#right-to-left-support) |
|
| [Color Contrast](https://ej2.syncfusion.com/react/documentation/common/accessibility#color-contrast) |
|
| [Mobile Device Support](https://ej2.syncfusion.com/react/documentation/common/accessibility#mobile-device-support) |
|
diff --git a/Document-Processing/Word/Word-Processor/react/how-to/export-document-as-pdf.md b/Document-Processing/Word/Word-Processor/react/how-to/export-document-as-pdf.md
index 7159882ce..b3db064b8 100644
--- a/Document-Processing/Word/Word-Processor/react/how-to/export-document-as-pdf.md
+++ b/Document-Processing/Word/Word-Processor/react/how-to/export-document-as-pdf.md
@@ -10,13 +10,16 @@ domainurl: ##DomainURL##
# Export document as pdf in React Document editor component
-In this article, we are going to see how to export the document as Pdf format. You can export the document as Pdf in following ways:
+In this article, we are going to see how to export the document as PDF format. You can export the document as PDF in following ways:
## Export the document as pdf in client-side
-Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as pdf using [`exportAsImage`](https://ej2.syncfusion.com/react/documentation/api/document-editor#exportasimage) API. Here, all pages will be converted to image and inserted as pdf pages(works like print as PDF). There is one limitation we can’t search the text because we are exporting the pdf as image.
+Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as pdf using [`exportAsImage`](https://ej2.syncfusion.com/react/documentation/api/document-editor/#exportasimage) API. Here, all pages will be converted to image and inserted as pdf pages(works like print as PDF).
->Note: You can install the pdf export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
+>Note:
+* The Document Editor exports PDFs by converting pages into images on the client side, which may slightly increase file size compared to text-based PDFs.
+* Text search is not supported in the exported PDF, as the content is stored as images.
+* You can install the pdf export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
The following example code illustrates how to export the document as pdf in client-side.
@@ -100,11 +103,11 @@ ReactDOM.render(, document.getElementById('sample'));
## Export document as pdf in server-side using Syncfusion® DocIO
-With the help of [`Synfusion DocIO`](https://help.syncfusion.com/file-formats/docio/word-to-pdf), you can export the document as Pdf in server-side. Here, you can search the text.
+With the help of [`Syncfusion DocIO`](https://help.syncfusion.com/file-formats/docio/word-to-pdf), you can export the document as PDF in server-side. Here, you can search the text.
-The following way illustrates how to convert the document as Pdf:
+The following way illustrates how to convert the document as PDF:
-* Using [`serialize`](https://ej2.syncfusion.com/react/documentation/api/document-editor#serialize) API, convert the document as Sfdt and send it to server-side.
+* Using [`serialize`](https://ej2.syncfusion.com/react/documentation/api/document-editor/#serialize) API, convert the document as Sfdt and send it to server-side.
The following example code illustrates how to convert the document to sfdt and pass it to server-side.
@@ -150,7 +153,7 @@ ReactDOM.render(, document.getElementById('sample'));
> The Web API hosted link `https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/` utilized in the Document Editor's serviceUrl property is intended solely for demonstration and evaluation purposes. For production deployment, please host your own web service with your required server configurations. You can refer and reuse the [GitHub Web Service example](https://github.com/SyncfusionExamples/EJ2-DocumentEditor-WebServices) or [Docker image](https://hub.docker.com/r/syncfusion/word-processor-server) for hosting your own web service and use for the serviceUrl property.
* Using Save API in server-side, you can convert the sfdt to stream.
-* Finally, convert the stream to Pdf using [`Syncfusion.DocIORenderer.Net.Core`](https://www.nuget.org/packages/Syncfusion.DocIORenderer.Net.Core) library.
+* Finally, convert the stream to PDF using [`Syncfusion.DocIORenderer.Net.Core`](https://www.nuget.org/packages/Syncfusion.DocIORenderer.Net.Core) library.
The following example code illustrates how to process the sfdt in server-side.
diff --git a/Document-Processing/Word/Word-Processor/react/styles.md b/Document-Processing/Word/Word-Processor/react/styles.md
index 65e3db229..8c6b2ffd5 100644
--- a/Document-Processing/Word/Word-Processor/react/styles.md
+++ b/Document-Processing/Word/Word-Processor/react/styles.md
@@ -18,7 +18,7 @@ A Style in document editor should have the following properties:
* **name**: Name of the style. All styles in a document have a unique name, which is used as an identifier when applying the style.
* **type**: Specifies the document elements that the style will target. For example, paragraph or character.
-* **next**: Specifies that the current style inherits the style set to this property. This is how hierarchical styles are defined.
+* **next**: Specifies the style that should be automatically applied to a new paragraph created after the current one.
* **link**: Provides a relation between the paragraph and character style.
* **characterFormat**: Specifies the properties of paragraph and character style.
* **paragraphFormat**: Specifies the properties of paragraph style.
diff --git a/Document-Processing/Word/Word-Processor/vue/accessibility.md b/Document-Processing/Word/Word-Processor/vue/accessibility.md
index 3b9202ec6..4edd52805 100644
--- a/Document-Processing/Word/Word-Processor/vue/accessibility.md
+++ b/Document-Processing/Word/Word-Processor/vue/accessibility.md
@@ -16,7 +16,7 @@ The accessibility compliance for the Document editor component is outlined below
| -- | -- |
| [WCAG 2.2 Support](https://ej2.syncfusion.com/vue/documentation/common/accessibility#accessibility-standards) |
|
| [Section 508 Support](https://ej2.syncfusion.com/vue/documentation/common/accessibility#accessibility-standards) |
|
-| [Screen Reader Support](https://ej2.syncfusion.com/vue/documentation/common/accessibility#screen-reader-support) |
|
+| [Screen Reader Support](https://ej2.syncfusion.com/vue/documentation/common/accessibility#screen-reader-support) |
|
| [Right-To-Left Support](https://ej2.syncfusion.com/vue/documentation/common/accessibility#right-to-left-support) |
|
| [Color Contrast](https://ej2.syncfusion.com/vue/documentation/common/accessibility#color-contrast) |
|
| [Mobile Device Support](https://ej2.syncfusion.com/vue/documentation/common/accessibility#mobile-device-support) |
|
diff --git a/Document-Processing/Word/Word-Processor/vue/how-to/export-document-as-pdf.md b/Document-Processing/Word/Word-Processor/vue/how-to/export-document-as-pdf.md
index 1255a77a3..3a7b7ff7c 100644
--- a/Document-Processing/Word/Word-Processor/vue/how-to/export-document-as-pdf.md
+++ b/Document-Processing/Word/Word-Processor/vue/how-to/export-document-as-pdf.md
@@ -10,13 +10,16 @@ domainurl: ##DomainURL##
# Export document as pdf in Vue Document editor component
-In this article, we are going to see how to export the document as Pdf format. You can export the document as Pdf in following ways:
+In this article, we are going to see how to export the document as PDF format. You can export the document as PDF in following ways:
## Export the document as pdf in client-side
-Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as pdf using [`exportAsImage`](https://ej2.syncfusion.com/vue/documentation/api/document-editor#exportasimage) API. Here, all pages will be converted to image and inserted as pdf pages(works like print as PDF). There is one limitation we can’t search the text because we are exporting the pdf as image.
+Use [`pdf export component`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export) in application level to export the document as pdf using [`exportAsImage`](https://ej2.syncfusion.com/vue/documentation/api/document-editor/#exportasimage) API. Here, all pages will be converted to image and inserted as pdf pages(works like print as PDF).
->Note: You can install the pdf export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
+>Note:
+* The Document Editor exports PDFs by converting pages into images on the client side, which may slightly increase file size compared to text-based PDFs.
+* Text search is not supported in the exported PDF, as the content is stored as images.
+* You can install the pdf export packages from this [`link`](https://www.npmjs.com/package/@syncfusion/ej2-pdf-export).
The following example code illustrates how to export the document as pdf in client-side.
@@ -180,11 +183,11 @@ export default {
## Export document as pdf in server-side using Syncfusion® DocIO
-With the help of [`Synfusion DocIO`](https://help.syncfusion.com/file-formats/docio/word-to-pdf), you can export the document as Pdf in server-side. Here, you can search the text.
+With the help of [`Syncfusion DocIO`](https://help.syncfusion.com/file-formats/docio/word-to-pdf), you can export the document as PDF in server-side. Here, you can search the text.
-The following way illustrates how to convert the document as Pdf:
+The following way illustrates how to convert the document as PDF:
-* Using [`serialize`](https://ej2.syncfusion.com/vue/documentation/api/document-editor#serialize) API, convert the document as Sfdt and send it to server-side.
+* Using [`serialize`](https://ej2.syncfusion.com/vue/documentation/api/document-editor/#serialize) API, convert the document as Sfdt and send it to server-side.
The following example code illustrates how to convert the document to sfdt and pass it to server-side.
@@ -270,7 +273,7 @@ export default {
> The Web API hosted link `https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/` utilized in the Document Editor's serviceUrl property is intended solely for demonstration and evaluation purposes. For production deployment, please host your own web service with your required server configurations. You can refer and reuse the [GitHub Web Service example](https://github.com/SyncfusionExamples/EJ2-DocumentEditor-WebServices) or [Docker image](https://hub.docker.com/r/syncfusion/word-processor-server) for hosting your own web service and use for the serviceUrl property.
* Using Save API in server-side, you can convert the sfdt to stream.
-* Finally, convert the stream to Pdf using [`Syncfusion.DocIORenderer.Net.Core`](https://www.nuget.org/packages/Syncfusion.DocIORenderer.Net.Core) library.
+* Finally, convert the stream to PDF using [`Syncfusion.DocIORenderer.Net.Core`](https://www.nuget.org/packages/Syncfusion.DocIORenderer.Net.Core) library.
The following example code illustrates how to process the sfdt in server-side.
diff --git a/Document-Processing/Word/Word-Processor/vue/styles.md b/Document-Processing/Word/Word-Processor/vue/styles.md
index c73d404d4..b2d80cb26 100644
--- a/Document-Processing/Word/Word-Processor/vue/styles.md
+++ b/Document-Processing/Word/Word-Processor/vue/styles.md
@@ -18,7 +18,7 @@ A Style in document editor should have the following properties:
* **name**: Name of the style. All styles in a document have a unique name, which is used as an identifier when applying the style.
* **type**: Specifies the document elements that the style will target. For example, paragraph or character.
-* **next**: Specifies that the current style inherits the style set to this property. This is how hierarchical styles are defined.
+* **next**: Specifies the style that should be automatically applied to a new paragraph created after the current one.
* **link**: Provides a relation between the paragraph and character style.
* **characterFormat**: Specifies the properties of paragraph and character style.
* **paragraphFormat**: Specifies the properties of paragraph style.
@@ -185,7 +185,7 @@ let paragraphStyles = this.$refs.documenteditor.ej2Instances.documentEditor.getS
## Modify an existing style
-You can modify a existing style with the specified style properties using [`createStyle`](https://ej2.syncfusion.com/vue/documentation/api/document-editor/editor#createStyle) method. If modifyExistingStyle parameter is set to `true` the style properties is updated to the existing style.
+You can modify a existing style with the specified style properties using [`createStyle`](https://ej2.syncfusion.com/vue/documentation/api/document-editor/editor/#createStyle) method. If modifyExistingStyle parameter is set to `true` the style properties is updated to the existing style.
The following illustrate to modify an existing style.