Example #1
0
        static void Main(string[] args)
        {
            var printer = new PdfPrinter("Microsoft Print To PDF");

            printer.Print(printFile);
            printer.Print(printFile, documentName: "with name");
            Console.WriteLine("The files were succesfully printed.");
            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            var printer = new PdfPrinter("PDF-XChange Standard");

            printer.Print(printFile);
            printer.Print(printFile, documentName: "with name");
            Console.WriteLine("The files were succesfully printed.");
            Console.ReadKey();
        }
Example #3
0
        static void Main(string[] args)
        {
            var printer = new PdfPrinter("Microsoft Print to PDF");

            printer.Print(printFile);
            Console.WriteLine("The file was succesfully printed.");
            Console.ReadKey();
        }
Example #4
0
        private void tsmiPrint_Click(object sender, EventArgs e)
        {
            var printingRulesFilePath = SavePrintingRuleFileWithDialog();

            if (printingRulesFilePath != null)
            {
                var pdfPrinter      = new PdfPrinter();
                var printOutputPath = $"{printingRulesFilePath}.pdf";
                pdfPrinter.Print(printOutputPath, printingRulesFilePath);
            }
        }
Example #5
0
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            var path = String.Format("{0}\\{1}.pdf",
                                     Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory),
                                     DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"));

            PdfPrinter.Print(new List <Canvas> {
                canvasObj
            }, path);

            //PrintDialog pd = new PrintDialog();
            //if (pd.ShowDialog() ?? false)
            //  pd.PrintVisual(ViewboxObj, "Printing a UserControl");
        }
Example #6
0
        static void Main(string[] args)
        {
            var resultsFilePath       = @".\Results.txt";
            var printingRulesFilePath = @".\Printings.xml";

            var results    = File.ReadAllLines(resultsFilePath);
            var pdfPrinter = new PdfPrinter();

            foreach (var result in results)
            {
                var  nameAndPosition = result.Split(';');
                uint position        = Convert.ToUInt32(nameAndPosition[1]);
                var  replaceables    = new Dictionary <string, string>
                {
                    { "@Name", nameAndPosition[0] },
                    { "@Position", $"{position}{PositionPostfixProvider.Get(position)}" }
                };
                var printOutputPath = $".\\{position}. {nameAndPosition[0]}.pdf";
                pdfPrinter.Print(printOutputPath, printingRulesFilePath, replaceables);
            }
        }
Example #7
0
        private static void PrintPDFWindows(string printerName, Stream fs)
        {
            Globals.Log($"PRINTING windows v2! {printerName} and ");
            try
            {
                Globals.Log($"PDF2: Loading file: MEMORY BUFFER");
                Globals.Log($"PDF2: Printing to: {printerName}");


                var printer = new PdfPrinter(printerName);
                printer.PageSettings.Color = false;
                printer.Print(fs);
                //printer.Print("C:/Temp/0000000208.pdf");


                Globals.Log($"PDF2: Done!");
            }
            catch (Exception e)
            {
                Globals.Log($"PDFError: {e.Message}");
            }
        }