//SERVE PER IMPOSTARE LA STAMPANTE PREDEFINITA public static class PrinterClass { [DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)] public static extern bool SetDefaultPrinter(string Printer); } private void button2_Click(object sender, EventArgs e) { //set default printer PrinterClass.SetDefaultPrinter("ThinkDesign Printer"); //printFont = new Font("Arial", 10); PrintDocument pd = new PrintDocument(); PaperSize paperSize = new PaperSize("Test", 800, 1200); paperSize.RawKind = (int)PaperKind.Custom; pd.DefaultPageSettings.PaperSize = paperSize; pd.DefaultPageSettings.Landscape = true; pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); pd.PrintPage += new PrintPageEventHandler(this.stampaPdf); pd.Print();// Print the document. } public void stampaPdf(object sender, PrintPageEventArgs e) { TD_APPLLib.Application ifAppl = (TD_APPLLib.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Td_appl.Application"); ifAppl.Visible = true; TD_APPLLib.Document docCorrente = ifAppl.Documents.Open(@"C:\Temp\1473-mj.e2"); TD_APPLLib.Document ifCurrDoc = ifAppl.Documents.Add(); docCorrente.Visible = true; }
stampaPdf
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)