The sample demonstrates how to use Excel Filter function in Silverlight via Spire.XLS.

C#: Convert RTF to HTML, Image

2024-09-10 02:49:00 Written by Koohji

RTF, or Rich Text Format, is a file format designed for storing text and formatting information. While processing RTF files, sometimes you might need to convert them into a more web-friendly format such as HTML, or convert to images for better sharing and archiving purposes. In this article, you will learn how to convert RTF to HTML or images in C# using Spire.Doc for .NET.

Install Spire.Doc for .NET

To begin with, you need to add the DLL files included in the Spire.Doc 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.Doc

Convert RTF to HTML in C#

Converting RTF to HTML ensures that the document can be easily viewed and edited in any modern web browser without requiring any additional software.

With Spire.Doc for .NET, you can achieve RTF to HTML conversion through the Document.SaveToFile(string fileName, FileFormat.Html) method. The following are the detailed steps.

  • Create a Document instance.
  • Load an RTF document using Document.LoadFromFile() method.
  • Save the RTF document in HTML format using Document.SaveToFile(string fileName, FileFormat.Html) method.
  • C#
using Spire.Doc;

namespace ConvertRtfToHtml
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Document instance
            Document document = new Document();

            //Load an RTF document 
            document.LoadFromFile("input.rtf");

            //Save as HTML format
            document.SaveToFile("RtfToHtml.html", FileFormat.Html);
        }
    }
}

C#: Convert RTF to HTML, Image

Convert RTF to Image in C#

To convert RTF to images, we can use the Document.SaveToImages() method to convert an RTF file into individual Bitmap or Metafile images. Then, the Bitmap or Metafile images can be saved as a BMP, EMF, JPEG, PNG, GIF, or WMF format files. The following are the detailed steps.

  • Create a Document object.
  • Load an RTF document using Document.LoadFromFile() method.
  • Convert the document to images using Document.SaveToImages() method.
  • Iterate through the converted image, and then save each as a PNG file using Image[].Save(string fileName, ImageFormat format) method.
  • C#
using Spire.Doc;
using System.Drawing.Imaging;
using System.Drawing;
using Spire.Doc.Documents;

namespace ConvertRtfToImage

{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Document instance
            Document document = new Document();

            //Load an RTF document 
            document.LoadFromFile("input.rtf");

            //Convert the RTF document to images
            Image[] images = document.SaveToImages(ImageType.Bitmap);

            // Iterate through the image collection
            for (int i = 0; i < images.Length; i++)
            {
                //Save the image as png format
                string outputfile = string.Format("image-{0}.png", i);
                images[i].Save(outputfile, ImageFormat.Png);
            }
        }
    }
}

C#: Convert RTF to HTML, Image

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.

Excel spreadsheet is a widely used file format that enables users to organize, analyze, and present data in a tabular format. The ability to interact with Excel files programmatically is highly valuable, as it allows automation and integration of Excel functionality into software applications. This capability is particularly useful when working with large datasets, performing complex calculations, or when data needs to be dynamically generated or updated. In this article, you will learn how to create, read, or update Excel documents in C# and VB.NET using Spire.XLS for .NET.

Install Spire.XLS for .NET

To begin with, you need to add the DLL files included in the Spire.XLS 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.XLS

Create an Excel File in C#, VB.NET

Spire.XLS for .NET offers a variety of classes and interfaces that you can use to create and edit Excel documents. Here is a list of important classes, properties and methods involved in this article.

Member Description
Workbook class Represents an Excel workbook model.
Workbook.Worksheets.Add() method Adds a worksheet to workbook.
Workbook.SaveToFile() method Saves the workbook to an Excel document.
Worksheet class Represents a worksheet in a workbook.
Worksheet.Range property Gets a specific cell or cell range from worksheet.
Worksheet.Range.Value property Gets or sets the value of a cell.
Worksheet.Rows property Gets a collection of rows in worksheet.
Worksheet.InsertDataTable() method Imports data from DataTable to worksheet.
CellRange class Represents a cell or cell range in worksheet.

The following are the steps to create an Excel document from scratch using Spire.XLS for .NET.

  • Create a Workbook object.
  • Add a worksheet using Workbook.Worksheets.Add() method.
  • Write data to a specific cell through Worksheet.Range.Value property.
  • Import data from a DataTable to the worksheet using Worksheet.InsertDataTable() method.
  • Save the workbook to an Excel document using Workbook.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Xls;
using System.Data;

namespace CreateExcelSpreadsheet
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Workbook object
            Workbook wb = new Workbook();

            //Remove default worksheets
            wb.Worksheets.Clear();

            //Add a worksheet and name it "Employee"
            Worksheet sheet = wb.Worksheets.Add("Employee");

            //Merge the cells between A1 and G1
            sheet.Range["A1:G1"].Merge();

            //Write data to A1 and apply formatting to it
            sheet.Range["A1"].Value = "Basic Information of Employees of Huanyu Automobile Company";
            sheet.Range["A1"].HorizontalAlignment = HorizontalAlignType.Center;
            sheet.Range["A1"].VerticalAlignment = VerticalAlignType.Center;
            sheet.Range["A1"].Style.Font.IsBold = true;
            sheet.Range["A1"].Style.Font.Size = 13F;

            //Set row height of the first row
            sheet.Rows[0].RowHeight = 30F;

            //Create a DataTable
            DataTable dt = new DataTable();
            dt.Columns.Add("Name");
            dt.Columns.Add("Gender");
            dt.Columns.Add("Birth Date");
            dt.Columns.Add("Educational Background");
            dt.Columns.Add("Contact Number");
            dt.Columns.Add("Position");
            dt.Columns.Add("ID");
            dt.Rows.Add("Allen", "Male", "1990-02-10", "Bachelor", "24756854", "Mechanic", "0021");
            dt.Rows.Add("Patrick", "Male", "1985-06-08", "Master", "59863247", "Mechanic", "0022");
            dt.Rows.Add("Jenna", "Female", "1989-11-25", "Bachelor", "79540352", "Sales", "0023");
            dt.Rows.Add("Tommy", "Male", "1988-04-16", "Master", "52014060", "Mechanic", "0024");
            dt.Rows.Add("Christina", "Female", "1998-01-21", "Bachelor", "35401489", "HR", "0025");

            //Import data from DataTable to worksheet
            sheet.InsertDataTable(dt, true, 2, 1, true);

            //Set row height of a range
            sheet.Range["A2:G7"].RowHeight = 15F;

            //Set column width 
            sheet.Range["A2:G7"].Columns[2].ColumnWidth = 15F;
            sheet.Range["A2:G7"].Columns[3].ColumnWidth = 21F;
            sheet.Range["A2:G7"].Columns[4].ColumnWidth = 15F;

            //Set border style of a range
            sheet.Range["A2:G7"].BorderAround(LineStyleType.Medium);
            sheet.Range["A2:G7"].BorderInside(LineStyleType.Thin);
            sheet.Range["A2:G2"].BorderAround(LineStyleType.Medium);
            sheet.Range["A2:G7"].Borders.KnownColor = ExcelColors.Black;

            //Save to a .xlsx file
            wb.SaveToFile("NewSpreadsheet.xlsx", FileFormat.Version2016);
        }
    }
}

C#/VB.NET: Create, Read, or Update Excel Documents

Read Data of a Worksheet in C#, VB.NET

The Worksheet.Range.Value property returns number value or text value of a cell as a string. To get data of a whole worksheet or a cell range, loop through the cells within it. The following are the steps to get data of a worksheet using Spire.XLS for .NET.

  • Create a Workbook object.
  • Load an Excel document using Workbook.LoadFromFile() method.
  • Get a specific worksheet through Workbook.Worksheets[index] property.
  • Get the cell range containing data though Worksheet.AllocatedRange property.
  • Iterate through the rows and columns to get cells within the range, and return the value of each cell through CellRange.Value property.
  • C#
  • VB.NET
using Spire.Xls;

namespace ReadExcelData
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Workbook object
            Workbook wb = new Workbook();

            //Load an existing Excel file
            wb.LoadFromFile(@"C:\Users\Administrator\Desktop\NewSpreadsheet.xlsx");

            //Get the first worksheet
            Worksheet sheet = wb.Worksheets[0];

            //Get the cell range containing data
            CellRange locatedRange = sheet.AllocatedRange;

            //Iterate through the rows
            for (int i = 0;i < locatedRange.Rows.Length;i++)
            {
                //Iterate through the columns
                for (int j = 0; j < locatedRange.Rows[i].ColumnCount; j++)
                {
                    //Get data of a specific cell
                    Console.Write(locatedRange[i + 1, j + 1].Value + "  ");

                }
                Console.WriteLine();            
            }
        }
    }
}

C#/VB.NET: Create, Read, or Update Excel Documents

Update an Excel Document in C#, VB.NET

To change the value of a certain cell, just re-assign a value to it through Worksheet.Range.Value property. The following are the detailed steps.

  • Create a Workbook object.
  • Load an Excel document using Workbook.LoadFromFile() method.
  • Get a specific worksheet through Workbook.Worksheets[index] property.
  • Change the value of a particular cell though Worksheet.Range.Value property.
  • Save the workbook to an Excel file using Workbook.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Xls;

namespace UpdateCellValue
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Workbook object
            Workbook wb = new Workbook();

            //Load an existing Excel file
            wb.LoadFromFile(@"C:\Users\Administrator\Desktop\NewSpreadsheet.xlsx");

            //Get the first worksheet
            Worksheet sheet = wb.Worksheets[0];

            //Change the value of a specific cell
            sheet.Range["A1"].Value = "Updated Value";

            //Save to file
            wb.SaveToFile("Updated.xlsx", ExcelVersion.Version2016);
        }
    }
}

C#/VB.NET: Create, Read, or Update Excel Documents

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.

Setting a background in Excel can offer several benefits that enhance the usability and visual appeal of your workbook. For example, you can set background colors or images that align with company branding or specific themes, making your spreadsheets visually cohesive with other marketing or business materials. In this article, you will learn how set a background color or image for an Excel worksheet in C# using Spire.XLS for .NET.

Install Spire.XLS for .NET

To begin with, you need to add the DLL files included in the Spire.XLS 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.XLS

Add a Background Color for an Excel Worksheet

Spire.XLS for .NET provides the CellRange.Style.Color property to set the background color for a specified cell range. The following are the detailed steps:

  • Create a Workbook object.
  • Load an Excel workbook using Workbook.LoadFromFile() method.
  • Get a specified worksheet using Workbook.Worksheets[] property.
  • Get the used range in the worksheet through Worksheet.AllocatedRange property.
  • Set a background color for the used range through CellRange.Style.Color property.
  • Save the result file using Workbook.SaveToFile() method.
  • C#
using Spire.Xls;
using System.Drawing;

namespace ExcelBackgroundColor
{
    class Program
    {
        static void Main(string[] args)
        {

            // Create a Workbook object
            Workbook workbook = new Workbook();

            // Load an Excel workbook 
            workbook.LoadFromFile("Budget.xlsx");

            // Get the first worksheet 
            Worksheet sheet = workbook.Worksheets[0];

            // Get the used range of the worksheet
            CellRange usedRange = sheet.AllocatedRange;

            // Set the background color of the range
            usedRange.Style.Color = Color.FromArgb(200, 233, 255);

            // Save the workbook 
            workbook.SaveToFile("ExcelBackgroundColor.xlsx", ExcelVersion.Version2016);
        }
    }
}

Set a light blue background color for a specified range in the first worksheet

Add a Background Image for an Excel Worksheet

To insert a background image in Excel, you can load an image first and then set it as the worksheet background through the Worksheet.PageSetup.BackgroundImage property. The following are the detailed steps:

  • Create a Workbook object.
  • Load an Excel workbook using Workbook.LoadFromFile() method.
  • Get a specified worksheet using Workbook.Worksheets[] property.
  • Load an image using Image.FromFile() method.
  • Set the image as the background of the worksheet through Worksheet.PageSetup.BackgroundImage property.
  • Save the result file using Workbook.SaveToFile() method.
  • C#
using Spire.Xls;
using System.Drawing;

namespace ExcelBackgroundImage
{
    class Program
    {
        static void Main(string[] args)
        {

            // Create a Workbook object
            Workbook workbook = new Workbook();

            // Load an Excel workbook 
            workbook.LoadFromFile("Budget.xlsx");

            // Get the first worksheet 
            Worksheet sheet = workbook.Worksheets[0];

            // Load an image
            Bitmap image = new Bitmap(Image.FromFile("C:\\Users\\Administrator\\Desktop\\bg.jpg"));

            // Set the background of the worksheet
            sheet.PageSetup.BackgoundImage = image;
             
            // Save the workbook 
            workbook.SaveToFile("ExcelBackgroundImage.xlsx", ExcelVersion.Version2016);
        }
    }
}

Insert a picture as the background of the first worksheet in Excel

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.

Merge PDF Documents in Silverlight

2012-01-13 03:11:49 Written by Koohji

The sample demonstrates how to Merge PDF documents in Silverlight via Spire.XLS.

(No Screenshots)

The sample demonstrates how to create Excel group in Silverlight via Spire.XLS.

Word Header in Silverlight

2012-01-13 02:29:15 Written by Koohji

The sample demonstrates how to add Word header in Silverlight via Spire.Doc.

 

This section is designed to provide developers a solution to set graphic overlay in PDF file with C#, VB.NET via a .NET PDF library Spire.PDF for .NET.

Spire.PDF for .NET enables you to set graphic overlay for PDF pages in an easy way. In order to see content in both PDF files, we can set the transparency for the overlay. Now, let us see the code detail step by step.

First, we need to load two PDF documents from system which are used for creating overlay PDF document. Then, we can create the page template as one page of the first PDF file. In my project, I set the first page in the first PDF document as the template. Finally draw this template page into every page of the second PDF file by this method: PdfPageBase.Canvas.DrawTemplate(PdfTemplate template, PointF location) and set the transparency for the page: PdfPageBase.Canvas.SetTransparency(float alphaPen, float alphaBrush, PdfBlendMode blendMode).

Here you can know more about Spire.PDF for .NET. Spire.PDF for .NET is a PDF component that is applied to manipulate PDF files in .NET applications. You can download Spire.PDF for .NET. After installing it on system, you can start your project by C# or VB.NET in either Console Application or Windows Forms Application. Since we will use Spire.PDF, you need add Spire.Pdf.dll in the Bin folder, the default path is: "..\Spire.Pdf\Bin\NET4.0\Spire.Pdf.dll". Below is the whole code of the task:

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

namespace pdf_graphic_overlay
{
    class Program
    {
        static void Main(string[] args)
        {
            //load two documents
            PdfDocument doc1 = new PdfDocument();
            doc1.LoadFromFile(@"..\ Sample1.pdf");
            PdfDocument doc2 = new PdfDocument();
            doc2.LoadFromFile(@"..\Sample3.pdf");
            //Create page template
            PdfTemplate template = doc1.Pages[0].CreateTemplate();
            //set PDF overlay effect and set transparency mode
            foreach (PdfPageBase page in doc2.Pages)
            {
                //set transparency 
                page.Canvas.SetTransparency(0.25f, 0.25f, PdfBlendMode.Overlay);
                //add the first page of doc1 to every page of doc2
                page.Canvas.DrawTemplate(template, PointF.Empty);
            }
            //Save pdf file.
            doc2.SaveToFile("Overlay.pdf");
            doc1.Close();
            doc2.Close();
            //Launching the Pdf file.
            System.Diagnostics.Process.Start("Overlay.pdf");
        }
    }
}
[VB.NET]
Imports System.Drawing
Imports Spire.Pdf
Imports Spire.Pdf.Graphics

Namespace pdf_graphic_overlay
     Class Program
	    Private Shared Sub Main(args As String())
		'load two documents
		Dim doc1 As New PdfDocument()
		doc1.LoadFromFile("..\Sample1.pdf")
		Dim doc2 As New PdfDocument()
		doc2.LoadFromFile("..\Sample3.pdf")
		'Create page template
		Dim template As PdfTemplate = doc1.Pages(0).CreateTemplate()
		'set PDF overlay effect and set transparency mode
		For Each page As PdfPageBase In doc2.Pages
			'set transparency 
			page.Canvas.SetTransparency(0.25F, 0.25F, PdfBlendMode.Overlay)
			'add the first page of doc1 to every page of doc2
			page.Canvas.DrawTemplate(template, PointF.Empty)
		Next
		'Save pdf file.
		doc2.SaveToFile("Overlay.pdf")
		doc1.Close()
		doc2.Close()
		'Launching the Pdf file.
		System.Diagnostics.Process.Start("Overlay.pdf")
	    End Sub
     End Class
End Namespace

After executing above code, we can get the output file as below:

Draw Overlay Images

I have introduced one solution to set graphic overlay for PDF document, I wish it can give you some insights. If you have problem, feedback and suggestions, please do not hesitate to put them on E-iceblue Forum, we will give prompt reply.

Spire.PDF for .NET is a PDF application which is designed to perform processing tasks on managing PDF files. It is completely written in C# but also support VB.NET.

This section aims at providing developers a detail solution to set transparency for image in PDF file with C#, VB.NET via this PDF api Spire.PDF for .NET.

Spire.PDF for .NET enables you to set transparency for PDF image directly by utilizing one core method: Spire.Pdf.PdfPageBase.Canvas.SetTransparency(float alphaPen, float alphaBrush, PdfBlendMode blendMode); There are three parameters passed in this method. The first parameter is the alpha value for pen operations; while the second parameter is the alpha value for brush operations; and the last parameter is the blend mode. Now, let us see how to set PDF transparency step by step.

Set Transparency Images in PDF File

Step1: Prepare an image file

In my solution, I need create a new PDF file and insert an existing image file to PDF. Finally set transparency for this PDF image. So I prepare an image as below:

Draw Transparency Images

Step2: Download and Install Spire.PDF for .NET

Spire.PDF for .NET is a PDF component that enables developers to generate, read, edit and handle PDF files without Adobe Acrobat. Here you can download Spire.PDF for .NET and install it on system.

Step3: Start a new project and Add references

We can create a project either in Console Application or in Windows Forms Application, either in C# or in VB.NET. Here I use C# Console Application. Since we will use Spire.PDF for .NET, we need add Spire.Pdf.dll as reference. The default path is “..\Spire.PDF\Bin\NET4.0\ Spire.Pdf.dll”

Step 4: Set PDF transparency for PDF image

In this step, first, I initialize a new instance of the class Spire.Pdf.PdfDocument and add a section in the newly created PDF. Then, load the image I have already prepared to the PDF and set the PDF image size. Finally set transparency for this PDF image. When I set transparency, I add a title for the transparency and set position and format for it. After I save the image in PDF by calling this method: PdfPageBase.Canvas.DrawImage(PdfImage image, float x, float y, float width, float height).Then, by using this method: PdfPageBase.Canvas.SetTransparency(float alphaPen, float alphaBrush, PdfBlendMode blendMode); I successfully set transparency for this PDF image. Here we can see the whole code:

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

namespace SetTransparencyOfImage
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initiate a new instance of PdfDocument 
            PdfDocument doc = new PdfDocument();
            //Add one section to the PDF document
            PdfSection section = doc.Sections.Add();
            //Open Image File
            PdfImage image = PdfImage.FromFile(@"..\016.png");
            //Set the Image size in PDF file
            float imageWidth = image.PhysicalDimension.Width / 2;
            float imageHeight = image.PhysicalDimension.Height / 2;

            //Set PDF granphic transparency 
            foreach (PdfBlendMode mode in Enum.GetValues(typeof(PdfBlendMode)))
            {
                PdfPageBase page = section.Pages.Add();
                float pageWidth = page.Canvas.ClientSize.Width;
                float y = 1;
                //Set transparency image title, title position and format
                y = y + 5;
                PdfBrush brush = new PdfSolidBrush(Color.Firebrick);
                PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", 16f, FontStyle.Bold));
                PdfStringFormat format = new PdfStringFormat(PdfTextAlignment.Center);
                String text = String.Format("Transparency Blend Mode: {0}", mode);
                page.Canvas.DrawString(text, font, brush, pageWidth / 2, y, format);
                SizeF size = font.MeasureString(text, format);
                y = y + size.Height + 6;
                //write and save the image loaded into PDF
                page.Canvas.DrawImage(image, 0, y, imageWidth, imageHeight);
                page.Canvas.Save();
                //set left and top distance between graphic images
                float d = (page.Canvas.ClientSize.Width - imageWidth) / 5;
                float x = d;
                y = y + d / 2;
                for (int i = 0; i < 5; i++)
                {
                    float alpha = 1.0f / 6 * (5 - i);
                    //set transparency to be alpha
                    page.Canvas.SetTransparency(alpha, alpha, mode);
                    //draw transparency images for the original PDF image
                    page.Canvas.DrawImage(image, x, y, imageWidth, imageHeight);
                    x = x + d;
                    y = y + d / 2;
                }
                page.Canvas.Restore();
            }
            //Save pdf file.
            doc.SaveToFile("Transparency.pdf");
            doc.Close();
            //Launching the Pdf file.
            System.Diagnostics.Process.Start("Transparency.pdf");
        }
    }
}
[VB.NET]
Imports Spire.Pdf
Imports Spire.Pdf.Graphics
Imports System.Drawing

Namespace SetTransparencyOfImage
	Class Program
		Private Shared Sub Main(args As String())
			'Initiate a new instance of PdfDocument 
			Dim doc As New PdfDocument()
			'Add one section to the PDF document
			Dim section As PdfSection = doc.Sections.Add()
			'Open Image File
			Dim image As PdfImage = PdfImage.FromFile("..\016.png")
			'Set the Image size in PDF file
			Dim imageWidth As Single = image.PhysicalDimension.Width / 2
			Dim imageHeight As Single = image.PhysicalDimension.Height / 2

			'Set PDF granphic transparency 
			For Each mode As PdfBlendMode In [Enum].GetValues(GetType(PdfBlendMode))
				Dim page As PdfPageBase = section.Pages.Add()
				Dim pageWidth As Single = page.Canvas.ClientSize.Width
				Dim y As Single = 1
				'Set transparency image title, title position and format
				y = y + 5
				Dim brush As PdfBrush = New PdfSolidBrush(Color.Firebrick)
				Dim font As New PdfTrueTypeFont(New Font("Arial", 16F, FontStyle.Bold))
				Dim format As New PdfStringFormat(PdfTextAlignment.Center)
				Dim text As [String] = [String].Format("Transparency Blend Mode: {0}", mode)
				page.Canvas.DrawString(text, font, brush, pageWidth / 2, y, format)
				Dim size As SizeF = font.MeasureString(text, format)
				y = y + size.Height + 6
				'write and save the image loaded into PDF
				page.Canvas.DrawImage(image, 0, y, imageWidth, imageHeight)
				page.Canvas.Save()
				'set left and top distance between graphic images
				Dim d As Single = (page.Canvas.ClientSize.Width - imageWidth) / 5
				Dim x As Single = d
				y = y + d / 2
				For i As Integer = 0 To 4
					Dim alpha As Single = 1F / 6 * (5 - i)
					'set transparency to be alpha
					page.Canvas.SetTransparency(alpha, alpha, mode)
					'draw transparency images for the original PDF image
					page.Canvas.DrawImage(image, x, y, imageWidth, imageHeight)
					x = x + d
					y = y + d / 2
				Next
				page.Canvas.Restore()
			Next
			'Save pdf file.
			doc.SaveToFile("Transparency.pdf")
			doc.Close()
			'Launching the Pdf file.
			System.Diagnostics.Process.Start("Transparency.pdf")
		End Sub
	End Class
End Namespace

Result Task

After performing above code, we can see the result PDF document as below:

Draw Transparency Images

I have set transparency for PDF image by Spire.PDF for .NET. I sincerely wish it can help you. We e-iceblue team appreciate any kind of queries, comments and advice at E-iceblue Forum. Our professionals are ready to reply you as quick as possible.

Spire.PDF for .NET is a PDF library that meets customers need with fast speed and high efficiency.

The sample demonstrates how to set Excel subtotal formula via Spire.XLS.

page 77