![]() I've got this to work for my printer, but have only tried it for PDFs so I don't know how well it will work for other printers/file types. If you know your printer's IP address it might be possible to send the file directly to the printer using TcpClient. I did manage to silently print to a network printer by converting the PDF to a byte array and then sending it directly to the printer using TCP. It sounds like you need to send raw data straight to the printer! (sorry it's in C#) Using readerErr As StreamReader = lvbProcess.StandardErrorĭim resultErr As String = readerErr.ReadToEnd() Using reader As StreamReader = lvbProcess.StandardOutputĭim result As String = reader.ReadToEnd() ' Read in all the text from the process with the StreamReader. LvbProcess = Process.Start(lvbProcessInfo) LvbProcessInfo.RedirectStandardError = True ![]() LvbProcessInfo.WindowStyle = ProcessWindowStyle.Hidden LvbArguments = String.Format(" -P """" ", sPrinterName, fileName, sTray) Private Function UseLvbPrint(ByVal oPrinter As tb_Printer, fileName As String, portrait As Boolean, sTray As String) As String Try using lvbprint via command line and the following code:Ĭ:\temp\gsbatchprint64\gsbatchprintc.exe -P \server\printer-N A3 -O Port -F C:\temp\gsbatchprint64\Test*.pdf -I Tra圓 ' print a pdf with lvbrint In short: it's unlikely that you will be able to do what you're trying to do without adjusting your requirements and using a 3rd party library. My companies production Quick PDF Library has a PrintDocument feature which will print the PDF for you, but it's not free and it's an external COM. It looks like PDFBox has recently added a PrintPDF option which is unfortunately Java based, but there aren't actually a whole lot of free options in this area. ![]() So in order to accomplish this task you will need to use a 3rd party library to handle the rendering of the PDF to an image which can then be sent to the printer. You would have to write your own PDF rendering engine and that is thousands of hours of work. Is it technically possible to write code that prints a PDF to the printer without using any external COM/object? Yes, absolutely. So the same basic steps are required to view/print. The idea is that PDF is the electronic version of a printed piece of paper. The same goes if you just want to display the PDF on screen in your application. In order to a print a PDF it must be rendered as an image first. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |