I guess the "Print" does not create a PDF, please use Export. In some IDs Print is taken by the runtime and will not execute the internal method.
FAQ: How can I export to PDF
I am using the trial version of the TextDynamic control in a Visual FoxPro 9 form and am trying to export the contents of the editor to a PDF file. This is the code I am running
oPDF = GETINTERFACE(Thisform.oleControl1.PDFCreator, "{C6B1B485-6EB5-4360-9C19-7BCBA4E43529}", "WPTDynInt.ocx")
If Not IsNull(oPDF)
oPDF.PDFFile = "C:\O32\2014P3\Opera32\DEMODATA\GRE0001_DebtorLetter1.pdf"
oPDF.Print()
oPDF = NULL
EndIf
The code runs without error but the PDF file is not being created. I really need this to work before I can make the decision to purchase the product or not.
Q:How can I export a PDF file
A:You need to use the interface IWPPdfCreator. The interface is provided by the demo version and if you have the full version with integrated PDF support.
IWPPdfCreator PDFCreator = WPDLLInt1.PDFCreator;if (PDFCreator!=null){ PDFCreator.PDFFile = "MyDocument.pdf"; PDFCreator.Print();} else MessageBox.Show("PDF Creation not available");
It is also possible to create a PDF from multiple documents. Then you have to use BeginDoc/EndDoc. In this C# example we use MergeText to replace replace the contents of the datafields.
IWPPdfCreator PDFCreator = WPDLLInt1.PDFCreator;
if (PDFCreator!=null)
{
WPDLLInt1.PDFCreator.PDFFile = "c:\\all_letters.pdf";
WPDLLInt1.PDFCreator.BeginDoc();
GotoFirstDataRow();
while (! AtEndOfData() )
{
WPDLLInt1.Memo.MergeText("");
WPDLLInt1.Memo.ReformatAll(false,false);
WPDLLInt1.PDFCreator.Print();
GotoNextDataRow();
}
WPDLLInt1.PDFCreator.EndDoc();
} else MessageBox.Show("PDF Creation not available");
Regards,
Julian Ziersch