RTF2PDF Command IDs |
[Top] [Chapter] [Previous] [Next] |
The internal RTF engine is controlled by the function ExecComand() with the command numbers listed here.
The ActiveX wraps this function as methods as ExecCommand, ExecIntCommand and ExecStrCommand. Normally you will use ExecStrCommand() since this method lets you specify a string as a parameter.
C example code to create a PDF engine, load a file and print it to PDF.
pdf=wpdfInitializeEx(&Info); // Initialize the PDF Engine if(wpdfBeginDoc(pdf,"C:\\aTestPDF.pdf",0)) // Create PDF File { wpdfExecCommand(pdf,1000,0,"",0); // Initialize the RTF engine wpdfExecCommand(pdf,1002,0,"C:\\test.RTF",0); // Load a RTF file wpdfExecCommand(pdf,1100,0,"",0); // Export this RTF file to PDF wpdfEndDoc(pdf); } wpdfFinalize(pdf);
You can use the header file wPDF.H and wpdf_class.h for convenient binding.
Tip: Please also see: Commands to print text (to printer, not PDF!)
Example VB.NET Code to convert a RTF file to PDF: If PDF.StartEngine(DLLNAME.Text, "", "", 0) Then ' you your license info here ! If PDF.BeginDoc(PDFNAME.Text, 0) > 0 Then ' Start a PDF document PDF.ExecIntCommand(1000, 0) ' Initialize the RTF engine PDF.ExecIntCommand(1024, 1) ' use the printer as reference (suggested) PDF.ExecStrCommand(1002, RTFNAME.Text) ' Load a RTF file PDF.ExecIntCommand(1100, 0) ' Export this RTF file to PDF PDF.EndDoc() ' Close the PDF document End If End If
Example VBS Code to convert RTF to PDF: uses the ActiveX) Set PDF = CreateObject("wPDF_X01.PDFControl") PDF.INFO_Date = Now PDF.INFO_Author = "Julian Ziersch" PDF.INFO_Subject = "Test file" ' ... set other properties
PDF.StartEngine "c:\wPDFControl\DLL\wRTF2PDF01.dll", "LIC_NAME", "LIC_KEY" ,0 ' License Info! PDF.BeginDoc "Test.PDF", 0 PDF.ExecIntCommand 1000, 0 PDF.ExecIntCommand 1024, 1 PDF.ExecStrCommand 1002, "Demo.RTF" PDF.ExecIntCommand 1100, 0 PDF.EndDoc PDF.StopEngine Set PDF = Nothing |