// initialize PrintDocument object PrintDocument doc = new PrintDocument() { PrinterSettings = new PrinterSettings() { // set the printer to 'Microsoft Print to PDF' PrinterName = "Microsoft Print to PDF", // tell the object this document will print to file PrintToFile = true, // set the filename to whatever you like (full path) PrintFileName = Path.Combine(directory, file + ".pdf"), }; }
The following code works fine: DOCINFO Dinfo ; ... Dinfo.lpszOutput = (LPCSTR)"D:\\Test1.pdf";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)