How to print a PDF with C#

前端 未结 11 580
抹茶落季
抹茶落季 2020-12-14 17:58

I´ve trying to solve this problem for nearly 2 days. There are a lot of more or fewer good solutions on the net, but not a single one fits my task perfectly.

11条回答
  •  天命终不由人
    2020-12-14 18:49

    If you're interested in commercial solutions which do exactly what you require then there are quite a few options. My company provides one of those options in a developer toolkit called Debenu Quick PDF Library.

    Here is a code sample (key functions are PrintOptions and PrintDocument):

    /* Print a document  */
    
    // Load a local sample file from the input folder
    
    DPL.LoadFromFile("Test.pdf", "");
    
    // Configure print options
    
    iPrintOptions = DPL.PrintOptions(0, 0, "Printing Sample")
    
    // Print the current document to the default 
    // printing using the options as configured above.
    // You can also specify the specific printer.
    
    DPL.PrintDocument(DPL.GetDefaultPrinterName(), 1, 1, iPrintOptions);
    

提交回复
热议问题