Hyperlinks in PDF are a valuable feature that enables readers to effortlessly access a given webpage. By including hyperlinks in a PDF, it becomes easier to offer readers supplementary information about the document or direct them to relevant resources. When a reader clicks on a hyperlink, the corresponding page opens immediately in the browser. In this article, we will demonstrate how to add hyperlinks to existing text in a PDF document through .NET programs using Spire.PDF for .NET.

Install Spire.PDF for .NET

To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.

PM> Install-Package Spire.PDF

Insert a Hyperlink to Existing Text in PDF with C#/VB.NET

Hyperlinks in PDF documents are inserted to the page as annotation elements. Adding a hyperlink to existing text in a PDF document requires locating the text first. Once the location has been obtained, an object of PdfUriAnnotation class with the link can be created and added to the position. The detailed steps are as follows:

  • Create an object of PdfDocument class and load a PDF file using PdfDocument.LoadFromFile() method.
  • Get the first page using PdfDocument.Pages property.
  • Create an object of PdfTextFinder class and set the finder options using PdfTextFinder.Options.Parameter property.
  • Find the specified text in the page using PdfTextFinder.Find() method and get the third occurrence.
  • Loop through the text bounds of the specified occurrence (because the text being searched may span multiple lines and have more than one bound, the retrieved text bounds are stored in a list to accommodate this variability).
  • Create an object of PdfUriAnnotation class within the text bound and set the URL, border, and border color using properties under PdfUriAnnotation class.
  • Insert the hyperlink to the page annotations using PdfPageBase.AnnotationsWidget.Add(PdfUriAnnotation) method.
  • Save the PDF file using PdfDocument.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Pdf;
using Spire.Pdf.Annotations;
using Spire.Pdf.Texts;
using System.Collections.Generic;
using System.Drawing;
using TextFindParameter = Spire.Pdf.Texts.TextFindParameter;

namespace ChangeHyperlink
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //Create an object of PdfDocument class
            PdfDocument pdf = new PdfDocument();

            //Load a PDF file
            pdf.LoadFromFile("Sample.pdf");

            //Get the first page
            PdfPageBase page = pdf.Pages[0];

            //Create an object of PdfTextFinder and set the finder options
            PdfTextFinder finder = new PdfTextFinder(page);
            finder.Options.Parameter = TextFindParameter.IgnoreCase;

            //Find the specified text in the page and get the third occurrence
            List<PdfTextFragment> collection = finder.Find("climate change");
            PdfTextFragment fragment = collection[2];

            //Loop through the text bounds of the specified occurrence
            foreach (RectangleF bounds in fragment.Bounds)
            {
                //Create a hyperlink annotation
                PdfUriAnnotation url = new PdfUriAnnotation(bounds);
                //Set the URL of the hyperlink
                url.Uri = "https://en.wikipedia.org/wiki/Climate_change";
                //Set the border of the hyperlink annotation
                url.Border = new PdfAnnotationBorder(1f);
                //Set the color of the border
                url.Color = Color.Blue;
                //Add the hyperlink annotation to the page
                page.Annotations.Add(url);
            }

            //Save the PDF file
            pdf.SaveToFile("AddHyperlinks.pdf");
            pdf.Dispose();
        }
    }
}

C#/VB.NET: Insert Hyperlinks into Existing Text in PDF

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Word Heading can be taken as title of each part in Word document. This guide demonstrates solution to manage these Word headings and form them as a catalogue in C# and VB.NET.

In Word document, users can set some contents, for example, phrases of summary of the following paragraphs, as headings. These Word headings can be displayed in the first page of whole document and form as catalogue after arrangement so that readers can get outline of whole document. Solution in this guide presents how to manage Word headings with numbered style in a new created document in C# and VB.NET via Spire.Doc for .NET and screenshot below shows results of managing Word headings.

Word Paragraph Headings

Heading is one of kind of styles for paragraphs and Spire.Doc for .NET provides several BuiltinStyle types for paragraphs. In this example, three BuiltinStyle types will be applied: Heading1, Heading2 and Heading3. Following, details will be presented step by step.

Firstly, initialize a Document instance and add section, paragraph for this instance. Secondly, invoke AppendText method with parameter string text and ApplyStyle(BuiltinStyle.Heading1) method of Paragraph class to add text and set heading style for new added paragraph. Then, invoke ListFromat.ApplyNumberedStyle() method of Paragraph class to set number list for it. Thirdly, add new paragraph and set Heading2 style for it as the previous step. Initialize a ListStyle instance for document with Numbered ListType. Then, initialize a ListLevel instance from ListStyle and set UsePrevLevelPattern and NumberPrefix properties for this instance. After that, invoke ListStyleCollection.Add(ListStyle) method of Document class and ListFormat.ApplyStyle method of Paragraph class with parameter string styleName to add ListStyle for Heading2. Fourthly, add a new paragraph and set BuiltinStyle as Heading3 and apply ListStyle for this paragraph as the previous step. Finally, invoke SaveToFile method of Document class with parameter string fileName and FileFormat to save this document. Refer the code:

[C#]
using Spire.Doc;
using Spire.Doc.Documents;

namespace WordHeading
{
    class Heading
    {
        static void Main(string[] args)
        {
             //Create Document
             Document document = new Document();
             Section section = document.AddSection();
             Paragraph paragraph = section.Paragraphs.Count > 0 ? section.Paragraphs[0] : section.AddParagraph();

             //Add Heading 1
             paragraph = section.AddParagraph();
             paragraph.AppendText(BuiltinStyle.Heading1.ToString());
             paragraph.ApplyStyle(BuiltinStyle.Heading1);
             paragraph.ListFormat.ApplyNumberedStyle();

             //Add Heading 2
             paragraph = section.AddParagraph();
             paragraph.AppendText(BuiltinStyle.Heading2.ToString());
             paragraph.ApplyStyle(BuiltinStyle.Heading2);

             //List Style for Headings 2
             ListStyle listSty2 = document.Styles.Add(ListType.Numbered, "MyStyle2");

             foreach (ListLevel listLev in listSty2.ListRef.Levels)
             {
                 listLev.UsePrevLevelPattern = true;
                 listLev.NumberPrefix = "1.";
             }

             paragraph.ListFormat.ApplyStyle(listSty2.Name);

             //Add List Style 3
             ListStyle listSty3 = document.Styles.Add(ListType.Numbered, "MyStyle3");
             foreach (ListLevel listLev in listSty3.ListRef.Levels)
             {
                 listLev.UsePrevLevelPattern = true;
                 listLev.NumberPrefix = "1.1.";
             }

             //Add Heading 3
             for (int i = 0; i < 4; i++)
             {
                 paragraph = section.AddParagraph();

                 //Append Text
                 paragraph.AppendText(BuiltinStyle.Heading3.ToString());

                 //Apply List Style 3 for Heading 3
                 paragraph.ApplyStyle(BuiltinStyle.Heading3);
                 paragraph.ListFormat.ApplyStyle(listSty3.Name);
             }

             //Save and Launch
             document.SaveToFile("Word Headings.docx", FileFormat.Docx);
        }
    }
}
[VB.NET]
Imports Spire.Doc
Imports Spire.Doc.Documents

Namespace WordHeading
    Friend Class Heading
        Shared Sub Main(ByVal args() As String)
         'Create Document
         Dim document As New Document()
         Dim section As Section = document.AddSection()
         Dim paragraph As Paragraph = If(section.Paragraphs.Count > 0, section.Paragraphs(0), section.AddParagraph())

         'Add Heading 1
         paragraph = section.AddParagraph()
         paragraph.AppendText(BuiltinStyle.Heading1.ToString())
         paragraph.ApplyStyle(BuiltinStyle.Heading1)
         paragraph.ListFormat.ApplyNumberedStyle()

         'Add Heading 2
         paragraph = section.AddParagraph()
         paragraph.AppendText(BuiltinStyle.Heading2.ToString())
         paragraph.ApplyStyle(BuiltinStyle.Heading2)

         ' List Style for Headings 2
         Dim listSty2 As ListStyle = document.Styles.Add(ListType.Numbered, "MyStyle2")

         For Each listLev As ListLevel In listSty2.ListRef.Levels
             listLev.UsePrevLevelPattern = True
             listLev.NumberPrefix = "1."
         Next

         paragraph.ListFormat.ApplyStyle(listSty2.Name)

         ' Add List Style 3
         Dim listSty3 As ListStyle = document.Styles.Add(ListType.Numbered, "MyStyle3")

         For Each listLev As ListLevel In listSty3.ListRef.Levels
             listLev.UsePrevLevelPattern = True
             listLev.NumberPrefix = "1.1."
         Next

         'Add Heading 3
         For i As Integer = 0 To 3
             paragraph = section.AddParagraph()

             'Append Text
             paragraph.AppendText(BuiltinStyle.Heading3.ToString())

             'Apply List Style 3 for Heading 3
             paragraph.ApplyStyle(BuiltinStyle.Heading3)
             paragraph.ListFormat.ApplyStyle(listSty3.Name)
         Next i

         'Save and Launch
         document.SaveToFile("Word Headings.docx", FileFormat.Docx)
        End Sub
    End Class
End Namespace

Spire.Doc, as professional Word component, is very powerful on fast generating, loading, writing, modifying and saving Word documents in .NET, WPF, Silverlight without Word automation and any third party tools.

After searching so much information about PDF merge, it is easy to find that whether you merge PDF files online or use C#/VB.NET to realize this task, you never escape worrying some important points such as the safety of your PDF file, so much time it costs or whether the merged file supports to print page number and so on. However, as long as you come here, these troubles will not appear. This section will specifically introduce you a secure solution to merge PDF files into one with C#, VB.NET via a .NET PDF component Spire.PDF for .NET.

Spire.PDF for .NET, built from scratch in C#, enables programmers and developers to create, read, write and manipulate PDF documents in .NET applications without using Adobe Acrobat or any external libraries. Using Spire.PDF for .NET, you not only can quickly merge PDF files but also enables you to print PDF page with page number. Now please preview the effective screenshot below:

Merge PDF Documents

Before following below procedure, please download Spire.PDF for .NET and install it on system.

Step1: You can use the String array to save the names of the three PDF files which will be merged into one PDF and demonstrate Spire.Pdf.PdfDocument array. Then, load three PDF files and select the first PdfDocument for the purpose of merging the second and third PDF file to it. In order to import all pages from the second PDF file to the first PDF file, you need to call the method public void AppendPage(PdfDocument doc). Also by calling another method public PdfPageBase InsertPage(PdfDocument doc, int pageIndex),every page of the third PDF file can be imported to the first PDF file.

[C#]
private void button1_Click(object sender, EventArgs e)
        {
            //pdf document list
            String[] files = new String[]
            {
                @"..\PDFmerge0.pdf",
                @"..\ PDFmerge1.pdf",
                @"..\ PDFmerge2.pdf"
            };
            //open pdf documents            
            PdfDocument[] docs = new PdfDocument[files.Length];
            for (int i = 0; i < files.Length; i++)
            {
                docs[i] = new PdfDocument(files[i]);
            }
            //append document
            docs[0].AppendPage(docs[1]);

            //import PDF pages
            for (int i = 0; i < docs[2].Pages.Count; i = i + 2)
            {
                docs[0].InsertPage(docs[2], i);
            }
[VB.NET]
 Private Sub button1_Click(sender As Object, e As EventArgs)
	'pdf document list
	Dim files As [String]() = New [String]() {"..\PDFmerge0.pdf", "..\ PDFmerge1.pdf", "..\ PDFmerge2.pdf"}
	'open pdf documents            
	Dim docs As PdfDocument() = New PdfDocument(files.Length - 1) {}
	For i As Integer = 0 To files.Length - 1
		docs(i) = New PdfDocument(files(i))
	Next

	'append document
	docs(0).AppendPage(docs(1))

	'import PDF pages
	Dim j As Integer = 0
	While j < docs(2).Pages.Count
		docs(0).InsertPage(docs(2), j)
		j = j + 2
	End While"

Step2: Draw page number in the first PDF file. In this step, you can set PDF page number margin by invoking the class Spire.Pdf.Graphics. PdfMargins. Then, Call the custom method DrawPageNumber(PdfPageCollection pages, PdfMargins margin, int startNumber, int pageCount) to add page number in the bottom of every page in the first PDF. Please see the detail code below:

[C#]
//set PDF margin
            PdfUnitConvertor unitCvtr = new PdfUnitConvertor();
            PdfMargins margin = new PdfMargins();
            margin.Top = unitCvtr.ConvertUnits(2.54f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
            margin.Bottom = margin.Top;
            margin.Left = unitCvtr.ConvertUnits(3.17f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
            margin.Right = margin.Left;
            this.DrawPageNumber(docs[0].Pages, margin, 1, docs[0].Pages.Count);

          private void DrawPageNumber(PdfPageCollection pages, PdfMargins margin, int startNumber, int pageCount)
          {
            foreach (PdfPageBase page in pages)
            {
                page.Canvas.SetTransparency(0.5f);
                PdfBrush brush = PdfBrushes.Black;
                PdfPen pen = new PdfPen(brush, 0.75f);
                PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", 9f, System.Drawing.FontStyle.Italic), true);
                PdfStringFormat format = new PdfStringFormat(PdfTextAlignment.Right);
                format.MeasureTrailingSpaces = true;
                float space = font.Height * 0.75f;
                float x = margin.Left;
                float width = page.Canvas.ClientSize.Width - margin.Left - margin.Right;
                float y = page.Canvas.ClientSize.Height - margin.Bottom + space;
                page.Canvas.DrawLine(pen, x, y, x + width, y);
                y = y + 1;
                String numberLabel
                    = String.Format("{0} of {1}", startNumber++, pageCount);
                page.Canvas.DrawString(numberLabel, font, brush, x + width, y, format);
                page.Canvas.SetTransparency(1);
            }
        }
[VB.NET]
       'set PDF margin
	Dim unitCvtr As New PdfUnitConvertor()
	Dim margin As New PdfMargins()
	margin.Top = unitCvtr.ConvertUnits(2.54F, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point)
	margin.Bottom = margin.Top
	 margin.Left = unitCvtr.ConvertUnits(3.17F, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point)
	margin.Right = margin.Left
	Me.DrawPageNumber(docs(0).Pages, margin, 1, docs(0).Pages.Count)

       Private Sub DrawPageNumber(pages As PdfPageCollection, margin As PdfMargins, startNumber As Integer, pageCount As Integer)
	For Each page As PdfPageBase In pages
		page.Canvas.SetTransparency(0.5F)
		Dim brush As PdfBrush = PdfBrushes.Black
		Dim pen As New PdfPen(brush, 0.75F)
		Dim font As New PdfTrueTypeFont(New Font("Arial", 9F, System.Drawing.FontStyle.Italic), True)
		Dim format As New PdfStringFormat(PdfTextAlignment.Right)
		format.MeasureTrailingSpaces = True
		Dim space As Single = font.Height * 0.75F
		Dim x As Single = margin.Left
		Dim width As Single = page.Canvas.ClientSize.Width - margin.Left - margin.Right
		Dim y As Single = page.Canvas.ClientSize.Height - margin.Bottom + space
		page.Canvas.DrawLine(pen, x, y, x + width, y)
		y = y + 1
		Dim numberLabel As [String] = [String].Format("{0} of {1}", System.Math.Max(System.Threading.Interlocked.Increment(startNumber),startNumber - 1), pageCount)
		page.Canvas.DrawString(numberLabel, font, brush, x + width, y, format)
		page.Canvas.SetTransparency(1)
	Next
End Sub

The PDF merge code can be very long when you view it at first sight, actually, if you do not need to add page number in your merged PDF, steps two should be avoided. However, in many cases, page number brings great convenience for users to read PDF as well as print it. Spire.PDF for .NET can satisfy both your requirements of merging PDF files and adding page numbers in the merged PDF file.

Monday, 05 March 2012 07:29

Export PDF Document to images

The sample demonstrates how to export PDF pages as images by PdfDocumentViewer Component.

Download PDFViewer.pdf

The ability to create fillable PDF forms that end users can fill out (without having to print) can be a real benefit to making your business efficient. With these documents, users can download them, fill them out, save them, and send them back to you. No more printing and scanning. In this article, you will learn how to create, fill, or remove fillable forms in PDF in C# and VB.NET by using Spire.PDF for .NET.

Spire.PDF for .NET offers a series of useful classes under the Spire.Pdf.Fields namespace, allowing programmers to create and edit various types of form fields including text box, check box, combo box, list box, and radio button. The table below lists some of the core classes involved in this tutorial.

Class Description
PdfForm Represents interactive form of the PDF document.
PdfField Represents field of the PDF document's interactive form.
PdfTextBoxField Represents text box field in the PDF form.
PdfCheckBoxField Represents check box field in the PDF form.
PdfComboBoxField Represents combo box field in the PDF Form.
PdfListBoxField Represents list box field of the PDF form.
PdfListFieldItem Represents an item of a list field.
PdfRadioButtonListField Represents radio button field in the PDF form.
PdfRadioButtonListItem Represents an item of a radio button list.
PdfButtonField Represents button field in the PDF form.
PdfSignatureField Represents signature field in the PDF form.

Install Spire.PDF for .NET

To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLLs files can be either downloaded from this link or installed via NuGet.

PM> Install-Package Spire.PDF

Create Fillable Form Fields in a PDF Document

To create a PDF form, initialize an instance of the corresponding field class. Set its size and position in the document through the Bounds property, and then add it to PDF using PdfFormFieldCollection.Add() method. The following are the main steps to create various types of form fields in a PDF document using Spire.PDF for .NET.

  • Create a PdfDocument object.
  • Add a page using PdfDocuemnt.Pages.Add() method.
  • Create a PdfTextBoxField object, set the properties of the field including Bounds, Font and Text, and then add it to the document using PdfFormFieldCollection.Add() method.
  • Repeat the step 3 to add check box, combo box, list box, radio button, signature field and button to the document.
  • Save the document to a PDF file using PdfDocument.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Pdf;
using Spire.Pdf.Actions;
using Spire.Pdf.Fields;
using Spire.Pdf.Graphics;
using System.Drawing;

namespace CreateFillableFormsInPdf
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a PdfDocument object
            PdfDocument doc = new PdfDocument();

            //Add a page
            PdfPageBase page = doc.Pages.Add();

            //Initialize x and y coordinates
            float baseX = 100;
            float baseY = 30;

            //Create two brush objects
            PdfSolidBrush brush1 = new PdfSolidBrush(new PdfRGBColor(Color.Blue));
            PdfSolidBrush brush2 = new PdfSolidBrush(new PdfRGBColor(Color.Black));

            //Create a font 
            PdfFont font = new PdfFont(PdfFontFamily.TimesRoman, 12f, PdfFontStyle.Regular);

            //Add a textbox 
            page.Canvas.DrawString("TextBox:", font, brush1, new PointF(10, baseY));
            RectangleF tbxBounds = new RectangleF(baseX, baseY, 150, 15);
            PdfTextBoxField textBox = new PdfTextBoxField(page, "textbox");
            textBox.Bounds = tbxBounds;
            textBox.Text = "Hello World";
            textBox.Font = font;
            doc.Form.Fields.Add(textBox);
            baseY += 25;

            //add two checkboxes 
            page.Canvas.DrawString("CheckBox:", font, brush1, new PointF(10, baseY));
            RectangleF checkboxBound1 = new RectangleF(baseX, baseY, 15, 15);
            PdfCheckBoxField checkBoxField1 = new PdfCheckBoxField(page, "checkbox1");
            checkBoxField1.Bounds = checkboxBound1;
            checkBoxField1.Checked = false;
            page.Canvas.DrawString("Option 1", font, brush2, new PointF(baseX + 20, baseY));

            RectangleF checkboxBound2 = new RectangleF(baseX + 70, baseY, 15, 15);
            PdfCheckBoxField checkBoxField2 = new PdfCheckBoxField(page, "checkbox2");
            checkBoxField2.Bounds = checkboxBound2;
            checkBoxField2.Checked = false;
            page.Canvas.DrawString("Option 2", font, brush2, new PointF(baseX + 90, baseY));
            doc.Form.Fields.Add(checkBoxField1);
            doc.Form.Fields.Add(checkBoxField2);
            baseY += 25;

            //Add a listbox
            page.Canvas.DrawString("ListBox:", font, brush1, new PointF(10, baseY));
            RectangleF listboxBound = new RectangleF(baseX, baseY, 150, 50);
            PdfListBoxField listBoxField = new PdfListBoxField(page, "listbox");
            listBoxField.Items.Add(new PdfListFieldItem("Item 1", "item1"));
            listBoxField.Items.Add(new PdfListFieldItem("Item 2", "item2"));
            listBoxField.Items.Add(new PdfListFieldItem("Item 3", "item3")); ;
            listBoxField.Bounds = listboxBound;
            listBoxField.Font = font;
            listBoxField.SelectedIndex = 0;
            doc.Form.Fields.Add(listBoxField);
            baseY += 60;

            //Add two radio buttons
            page.Canvas.DrawString("RadioButton:", font, brush1, new PointF(10, baseY));
            PdfRadioButtonListField radioButtonListField = new PdfRadioButtonListField(page, "radio");
            PdfRadioButtonListItem radioItem1 = new PdfRadioButtonListItem("option1");
            RectangleF radioBound1 = new RectangleF(baseX, baseY, 15, 15);
            radioItem1.Bounds = radioBound1;
            page.Canvas.DrawString("Option 1", font, brush2, new PointF(baseX + 20, baseY));

            PdfRadioButtonListItem radioItem2 = new PdfRadioButtonListItem("option2");
            RectangleF radioBound2 = new RectangleF(baseX + 70, baseY, 15, 15);
            radioItem2.Bounds = radioBound2;
            page.Canvas.DrawString("Option 2", font, brush2, new PointF(baseX + 90, baseY));
            radioButtonListField.Items.Add(radioItem1);
            radioButtonListField.Items.Add(radioItem2);
            radioButtonListField.SelectedIndex = 0;
            doc.Form.Fields.Add(radioButtonListField);
            baseY += 25;

            //Add a combobox
            page.Canvas.DrawString("ComboBox:", font, brush1, new PointF(10, baseY));
            RectangleF cmbBounds = new RectangleF(baseX, baseY, 150, 15);
            PdfComboBoxField comboBoxField = new PdfComboBoxField(page, "combobox");
            comboBoxField.Bounds = cmbBounds;
            comboBoxField.Items.Add(new PdfListFieldItem("Item 1", "item1"));
            comboBoxField.Items.Add(new PdfListFieldItem("Item 2", "itme2"));
            comboBoxField.Items.Add(new PdfListFieldItem("Item 3", "item3"));
            comboBoxField.Items.Add(new PdfListFieldItem("Item 4", "item4"));
            comboBoxField.SelectedIndex = 0;
            comboBoxField.Font = font;
            doc.Form.Fields.Add(comboBoxField);
            baseY += 25;

            //Add a signature field
            page.Canvas.DrawString("Signature Field:", font, brush1, new PointF(10, baseY));
            PdfSignatureField sgnField = new PdfSignatureField(page, "sgnField");
            RectangleF sgnBounds = new RectangleF(baseX, baseY, 150, 80);
            sgnField.Bounds = sgnBounds;
            doc.Form.Fields.Add(sgnField);
            baseY += 90;

            //Add a button
            page.Canvas.DrawString("Button:", font, brush1, new PointF(10, baseY));
            RectangleF btnBounds = new RectangleF(baseX, baseY, 50, 15);
            PdfButtonField buttonField = new PdfButtonField(page, "button");
            buttonField.Bounds = btnBounds;
            buttonField.Text = "Submit";
            buttonField.Font = font;
            PdfSubmitAction submitAction = new PdfSubmitAction("https://www.e-iceblue.com/getformvalues.php");
            submitAction.DataFormat = SubmitDataFormat.Html;
            buttonField.Actions.MouseDown = submitAction;
            doc.Form.Fields.Add(buttonField);

            //Save to file
            doc.SaveToFile("FillableForms.pdf", FileFormat.PDF);
        }
    }
}

C#/VB.NET: Create, Fill, or Remove Fillable Forms in PDF

Fill Form Fields in an Existing PDF Document

In order to fill out a form, we must first get all the form fields from the PDF document, determine the type of a certain field, and then input a value or select a value from a predefined list. The following are the steps to fill form fields in an existing PDF document using Spire.PDF for .NET.

  • Create a PdfDocument object.
  • Load a sample PDF document using PdfDocument.LoadFromFile() method.
  • Get the form from the document through PdfDocument.Form property.
  • Get the form widget collection through PdfFormWidget.FieldsWidget property.
  • Loop through the form widget collection to get a specific PdfField.
  • Determine if the PdfField is a certain field type such as text box. If yes, set the text of the text box through PdfTextBoxFieldWidget.Text property.
  • Repeat the sixth step to fill radio button, check box, combo box, and list box with values.
  • Save the document to a PDF file using PdfDocument.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Pdf;
using Spire.Pdf.Fields;
using Spire.Pdf.Widget;

namespace FillFormFields
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a PdfDocument object
            PdfDocument doc = new PdfDocument();

            //Load a template containing forms
            doc.LoadFromFile(@"C:\Users\Administrator\Desktop\FormsTemplate.pdf");

            //Get the form from the document
            PdfFormWidget form = (PdfFormWidget)doc.Form;

            //Get the form widget collection
            PdfFormFieldWidgetCollection formWidgetCollection = form.FieldsWidget;

            //Loop through the widgets
            for (int i = 0; i < formWidgetCollection.Count; i++)
            {
                //Get a specific field
                PdfField field = formWidgetCollection[i];

                //Determine if the field is a text box
                if (field is PdfTextBoxFieldWidget)
                {
                    if (field.Name == "name")
                    {
                        //Set the text of text box
                        PdfTextBoxFieldWidget textBoxField = (PdfTextBoxFieldWidget)field;
                        textBoxField.Text = "Kaila Smith";
                    }
                }

                //Determine if the field is a radio button
                if (field is PdfRadioButtonListFieldWidget)
                {
                    if (field.Name == "gender")
                    {
                        //Set the selected index of radio button
                        PdfRadioButtonListFieldWidget radioButtonListField = (PdfRadioButtonListFieldWidget)field;
                        radioButtonListField.SelectedIndex = 1;
                    }
                }

                //Determine if the field is a combo box
                if (field is PdfComboBoxWidgetFieldWidget)
                {
                    if (field.Name == "country")
                    {
                        //Set the selected index of combo box
                        PdfComboBoxWidgetFieldWidget comboBoxField = (PdfComboBoxWidgetFieldWidget)field;
                        int[] index = { 0 };
                        comboBoxField.SelectedIndex = index;
                    }
                }

                //Determine if the field is a check box
                if (field is PdfCheckBoxWidgetFieldWidget)
                {
                    //Set the "Checked" status of check box
                    PdfCheckBoxWidgetFieldWidget checkBoxField = (PdfCheckBoxWidgetFieldWidget)field;
                    switch (checkBoxField.Name)
                    {
                        case "travel":
                            checkBoxField.Checked = true;
                            break;
                        case "movie":
                            checkBoxField.Checked = true;
                            break;
                    }
                }

                //Determine if the field is a list box
                if (field is PdfListBoxWidgetFieldWidget)
                {
                    if (field.Name == "degree")
                    {
                        //Set the selected index of list box
                        PdfListBoxWidgetFieldWidget listBox = (PdfListBoxWidgetFieldWidget)field;
                        int[] index = { 1 };
                        listBox.SelectedIndex = index;
                    }
                }
            }

            //Save to file
            doc.SaveToFile("FillFormFields.pdf", FileFormat.PDF);
        }
    }
}

C#/VB.NET: Create, Fill, or Remove Fillable Forms in PDF

Remove a Particular Field or All Fields from an Existing PDF Document

A form field in a PDF document can be accessed by its index or name and removed by PdfFieldCollection.Remove() method. The following are the steps to remove a particular field or all fields from an existing PDF document using Sprie.PDF for .NET.

  • Create a PdfDocument object.
  • Load a PDF document using PdfDocument.LoadFromFile() method.
  • Get the form widget collection from the document.
  • Loop through the widget collection to get a specific PdfField. Remove the field one by one using PdfFieldCollection.Remove() method.
  • To remove a certain form field, get it from the document through PdfFormWidget.FieldsWidget["fieldName"] property and then call the PdfFieldCollectiont.Remove() method.
  • Save the document to a PDF file using PdfDocument.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Pdf;
using Spire.Pdf.Fields;
using Spire.Pdf.Widget;

namespace RemoveFormFields
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a PdfDocument object
            PdfDocument doc = new PdfDocument();

            //Load a PDF file
            doc.LoadFromFile(@"C:\Users\Administrator\Desktop\FormsTemplate.pdf");

            //Get the form fields from the document
            PdfFormWidget formWidget = doc.Form as PdfFormWidget;

            //Loop through the widgets
            for (int i = formWidget.FieldsWidget.List.Count - 1; i >= 0; i--)
            {
                //Get a specific field
                PdfField field = formWidget.FieldsWidget.List[i] as PdfField;

                //Remove the field
                formWidget.FieldsWidget.Remove(field);
            }

            //Get a specific field by its name
            //PdfField field = formWidget.FieldsWidget["name"];
            //Remove the field
            //formWidget.FieldsWidget.Remove(field);

            //Save to file
            doc.SaveToFile("DeleteAllFields.pdf");
        }
    }
}

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Wednesday, 14 December 2011 06:45

Draw Special Shapes in PDF in C#/VB.NET

Spire.PDF can help us draw different shapes in PDF document. We can use Spire.PDF to draw rectangles in PDF, draw circles in PDF, draw arcs in PDF and draw ellipses in PDF. Besides these shapes, we can also use Spire.PDF to draw some other special shapes such as Spiral and five-pointed stars.

Draw Five-Pointed Star in PDF

By using Spire.PDF, we can draw different stars in PDF document. The sample below is showing how to draw 6 types of different five-pointed star.

[C#]
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System;
using System.Drawing;


namespace FivePointedStar
{
    class Program
    {
        private static void DrawStar(PdfPageBase page)
        {
            PdfDocument doc = new PdfDocument();
            PdfPageBase page = doc.Pages.Add();
            PointF[] points = new PointF[5];
            for (int i = 0; i < points.Length; i++)
            {
                float x = (float)Math.Cos(i * 2 * Math.PI / 5);
                float y = (float)Math.Sin(i * 2 * Math.PI / 5);
                points[i] = new PointF(x, y);
            }
            PdfPath path = new PdfPath();
            path.AddLine(points[2], points[0]);
            path.AddLine(points[0], points[3]);
            path.AddLine(points[3], points[1]);
            path.AddLine(points[1], points[4]);
            path.AddLine(points[4], points[2]);

            //save graphics state
            PdfDocument doc = new PdfDocument();
            PdfPageBase page = doc.Pages.Add();
            PdfGraphicsState state = page.Canvas.Save();
            PdfPen pen = new PdfPen(Color.DeepSkyBlue, 0.02f);
            PdfBrush brush1 = new PdfSolidBrush(Color.CadetBlue);

            page.Canvas.ScaleTransform(50f, 50f);
            page.Canvas.TranslateTransform(5f, 1.2f);
            page.Canvas.DrawPath(pen, path);

            page.Canvas.TranslateTransform(2f, 0f);
            path.FillMode = PdfFillMode.Alternate;
            page.Canvas.DrawPath(pen, brush1, path);

            page.Canvas.TranslateTransform(2f, 0f);
            path.FillMode = PdfFillMode.Winding;
            page.Canvas.DrawPath(pen, brush1, path);

            PdfLinearGradientBrush brush2
                = new PdfLinearGradientBrush(new PointF(-2, 0), new PointF(2, 0), Color.Red, Color.Blue);
            page.Canvas.TranslateTransform(-4f, 2f);
            path.FillMode = PdfFillMode.Alternate;
            page.Canvas.DrawPath(pen, brush2, path);

            PdfRadialGradientBrush brush3
                = new PdfRadialGradientBrush(new PointF(0f, 0f), 0f, new PointF(0f, 0f), 1f, Color.Red, Color.Blue);
            page.Canvas.TranslateTransform(2f, 0f);
            path.FillMode = PdfFillMode.Winding;
            page.Canvas.DrawPath(pen, brush3, path);

            PdfTilingBrush brush4 = new PdfTilingBrush(new RectangleF(0, 0, 4f, 4f));
            brush4.Graphics.DrawRectangle(brush2, 0, 0, 4f, 4f);

            page.Canvas.TranslateTransform(2f, 0f);
            path.FillMode = PdfFillMode.Winding;
            page.Canvas.DrawPath(pen, brush4, path);

            //restor graphics
            page.Canvas.Restore(state);
        }
    }
}
[VB.NET]
Imports Spire.Pdf
Imports Spire.Pdf.Graphics
Imports System.Drawing


Namespace FivePointedStar
	Class Program
		Private Shared Sub DrawStar(page As PdfPageBase)
			Dim doc As New PdfDocument()
			Dim page As PdfPageBase = doc.Pages.Add()
			Dim points As PointF() = New PointF(4) {}
			For i As Integer = 0 To points.Length - 1
				Dim x As Single = CSng(Math.Cos(i * 2 * Math.PI / 5))
				Dim y As Single = CSng(Math.Sin(i * 2 * Math.PI / 5))
				points(i) = New PointF(x, y)
			Next
			Dim path As New PdfPath()
			path.AddLine(points(2), points(0))
			path.AddLine(points(0), points(3))
			path.AddLine(points(3), points(1))
			path.AddLine(points(1), points(4))
			path.AddLine(points(4), points(2))

			'save graphics state
			Dim doc As New PdfDocument()
			Dim page As PdfPageBase = doc.Pages.Add()
			Dim state As PdfGraphicsState = page.Canvas.Save()
			Dim pen As New PdfPen(Color.DeepSkyBlue, 0.02F)
			Dim brush1 As PdfBrush = New PdfSolidBrush(Color.CadetBlue)

			page.Canvas.ScaleTransform(50F, 50F)
			page.Canvas.TranslateTransform(5F, 1.2F)
			page.Canvas.DrawPath(pen, path)

			page.Canvas.TranslateTransform(2F, 0F)
			path.FillMode = PdfFillMode.Alternate
			page.Canvas.DrawPath(pen, brush1, path)

			page.Canvas.TranslateTransform(2F, 0F)
			path.FillMode = PdfFillMode.Winding
			page.Canvas.DrawPath(pen, brush1, path)

			Dim brush2 As New PdfLinearGradientBrush(New PointF(-2, 0), New PointF(2, 0), Color.Red, Color.Blue)
			page.Canvas.TranslateTransform(-4F, 2F)
			path.FillMode = PdfFillMode.Alternate
			page.Canvas.DrawPath(pen, brush2, path)

			Dim brush3 As New PdfRadialGradientBrush(New PointF(0F, 0F), 0F, New PointF(0F, 0F), 1F, Color.Red, Color.Blue)
			page.Canvas.TranslateTransform(2F, 0F)
			path.FillMode = PdfFillMode.Winding
			page.Canvas.DrawPath(pen, brush3, path)

			Dim brush4 As New PdfTilingBrush(New RectangleF(0, 0, 4F, 4F))
			brush4.Graphics.DrawRectangle(brush2, 0, 0, 4F, 4F)

			page.Canvas.TranslateTransform(2F, 0F)
			path.FillMode = PdfFillMode.Winding
			page.Canvas.DrawPath(pen, brush4, path)

			'restor graphics
			page.Canvas.Restore(state)
		End Sub
	End Class
End Namespace

Effective Screenshot:

Draw Special Shapes in PDF

Draw Spiral in PDF

A spiral is a curve which emanates from a central point, getting progressively farther away as it revolves around the point. Spire.PDF can also help us easily draw Spiral in PDF and we can design at will.

[C#]
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System;

namespace DrawSpiral
{
    class Program
    {
        static void Main(string[] args)
        {
            PdfDocument doc = new PdfDocument();
            PdfPageBase page = doc.Pages.Add();
            //save graphics state
            PdfGraphicsState state = page.Canvas.Save();

            //Draw shap - spiro
            PdfPen pen = PdfPens.DeepSkyBlue;

            int nPoints = 1000;
            double r1 = 30;
            double r2 = 25;
            double p = 35;
            double x1 = r1 + r2 - p;
            double y1 = 0;
            double x2 = 0;
            double y2 = 0;

            page.Canvas.TranslateTransform(100, 100);

            for (int i = 0; i < nPoints; i++)
            {
                double t = i * Math.PI / 90;
                x2 = (r1 + r2) * Math.Cos(t) - p * Math.Cos((r1 + r2) * t / r2);
                y2 = (r1 + r2) * Math.Sin(t) - p * Math.Sin((r1 + r2) * t / r2);
                page.Canvas.DrawLine(pen, (float)x1, (float)y1, (float)x2, (float)y2);
                x1 = x2;
                y1 = y2;
            }

            //restor graphics
            page.Canvas.Restore(state);
        }
    }
}
[VB.NET]
Imports Spire.Pdf
Imports Spire.Pdf.Graphics
Imports Spire.Pdf.Texts
Imports System.Drawing

Namespace AddLineNumber
    Class Program
		Shared Sub Main(ByVal args() As String)
			Dim doc As New PdfDocument()
			Dim page As PdfPageBase = doc.Pages.Add()
			'save graphics state
			Dim state As PdfGraphicsState = page.Canvas.Save()

			'Draw shap - spiro
			Dim pen As PdfPen = PdfPens.DeepSkyBlue

			Dim nPoints As Integer = 1000
			Dim r1 As Double = 30
			Dim r2 As Double = 25
			Dim p As Double = 35
			Dim x1 As Double = r1 + r2 - p
			Dim y1 As Double = 0
			Dim x2 As Double = 0
			Dim y2 As Double = 0

			page.Canvas.TranslateTransform(100, 100)

			For i As Integer = 0 To nPoints - 1
				Dim t As Double = i * Math.PI / 90
				x2 = (r1 + r2) * Math.Cos(t) - p * Math.Cos((r1 + r2) * t / r2)
				y2 = (r1 + r2) * Math.Sin(t) - p * Math.Sin((r1 + r2) * t / r2)
				page.Canvas.DrawLine(pen, CSng(x1), CSng(y1), CSng(x2), CSng(y2))
				x1 = x2
				y1 = y2
			Next

			'restor graphics
			page.Canvas.Restore(state)

		End Sub
	End Class
End Namespace

Effective Screenshot:

Draw Special Shapes in PDF

Compared with text-only documents, documents containing images are undoubtedly more vivid and engaging to readers. When generating or editing a PDF document, you may sometimes need to insert images to improve its appearance and make it more appealing. In this article, you will learn how to insert, replace or delete images in PDF documents in C# and VB.NET using Spire.PDF for .NET.

Install Spire.PDF for .NET

To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.

PM> Install-Package Spire.PDF

Insert an Image into a PDF Document in C# and VB.NET

The following steps demonstrate how to insert an image into an existing PDF document:

  • Initialize an instance of the PdfDocument class.
  • Load a PDF document using PdfDocument.LoadFromFile() method.
  • Get the desired page in the PDF document through PdfDocument.Pages[pageIndex] property.
  • Load an image using PdfImage.FromFile() method.
  • Specify the width and height of the image area on the page.
  • Specify the X and Y coordinates to start drawing the image.
  • Draw the image on the page using PdfPageBase.Canvas.DrawImage() method.
  • Save the result document using PdfDocument.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Pdf;
using Spire.Pdf.Graphics;

namespace InsertImage
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a PdfDocument instance
            PdfDocument pdf = new PdfDocument();
            pdf.LoadFromFile("Input.pdf");

            //Get the first page in the PDF document
            PdfPageBase page = pdf.Pages[0];

            //Load an image
            PdfImage image = PdfImage.FromFile("image.jpg");

            //Specify the width and height of the image area on the page
            float width = image.Width * 0.50f;
            float height = image.Height * 0.50f;

            //Specify the X and Y coordinates to start drawing the image
            float x = 180f;
            float y = 70f;

            //Draw the image at a specified location on the page
            page.Canvas.DrawImage(image, x, y, width, height);

            //Save the result document
            pdf.SaveToFile("AddImage.pdf", FileFormat.PDF);
        }
    }
}

C#/VB.NET: Insert, Replace or Delete Images in PDF

Replace an Image with Another Image in a PDF Document in C# and VB.NET

The following steps demonstrate how to replace an image with another image in a PDF document:

  • Initialize an instance of the PdfDocument class.
  • Load a PDF document using PdfDocument.LoadFromFile() method.
  • Get the desired page in the PDF document through PdfDocument.Pages[pageIndex] property.
  • Load an image using PdfImage.FromFile() method.
  • Initialize an instance of the PdfImageHelper class.
  • Get the image information from the page using PdfImageHelper.GetImagesInfo() method.
  • Replace a specific image on the page with the loaded image using PdfImageHelper.ReplaceImage() method.
  • Save the result document using PdfDocument.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Pdf;
using Spire.Pdf.Graphics;
using Spire.Pdf.Utilities;

namespace ReplaceImage
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a PdfDocument instance
            PdfDocument doc = new PdfDocument();
            //Load a PDF document
            doc.LoadFromFile("AddImage.pdf");

            //Get the first page
            PdfPageBase page = doc.Pages[0];

            //Load an image
            PdfImage image = PdfImage.FromFile("image1.jpg");

            //Create a PdfImageHelper instance
            PdfImageHelper imageHelper = new PdfImageHelper();
            //Get the image information from the page
            PdfImageInfo[] imageInfo = imageHelper.GetImagesInfo(page);
            //Replace the first image on the page with the loaded image
            imageHelper.ReplaceImage(imageInfo[0], image);

            //Save the result document
            doc.SaveToFile("ReplaceImage.pdf", FileFormat.PDF);
        }
    }
}

C#/VB.NET: Insert, Replace or Delete Images in PDF

Delete a Specific Image in a PDF Document in C# and VB.NET

The following steps demonstrate how to delete an image from a PDF document:

  • Initialize an instance of the PdfDocument class.
  • Load a PDF document using PdfDocument.LoadFromFile() method.
  • Get the desired page in the PDF document through PdfDocument.Pages[pageIndex] property.
  • Delete a specific image on the page using PdfPageBase.DeleteImage() method.
  • Save the result document using PdfDocument.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Pdf;

namespace DeleteImage
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a PdfDocument instance
            PdfDocument pdf = new PdfDocument();
            //Load a PDF document
            pdf.LoadFromFile("AddImage.pdf");

            //Get the first page
            PdfPageBase page = pdf.Pages[0];

            //Delete the first image on the page
            PdfImageHelper imageHelper = new PdfImageHelper();
            PdfImageInfo[] imageInfos = imageHelper.GetImagesInfo(pdf.Pages[0]);
            for (int i = 0; i < imageInfos.Length; i++)
            { imageHelper.DeleteImage(imageInfos[i], true); }

            //Save the result document
            pdf.SaveToFile("DeleteImage.pdf", FileFormat.PDF);
        }
    }
}

C#/VB.NET: Insert, Replace or Delete Images in PDF

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Tuesday, 30 August 2011 09:21

XLS Report Silverlight

The sample demonstrates how to work with MarkerDesign in Silverlight via Spire.XLS.

Download template xls file.

Download data table file.

Download merged result file.

Wednesday, 17 August 2011 06:53

Convert Specific Worksheet Cells to Image

This section aims at providing a detail solution for developers on how to convert specific worksheet cells to image via this .NET Excel component Spire.XLS for .NET in C#, VB.NET. This Excel library helps us quickly convert certain excel cells to different image formats such as jpeg, png, bmp, tiff, gif, ico, emf, exif etc.

When we convert worksheet to image, Spire.XLS for .NET provides us a method: Spire.Xls.Worksheet.ToImage(int firstRow, int firstColumn, int lastRow, int lastColumn); As we see, there are four parameters passed in this method. These four parameters determine the certain range of cells. After deciding the cell range, we can successfully convert cells to image. Now, let us see the whole task step by step.

Step 1: Create a template Excel Workbook in MS Excel

I create a new Excel file in MS Excel and add some data which have different formats in the first sheet, here is a screenshot of created file.

Excel to Image

Step 2: Download and Install Spire.XLS for .NET

Spire.XLS for .NET is an Excel Api which enables users to quickly generate, read, edit and manipulate Excel files on .NET Platform. Here you can download Spire.XLS for .NET and install it on your development computer. After installing it, Spire.XLS for .NET will run in evaluation mode which is the same when you install other Spire components. This evaluation mode has no time limit.

Step 3: Create a project and Add References

We can create a new project of Console Application either in C# or VB.NET. I create in C#, but we can choose VB.NET too.

In this project, we need to add references in our project. Apart from adding System.Drawing, we will use Spire.XLS for .NET, so we also have to add Spire.Xls.dll, Spire.Common.dll and Spire.License.dll in our download Bin folder of Spire.Xls. Here we can see the default path: "..\Spire.XLS\Bin\NET4.0\Spire.XLS.dll"

Step 4: Convert Specific Worksheet Cells to Image

In this step, first we can initialize a new object of the class Spire.Xls.Workbook, then, load the template Excel file. Since I want to convert cells in the first sheet to image, I need get the first worksheet data in Excel file. You also can get other worksheet data. Finally specify cell range and save the cells in the range as image file. Spire.XLS for .NET supports 12 image formats: Bmp, Emf, Equals, Exif, Gif, Icon, Jpeg, MemoryBmp, Png, ReferenceEquals, Tiff and Wmf.

[C#]
using System.Drawing.Imaging;
using Spire.Xls;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initialize a new Workbook object
            Workbook workbook = new Workbook();
            //Open Template Excel file
            workbook.LoadFromFile(@"..\excel to image.xlsx");
            //Get the first wirksheet in Excel file
            Worksheet sheet = workbook.Worksheets[0];
            //Specify Cell Ranges and Save to certain Image formats
            sheet.ToImage(1, 1, 6, 3).Save("image1.png", ImageFormat.Png);
            sheet.ToImage(7, 1, 12, 3).Save("image2.jpeg", ImageFormat.Jpeg);
            sheet.ToImage(13, 1, 18, 3).Save("image3.bmp", ImageFormat.Bmp);
        }
    }
}
[VB.NET]
Imports System.Drawing.Imaging
Imports Spire.Xls

Module Module1

    Sub Main()
        'Initialize a new Workbook object
        Dim workbook As New Workbook()
        'Open Template Excel file
        workbook.LoadFromFile("..\excel to image.xlsx")
        'Get the first wirksheet in Excel file
        Dim sheet As Worksheet = workbook.Worksheets(0)
        'Specify Cell Ranges and Save to certain Image formats
        sheet.ToImage(1, 1, 6, 3).Save("image1.png", ImageFormat.Png)
        sheet.ToImage(7, 1, 12, 3).Save("image2.jpeg", ImageFormat.Jpeg)
        sheet.ToImage(13, 1, 18, 3).Save("image3.bmp", ImageFormat.Bmp)
    End Sub

End Module

Result Task

After executing above code, cells in the first worksheet named "Sheet1" has been converted to three images. They are named "image1.png", "image2.jpeg" and "image3.bmp". You can see them as below:

Excel to Image

In this section, I have introduced how we can convert specific cells to image by using Spire.XLS for .NET. I sincerely hope it can help you and give you some insight.

Spire.XLS for .NET offers fast speed, high efficiency and reliability to satisfy development application requirements. As you see above, the results do show that Spire.XLS for .NET benefit customers from years of research.

We appreciate any kind of queries, comments and suggestions at E-iceblue Forum. We promise a quick reply within minutes or hours as we can.

Monday, 25 July 2011 09:12

XLS to PDF in C#, VB.NET

The sample demonstrates how to convert Excel workbook to PDF file via Spire.XLS.

Get XLS-to-PDF.pdf.