AUTOIT – Gerar PDF

Imprimir em PDF com AutoIT


//
To print a PrintDocument object using the Microsoft Print to PDF printer without prompting for a filename, here is the pure code way to do this:
// generate a file name as the current date/time in unix timestamp format
file
= (string)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds.ToString();

// the directory to store the output.
directory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

// initialize PrinterDocument object
PrinterDocument doc
= new PrinterDocument() {
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”),
};
}

doc.Print()

 

Fonte:
Link original