473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Print PDF document from C#

Hi All,

My requirement is to be able to print a pdf document without
the printer dialog being invoked. This I have achieved by using the
shell and passing the verb = "Print". But a part of the requirement is
also that before the document is sent for printing, the network printer
will have to be configured by C# code. The printer settings will have to
be modified in terms of page size, orientaion, default tray selection,
so on. Can anyone give me any idea on how to achieve this using C# code.

Thanks.


*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
2 2855
Soumya,

You might want to get a third party PDF control for this. When you send
the command verb Print, the os sends that to the program registered to
handle the command (most likely adobe). I don't know what other command
verbs they accept, or if they have an automation interface, but it is
unlikely that it would be that simple to set the print parameters.

I would check to see if Acrobat has an interface you can use (through
API calls or COM), or use a third party component.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Soumya Kar" <so****@rebaca.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
Hi All,

My requirement is to be able to print a pdf document without
the printer dialog being invoked. This I have achieved by using the
shell and passing the verb = "Print". But a part of the requirement is
also that before the document is sent for printing, the network printer
will have to be configured by C# code. The printer settings will have to
be modified in terms of page size, orientaion, default tray selection,
so on. Can anyone give me any idea on how to achieve this using C# code.

Thanks.


*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #2
See "Setting Windows default printer" from in articles of March 2005 at
http://pages.videotron.com/emoreau/

It should gives you some starting points.
--
HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
(http://aspnet2.com/mvp.ashx?EricMoreau)
Conseiller Principal / Senior Consultant
Concept S2i inc. (www.s2i.com)
http://pages.videotron.com/emoreau/

"Soumya Kar" <so****@rebaca.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
Hi All,

My requirement is to be able to print a pdf document without
the printer dialog being invoked. This I have achieved by using the
shell and passing the verb = "Print". But a part of the requirement is
also that before the document is sent for printing, the network printer
will have to be configured by C# code. The printer settings will have to
be modified in terms of page size, orientaion, default tray selection,
so on. Can anyone give me any idea on how to achieve this using C# code.

Thanks.


*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: dan | last post by:
This works in mozilla but I can't figure out why this won't work in IE. Say I have this html <html> header goes here header goes here
4
by: Julie Siebel | last post by:
Apologies...I'm sure this has been asked before, but I can't seem to come up with the correct Google search terms. While my problem is with stylesheets, the errors are being caused by my...
3
by: Craig | last post by:
First of all, this one is driving me crazy, so thanks in advance for any help!! I've got a javascript function in a parent document that generates an HTML document on the fly when a button is...
21
by: Steel | last post by:
Hi at all, I have a very long html page with many photo. Therefore the best to print this page is to print the some page as PDF. Therefore I maked a PDF file like my page to print best. I'ld want...
2
by: Asad | last post by:
I have a main window that creates a new window called printWin (which contains the printable format of the page). From the main window I embed a javascript in the printWin window that calls the...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
10
by: jon | last post by:
I'm trying to use a hidden iframe to print the contents of one div seamlessly. Currently I can create the hidden iframe, copy the contents of the div to the iframe, and print it. I even have a...
2
by: Brad Pears | last post by:
I have some sample code that uses the print dialog, print preview and a print direct options. If I select print preview and then click the printer icon from that, the document prints. If I...
10
by: S_K | last post by:
Hi, I have a directory full of a number of .PDF files that I need to print. Is there any simple way to do this? Using PdfReader purhaps? Thanks in advance. Steve
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.