Programmatically select a printer in PrintDialog - c#

I have a Web Browser control in Windows forms. It loads a HTML file. I want to be able to give an option to the user to Save this as PDF file.
If the user has "CutePDF Writer" installed then I thought I can just select it programmatically from Print Dialog and Save it as PDF. I am showing the PrintDialog using Web_browser_control.ShowPrintDialog(). Is there a way to select a printer(CutePDF Writer in my case) programmatically in this Print Dialog without user intervention?

You can do like, this,
printDocument.PrinterSettings.PrinterName = "YOUR_PRINTER";
Refer, https://andres.jaimes.net/65/how-to-choose-a-printer-using-c-sharp/

Not quite sure,but print dialog has printer settings related properties where you can define the default printer.
Here is somewhat similar question asked in SO, the only difference being it was asked for windows. Neverthless, PrintDialog works in a similar fashion in web too.

Related

Print PDF file without opening print dialog in asp.net

I want to print my PDF file without opening Print dialog in ASP.NET Web forms.
My requirement is I have some PDF files on my server and I want to print that file on button click but without opening the Print window.
How can I achieve this?
The best you can do is concatenate the PDF files into one file and then print it, showing the printer dialog once at the beginning of the process. .NET PDF libraries that have this functionality.
PdfDocument.Combine("Output.pdf", "doc1.pdf", "doc2.pdf", "doc3.pdf");
Please refer this documentation may help you Print without Dialog

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.

Save and Get network printer options

My goal is to send a PDF to a printer with specific sheet feeder, that is configured a first time by print option dialog (or just a form with network printer, tray, and margin).
I've seek about PrintDocument, PrintDialog (from System.Windows.Forms) and PrinterSettings
I can show network printer, save the selected network printer and I can use this with PrinterSettings.PrinterName but my issue is on tray's choice. I have no option to select this and customer that use my application can take every printer that exists.
So how I can show all the tray of printer selected, save it and use it to print ?
Does this link:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.pagesettings.papersource.aspx
contains useful information?

Fill up form in Word/Pdf

What I want to accomplish is a fill up form or a registration form for a hotel in word or pdf file. It's like after filling up name text box and clicking next another text box will appear.
And also it needs to have a preview before printing. If possible, showing the preview simultaneously.
I really want to know where to start or if there is any, sample would be great.
The way I would approach this problem is using Web form data and after confirmation from the user i would generate the report straight away. I dont think manipulating Word document or PDF document is the best approach :
Check User Input using your web form
Generate the Word or PDF document on your reporting server[Connect to it using WCF for instance]
Give the link of the generated document to the user. It would be up to the user to print it or only view it in their browser.

how to set pdf page settings to print properties dialog?

Hi all I want to know about how to set pdf page settings to print properties dialog box?
For Example,
If my PDF page settings is Landscape then Layout automatically shows Landscape not Portrait. and If my PDF page settings is Protrait then Layout automatically shows Portrait.
I have make R&D lot on this topic but not found any satisfied link. Please give me satisfied answer. this will be very helpful to me.
PDF is a device-independent format and doesn't not include functionality to set print dialog parameters. JDF was designed to compliment PDF and contain process specific settings; however, it's not supported outside of large print workflows.

Categories