Direct Print PDF C#

Asked

Viewed 153 times

1

Hi, I need some solution to print directly to the printer a pdf, without opening dialog boxes and without using adobe, the pdf was generated with the pdfsharp library, I can even use libraries but it needs to be free. I tried using Rawprinterhelper, but only prints the bytes of the pdf. I tried to: dll.ShellExecuteA(0, "print", filePath, null, null, 0); [DllImport("shell32.dll", EntryPoint = "ShellExecute")] public static extern int ShellExecuteA(int hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd); but it didn’t work, I also tried to use File.Copy by passing the file and printer name and it didn’t work, someone can give me a different solution, or if I’m doing something wrong in one of those I tried to help myself. I’m using the WINDOWS10

  • You need to render the PDF pages into images and print the images, have a lot of libraries that do that, but most get paid. Research...

  • you can use Sumatra PDF, and pass by command line: https://www.sumatrapdfreader.org/docs/Command-line-arguments.html or use Spire https://github.com/eiceblue/Spire.PDF-for-.NET

  • thanks for your help, I will research and try your suggestions

  • Thanks for the suggestions, I used Sumatra and it worked very well

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.