Quick Start - wPDFControl.NET

[Top]  [Chapter]  [Previous]  [Next]

A) Installation


Please install the .NET wrapper class for wPDFControl into your .NET development system:


MS Visual Studio: Click right on toolbox and select 'Customize'. Use the 'Locate ...' button to show the file open dialog to add the assembly wPDF.DLL.


Borland C# Builder: Click right on the toolbox and select 'Customize'. Add the path of the assembly wPDF.DLL (3rd page on the dialog).


Please activate the 3 components 'PDFControl, PDFPropDlg, RTF2PDF' which are all in the namespace 'wPDF'.


When you use the included demo projects or create your own project you always need to add a reference to the wPDF assembly installed in the wPDFControl directory under



Please note that your application will always need

a) wPDF.DLL and

b) either of wPDFControlDemo.DLL or wPDFControl0x.DLL or wRTF2PDF0x.DLL in its directory to run.

Which of this DLLs are required depends on wether you are using the demo, the standard PDFControl or the enhanced RTF2PDF control which includes the PDF functionality with added RTF export functions.


B) Add the components to the form


Select the PDFControl and click on the form.

Select the PDFPropDlg component and click on the form.


Connect both component by selecting the PDFControl instance in the property 'PDFPropDlg.PDFControl'.


C) Add a button to the form to show the important PDF properties


In the OnClick event handler of button1 please use the code:


private void button1_Click(object sender, System.EventArgs e)





D) Add code to the form to show a file open dialog and let the user select

metafiles and bitmap files which will be exported to PDF.


private void button2_Click(object sender, System.EventArgs e)


   // We need a filename

   if(pdfControl1.FileName=="") pdfPropDlg1.Execute(false);


   // A dialog to select a file name

   System.Windows.Forms.OpenFileDialog OpenDia = 

   new System.Windows.Forms.OpenFileDialog();

   OpenDia.Filter = "Graphic Files|*.WMF;*.EMF;*.BMP;*.JPG;*.JPEG";

   OpenDia.Multiselect = true;

   // If ok then create a PDF file with all selected EMF files






        for(int i=0;i<OpenDia.FileNames.Length;i++)












E) What you can also do:


Draw using the property 'Canvas' which is compatible to the Graphics class:




 Font font = new Font("Arial", 10);

 SolidBrush brush = new SolidBrush(Color.Black);

 Pen pen = new Pen(Color.Red, 1);


 pdfControl1.Canvas.DrawString("Hello World",

                 font, brush,40, 50);

 pdfControl1.Canvas.DrawRectangle(pen, 20,20,300,300);




We have added a "font manager" to make it easier to use fonts. You don't have to create a font object, only to change the property pdfControl1.Font like this:


 pdfControl2.Font.Size = 11;

 pdfControl2.Font.Color = Color.Red;

 pdfControl2.TextOut("Hello ",40, 50);

 pdfControl2.Font.Style = FontStyle.Bold;

 pdfControl2.TextOut("PDFCONTROL ");


When you pass "\n" a new line will be created by advancing using

the last font height and resetting x to the position defined the last time with TextOut(string,x,y). The intern position pointer will be advanced by using the return value of the MeasureString function.

[quickstart.htm]    Copyright © 2007 by WPCubed GmbH