UtilityTools.ConvertRtfFile Method
This method was deprecated in HotDocs Server 11. The functionality is now available using UtilityTools.ConvertFile.
This method converts an RTF document to a PDF, HTML, or TXT document.
When converting an RTF document to PDF, HotDocs Server uses a built-in PDF converter, which analyzes the codes contained in the RTF file and translates them to PDF. This differs from the method used by other third-party PDF converters, which rely on an instance of Microsoft Word on the server from which the document is "printed" using a driver to create the PDF document. PDF documents created using a PDF driver can typically handle a greater number of formatting variations, while the PDF conversion method used by HotDocs Server works best for documents with simpler formatting. If you use HotDocs Server's built-in PDF conversion, some formatting differences will exist between the original RTF and the PDF.
Syntax
public static void ConvertRtfFile ( string rtfPath, string outPath, int options, HotDocs.Server.Interop.PdfPermissions pdfPermissions, string pdfUserPassword, string pdfOwnerPassword )
Parameters | Description |
rtfPath | The file name and path to the source RTF document that will be converted. |
outPath | The file name and path to the output document that will be created. The file name extension (.PDF, .HTM/.HTML, or .TXT) will determine which type of file to output. |
options | A number that indicates which options to use during the conversion. Currently, the only valid option is 0. |
pdfPermissions | This parameter specifies permissions granted when the PDF document is being viewed or manipulated without using the owner password. It can be a combination of values from the PdfPermissions enumeration. |
pdfUserPassword | The user password for the PDF file. The user password controls view access to the PDF file. Use an empty string ("") if you do not wish to set a password. |
pdfOwnerPassword | The owner password for the PDF file. The owner password controls print and edit access to the PDF file. Use an empty string ("") if you do not wish to set a password. |
Example
The following Visual C# example converts an RTF file to PDF. It sets one password for viewing the file, and another password for printing, copying, or modifying the file.
public class ExampleCode { static void Main() { HotDocs.Server.UtilityTools.ConvertRtfFile("c:\\temp\\original.rtf", "c:\\temp\\converted.pdf", 0, HotDocs.Server.Interop.PdfPermissions.None, "password1", "password2"); } }