Search code examples
c#printingmicrosoft-dynamicspdfsharpdynamics-nav

PDF file printing with MS Dynamics NAV 2017 using PDFSharp library not working


I use the following code in NAV 2017:

Printer := Printer.PdfFilePrinter('C:\IBTS\test_folder\pdf-sample.pdf');
Printer.DefaultPrinterName := 'HP LaserJet Pro MFP M521 PCL 6';
Printer.AdobeReaderPath('C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe');
Printer.Print();

However, this only opens Adobe Reader and then nothing happens. How do I make it work, i.e. print the document?


Solution

  • Printer name was incorrect. I'll leave this thread, because it may be useful for other people having the same problem or just wondering how pdf printing works with this library.