Emulate a printer in pc - c#

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.

Related

Print PDF file Silently

What I Want : A folder where every time thousands of PDF comes. I want to print that file using C#.
What will be the best option for me
Create a service
Create a windows application
I want that my service or windows application print the file silently means no popup to select the user to select the printer default it will print every page only once and I want to make this application, which will not be dependent on AcroRd32.exe because several users are not using Acrobat reader on their system.
I have already look these posts:
print pdf silently in c#,
Send multiple pdf files from one folder to printer. ASPOSE.PDF. C#
How can I complete this?

Printing pdfs including AcroJS in 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.

printer driver type application

I am working on a application which requires me to create a printer type driver, which offers to decrease the quality of document, and then prints the document.
Where document can be anything like image, word, pdf. And this application should be listed as new printer in the documents printers menu.
What I was thinking to create an application that will be installed as printer driver, and when this printer is selected for print then this application consider print documents as image and decrease the image quality based on user input. then these can be copied into new pdf and then print this newly created pdf silently using default printer drivers.
Can anyone tell me if I am thinking on the right track, and if I am thinking on right then please help me out in this, as I have no idea how to do this stuff.
I am using C# and .NET for creating this application.
thanks in advance
It's a good approach but it's not possible to create a printer driver in C# and .NET. You will need the Windows Driver Kit and C/C++.

Create an XPS DC in C# with a given filename to be delivered to a printing function

I am building a C# application that uses a DLL for print.
The print function receives a printer device context (or 0 for default).
If the Microsoft XPS Document Writer is the default printer, running the print function
with 0, results in a pop-up that ask the user to enter a path and filename.
I wish to give the filename myself (no popup).
I've surfed the net and came up with some information regarding printing XPS without user intervention (fyuan blog posts) but most of it revolved around adding a new printer or using WPF.
I am looking for info on how to create a DC that works with the "Microsoft XPS Document Writer"
but also to have a DOCINFO (lpszOutput) with the filename already given.
Any help would be appreciated.
You will delete filters in pipeline xml and also related dll's in inf file. But yet, as I did, i guess you will face problem of printing canvas (graphics). I wasn't able to convert / transform this canvas to glyphs to get the contents of it.
If you had further issues, let me know
Kind Regards

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