Printing pdfs including AcroJS in C# - c#

I searched houres about, how I can print a pdf silently from C# including AcroJs.
I know there are solutions for it, like starting AdobeReader as Process by CommandLine and Print the document. (http://www.codeproject.com/Tips/598424/How-to-Silently-Print-PDFs-using-Adobe-Reader-and)
But this solutions always open the Reader. Even if you can hide the window,depending on the speed of your computer, you can see the adobe reader window a few seconds. I need a workaround which doesn't open the reader but process the AcroJS forms in pdf jut like the normal reader.
Do you konw any alternatives oder libs, that I can use?
How do I print PDFs silently with procesing AcroJS and wthout open the Adobe Reader process in c#?
Thanks :)

Your application need to be built using the Adobe Reader OCX or some PDF library. Then, the application needs to be configured to use a default printer. It can then be issued commands to print documents without showing a window.

Related

Emulate a printer in pc

I have made an desktop application using C# to make ID card .And i am required to add functionality of printing an ID card .Basically i just make an image in a win form which will be eventually printed using.
But as i have no printer,i can't test my code to see if it prints something.
Is there any emulator or software that emulates a printer in windows,so that i cant test my application?
This is a sample what i need to print.It wiil be in a win form.
And another thing. How can i maintain size of the id card while printing. Say id card size should be in 2inch * 3.5inch. How can i make sure it will print same size?
You can use the Microsoft XPS printer driver that ships with Windows (since Vista, but available for Windows XP)
The XPS Document Writer allows you to create .xps files using any
program that you can print from in Windows. Print to the XPS Document
Writer when you want to create, send, and share or publish documents
that you do not want other people to modify, or when you want to print
a document or display it online exactly as it appears on your screen.
It's also a good idea to create an XPS document for files that contain
graphics or illustrations that might otherwise display differently in
print than online or on computers with different monitors.
Once you click OK, you're prompted for the file path to save it to.
Try print to PDF file to check that Your application works. For example You can use "PDF Creator" under Windows OS's. It is the easiest way.

Print to File Programmatically using Adobe Acrobat

In the advanced print settings inside adobe acrobat reader, I have noticed that there is a print to file option. I am currently developing a library of functions in vb.net that prints files of various formats to print language files (postscript). I can't seem to find however a way to access this functionality programmatically, is there a way to do this without using a third party tool as I need to try and avoid using external libraries if at all possible.
You can use the PrintDocument class to print to a PostScript printer on the FILE: port. PostScript print drivers are provided with Windows by default. An example is HP LaserJet 2800 PS, which is provided with Server 2008. Generally if it has PS in the name the printer will be able to print to file.
https://learn.microsoft.com/en-us/dotnet/api/system.drawing.printing.printersettings.printtofile
...
printDocument1.PrinterSettings.PrintToFile = true
printDocument1.PrinterSettings.PrintFileName = "c:\temp\test.ps"
printDocument1.Print()

How to open a PDF file by using Foxit/Adobe in full screen mode?

I need from my C# application open a PDF file by using Foxit Reader or Adobe Reader in full screen mode. Manually, I do it typing F11 in Foxit Reader and CTRL+L on Adobe Reader. This changes the current file view to "full screen" mode. But programmatically, I have no idea how to do this! Thanks in advance.
as I'm opening the pdf file:
Process.Start(filename);
You can use SendKeys to send F11 or CTRL+L to the PDF application after you run it.
Alternatively, Foxit or Adobe may support commandline parameters to open in fullscreen mode. If you don't mind changing to SumatraPDF, I do know you can pass -presentation $file.pdf - opens a PDF file in presentation (full-screen) mode. See the manual for details.
Also, in addition to using the other solutions, you could open a Windows Form (or WPF Window) with a WebBrowser control and point it at the PDF file. The PDF file will open in the web browser control. Just set the Windows Form Properties to be Maximized with no border, and that should be the key to getting what you want without messing with Process.

printing a document programmatically

If I have adobe reader installed, is it possible to programmatically print the document to a specific printer without having adobe reader or the printer dialog display (no user intervention)? Any code snippets or sugestions are helpful. I can use any version of the .net framework to accomplish this
No, it is not. IIRC, you can tell acrobat reader to print the document for you via the command line. But when you do it's going to prompt you via the gui to tell it what printer to use.
Edit:
Hmm, maybe you can do it almost silently. Check this link:
http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm
Found via this old answer:
Send document to printer with C#
Used to do this back in the novell print queue days so it should at least work in theory. If you can figure out a way to convert the PDF into postscript you can then stream it to a postscript printer and print that way.

Printing a PDF from a Windows service

With C#, how can I print a PDF document (without any dialog boxes in the background) to an indicated printer?
I have used the following PDF library in the past to perform batch printing of PDF documents from a C# Windows Service.
http://www.quickpdflibrary.com/
It's a pretty decent library and if I remember correctly it only took a few lines of code to print the document. It worked very well and saved me a consider amount of time.
Also, the recommended link that discusses using DDE to launch a desktop application on a server to perform the printing is a bad idea. Adobe Reader probably doesn't support this and since it is a desktop application running in a windowless session you may run into problems with message boxes and dialog boxes. That solution just doesn't scale in my humble opinion.
here we go
Disclaimer: I work for Atalasoft
If you don't want to depend on Acrobat being on the server, you need to rasterize the PDF pages yourself and send them to the printer using the normal .NET printing API. We have a product that can rasterize PDF that uses the Foxit engine underneath. It deploys as a normal .NET assembly and doesn't require any other software to be installed.

Categories