Quick Start - wRTF2PDF / TextDynamic Server

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

 

Using wRTF2PDF / TextDynamic Server you can convert RTF and HTML/CSS files to PDF. You can also create new RTF, HTML and PDF files using a powerful API. It is also possible to work with data fields, please see the documentation about the "mail merge" feature.

 

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

\DLL\.NET\Demo\wPDF.DLL or \DLL\.NET\Full\wPDF.DLL.

 

Please note that your application will always need

 

a) wPDF.DLL and

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

 

 

A) Alternative 1: Create the component in code

 

       {

           wPDF.RTF2PDF rtF2PDF1;

         

           rtF2PDF1 = new wPDF.RTF2PDF();

           rtF2PDF1.PDFMode = wPDF.eDevMode.ClipRectSupport;

           rtF2PDF1.PDFOptions = wPDF.ePDFOptions.CreateAutoLinks;

           rtF2PDF1.Thumbnails = wPDF.eThumbnails.Color;

 

          rtF2PDF1.SetLicense("name", "key", 1); // For registered version

 

           openFileDialog1.Filter = "Text Files (*.TXT;*.RTF;*.HTM)|*.TXT;*.RTF;*.HTM;*.MHT;*.MSG";

 

          if (openFileDialog1.ShowDialog() == DialogResult.OK)

           {

               rtF2PDF1.Memo.LoadFromFile(openFileDialog1.FileName); // @"c:\a.rtf");

               rtF2PDF1.PdfCreator.PDFFile = textBox1.Text;

               rtF2PDF1.PdfCreator.Print();

           }

 

          rtF2PDF1.Dispose();

           rtF2PDF1 = null;

       }

 

B) Alternative 2: Add the component to the form

 

1) Select the RTF2PDF and click on the form.

2) Add a button to the form to load file and export

 

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

  {

   rtF2PDF1.SetLicense("name", "key", 1); // For registered version

   IWPEditor memo = rtF2PDF1.Memo;

   IWPTextCursor cursor = memo.TextCursor;

   IWPPdfCreator pdf = rtF2PDF1.PdfCreator;

 

   string path = "..\\..\\";

  

                                        

  if(memo.LoadFromFile(path+ "demo.rtf"false""))

  {

        pdf.PDFFile = path+ "new_pdf.pdf";

        pdf.Print();

  }

 else MessageBox.Show("Cannot load RTF");

}

 

Please see the other examples in the RTF2PDF section ....

 

C) Troubleshooting

 

In case You use the wRTF2PDF demo DLL and see the error "Runtime 207" when closing the application please deactivate the Visual Studio 2008 hosting process by removing the check here:

 

clip0189

 


[quick_start___wrtf2pdf__textdy.htm]    Copyright © 2007 by WPCubed GmbH