Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Drawing;
using Syncfusion.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Interactive;
Expand Down Expand Up @@ -38,10 +36,6 @@
emailField.ToolTip = "Email address";
pdfDocument.Form.Fields.Add(emailField);

//Create file stream.
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 PDF document
pdfDocument.Save(Path.GetFullPath(@"Output/Output.pdf"));
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Pdf;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Interactive;

//Create a new PDF document.
PdfDocument document = new PdfDocument();

//Add a new page to PDF document.
PdfPage page = document.Pages.Add();

//Create Check Box field.
PdfCheckBoxField checkBoxField = new PdfCheckBoxField(page, "CheckBox");
using (PdfDocument document = new PdfDocument())
{
//Add a new page to PDF document.
PdfPage page = document.Pages.Add();

//Set check box properties.
checkBoxField.ToolTip = "Check Box";
checkBoxField.Bounds = new Syncfusion.Drawing.RectangleF(0, 20, 10, 10);
//Create Check Box field.
PdfCheckBoxField checkBoxField = new PdfCheckBoxField(page, "CheckBox");

//Add the form field to the document.
document.Form.Fields.Add(checkBoxField);
//Set check box properties.
checkBoxField.ToolTip = "Check Box";
checkBoxField.Bounds = new Syncfusion.Drawing.RectangleF(0, 20, 10, 10);

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
document.Save(outputFileStream);
}
//Add the form field to the document.
document.Form.Fields.Add(checkBoxField);

//Close the document.
document.Close(true);
//Save the PDF document
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
}
Original file line number Diff line number Diff line change
@@ -1,49 +1,41 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Drawing;
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 PDF page.
PdfPage page = document.Pages.Add();

//Create the new PDF text box field.
PdfTextBoxField textField = new PdfTextBoxField(page, "textBox");
using (PdfDocument document = new PdfDocument())
{
//Add a new PDF page.
PdfPage page = document.Pages.Add();

//Set bounds.
textField.Bounds = new RectangleF(10, 10, 200, 30);
//Create the new PDF text box field.
PdfTextBoxField textField = new PdfTextBoxField(page, "textBox");

//Set text.
textField.Text = "สวัสดีชาวโลก";
//Set bounds.
textField.Bounds = new RectangleF(10, 10, 200, 30);

//Get stream from an font file.
FileStream fontStream = new FileStream(Path.GetFullPath(@"Data/tahoma.ttf"), FileMode.Open, FileAccess.Read);
//Set text.
textField.Text = "สวัสดีชาวโลก";

//Create a new PDF font instance.
PdfFont font = new PdfTrueTypeFont(fontStream, 10);
//Get stream from an font file.
FileStream fontStream = new FileStream(Path.GetFullPath(@"Data/tahoma.ttf"), FileMode.Open, FileAccess.Read);

//Set font.
textField.Font = font;
//Create a new PDF font instance.
PdfFont font = new PdfTrueTypeFont(fontStream, 10);

//Add the text box field to the form collection.
document.Form.Fields.Add(textField);
//Set font.
textField.Font = font;

//Set default appearance as false.
document.Form.SetDefaultAppearance(false);
//Add the text box field to the form collection.
document.Form.Fields.Add(textField);

//Enable complex script layout for form.
document.Form.ComplexScript = true;
//Set default appearance as false.
document.Form.SetDefaultAppearance(false);

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
document.Save(outputFileStream);
}
//Enable complex script layout for form.
document.Form.ComplexScript = true;

//Close the document.
document.Close(true);
//Save the PDF document
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
}
Original file line number Diff line number Diff line change
@@ -1,49 +1,37 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Pdf;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Interactive;
using Syncfusion.Pdf.Parsing;

//Get stream from an existing document.
FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);

//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);

//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;

//Create list box.
PdfListBoxField listBoxField = new PdfListBoxField(loadedPage, "list1");
//Load the PDF document.
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(Path.GetFullPath(@"Data/Input.pdf")))
{
//Create the form if the form does not exist in the loaded document.
if (loadedDocument.Form == null)
loadedDocument.CreateForm();

//Set the properties.
listBoxField.Bounds = new Syncfusion.Drawing.RectangleF(100, 60, 100, 50);
//Load the page.
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;

//Add the items to the list box.
listBoxField.Items.Add(new PdfListFieldItem("English", "English"));
listBoxField.Items.Add(new PdfListFieldItem("French", "French"));
listBoxField.Items.Add(new PdfListFieldItem("German", "German"));
//Create list box.
PdfListBoxField listBoxField = new PdfListBoxField(loadedPage, "list1");

//Select the item.
listBoxField.SelectedIndex = 2;
//Set the properties.
listBoxField.Bounds = new Syncfusion.Drawing.RectangleF(100, 60, 100, 50);

//Set the multi select option.
listBoxField.MultiSelect = true;
//Add the items to the list box.
listBoxField.Items.Add(new PdfListFieldItem("English", "English"));
listBoxField.Items.Add(new PdfListFieldItem("French", "French"));
listBoxField.Items.Add(new PdfListFieldItem("German", "German"));

//Add the list box into PDF document
loadedDocument.Form.Fields.Add(listBoxField);
//Select the item.
listBoxField.SelectedIndex = 2;

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
loadedDocument.Save(outputFileStream);
}
//Set the multi select option.
listBoxField.MultiSelect = true;

//Close the document.
loadedDocument.Close(true);
//Add the list box into PDF document
loadedDocument.Form.Fields.Add(listBoxField);

//Save the PDF document
loadedDocument.Save(Path.GetFullPath(@"Output/Output.pdf"));
}
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Pdf;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Interactive;

//Create a new PDF document.
PdfDocument document = new PdfDocument();

//Add a new page to PDF document.
PdfPage page = document.Pages.Add();
using (PdfDocument document = new PdfDocument())
{
//Add a new page to PDF document.
PdfPage page = document.Pages.Add();

//Create list box.
PdfListBoxField listBoxField = new PdfListBoxField(page, "list1");
//Create list box.
PdfListBoxField listBoxField = new PdfListBoxField(page, "list1");

//Set the properties.
listBoxField.Bounds = new Syncfusion.Drawing.RectangleF(100, 60, 100, 50);
//Set the properties.
listBoxField.Bounds = new Syncfusion.Drawing.RectangleF(100, 60, 100, 50);

//Add the items to the list box.
listBoxField.Items.Add(new PdfListFieldItem("English", "English"));
listBoxField.Items.Add(new PdfListFieldItem("French", "French"));
listBoxField.Items.Add(new PdfListFieldItem("German", "German"));
//Add the items to the list box.
listBoxField.Items.Add(new PdfListFieldItem("English", "English"));
listBoxField.Items.Add(new PdfListFieldItem("French", "French"));
listBoxField.Items.Add(new PdfListFieldItem("German", "German"));

//Select the item.
listBoxField.SelectedIndex = 0;
//Select the item.
listBoxField.SelectedIndex = 0;

//Set the multi select option.
listBoxField.MultiSelect = true;
//Set the multi select option.
listBoxField.MultiSelect = true;

//Add the list box into PDF document
document.Form.Fields.Add(listBoxField);
//Add the list box into PDF document
document.Form.Fields.Add(listBoxField);

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
document.Save(outputFileStream);
//Save the PDF document
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
}

//Close the document.
document.Close(true);
Original file line number Diff line number Diff line change
@@ -1,44 +1,33 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Pdf;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Interactive;
using Syncfusion.Pdf.Parsing;

//Get stream from an existing PDF document.
FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);

//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);

//Create the form if the form does not exist in the loaded document.
if (loadedDocument.Form == null)
loadedDocument.CreateForm();
//Load the PDF document.
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(Path.GetFullPath(@"Data/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;
//Load the page.
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;

//Create a Radio button.
PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(loadedPage, "employeesRadioList");
//Create a Radio button.
PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(loadedPage, "employeesRadioList");

//Add the radio button into loaded document.
loadedDocument.Form.Fields.Add(employeesRadioList);
//Add the radio button into loaded document.
loadedDocument.Form.Fields.Add(employeesRadioList);

//Create radio button items.
PdfRadioButtonListItem radioButtonItem1 = new PdfRadioButtonListItem("1-9");
radioButtonItem1.Bounds = new Syncfusion.Drawing.RectangleF(100, 140, 20, 20);
PdfRadioButtonListItem radioButtonItem2 = new PdfRadioButtonListItem("10-49");
radioButtonItem2.Bounds = new Syncfusion.Drawing.RectangleF(100, 170, 20, 20);
//Create radio button items.
PdfRadioButtonListItem radioButtonItem1 = new PdfRadioButtonListItem("1-9");
radioButtonItem1.Bounds = new Syncfusion.Drawing.RectangleF(100, 140, 20, 20);
PdfRadioButtonListItem radioButtonItem2 = new PdfRadioButtonListItem("10-49");
radioButtonItem2.Bounds = new Syncfusion.Drawing.RectangleF(100, 170, 20, 20);

//Add the items to radio button group.
employeesRadioList.Items.Add(radioButtonItem1);
employeesRadioList.Items.Add(radioButtonItem2);
//Add the items to radio button group.
employeesRadioList.Items.Add(radioButtonItem1);
employeesRadioList.Items.Add(radioButtonItem2);

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
loadedDocument.Save(outputFileStream);
//Save the PDF document
loadedDocument.Save(Path.GetFullPath(@"Output/Output.pdf"));
}

//Close the document.
loadedDocument.Close(true);
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Pdf;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Interactive;

//Create a new PDF document.
PdfDocument document = new PdfDocument();

//Add a new page to PDF document.
PdfPage page = document.Pages.Add();
using (PdfDocument document = new PdfDocument())
{
//Add a new page to PDF document.
PdfPage page = document.Pages.Add();

//Create PDF Signature field.
PdfSignatureField signatureField = new PdfSignatureField(page, "Signature");
//Create PDF Signature field.
PdfSignatureField signatureField = new PdfSignatureField(page, "Signature");

//Set properties to the signature field.
signatureField.Bounds = new Syncfusion.Drawing.RectangleF(50, 50, 90, 20);
signatureField.ToolTip = "Signature";
//Set properties to the signature field.
signatureField.Bounds = new Syncfusion.Drawing.RectangleF(50, 50, 90, 20);
signatureField.ToolTip = "Signature";

//Add the form field to the document.
document.Form.Fields.Add(signatureField);
//Add the form field to the document.
document.Form.Fields.Add(signatureField);

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
document.Save(outputFileStream);
//Save the PDF document
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
}

//Close the document.
document.Close(true);
Loading
Loading