Search code examples
c#pdfprintdialog

how to print a PDF document In Printdialog Control using c# winforms


I use this code to print pdf to default printer.

 public static void PrintPDFByProcess()
    {
        try
        {
            using (Process p = new Process())
            {
                p.StartInfo = new ProcessStartInfo()
                {
                    CreateNoWindow = true,
                    Verb = "print",
                    FileName = fileName
                };

                p.Start();

                p.Dispose();
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }


    }

Now i want to print by showing Print Dialog Control Like This :

enter image description here


Solution

  • There is an existing C# DLL Library called iTextsharp that you can use to create a custom PDF docs and can easily print to printer or save to file.

    Here is the URL to check out.

    https://forums.asp.net/t/1954208.aspx?PRINT+WITH+PDF+USING+iTextsharp https://www.codeproject.com/Articles/686994/Create-Read-Advance-PDF-Report-using-iTextSharp-in

    Good luck.