Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

How to print .PDF files in the background using C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
S_K - 22 Apr 2008 20:55 GMT
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
Mark Rae [MVP] - 22 Apr 2008 21:24 GMT
> 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?

As this is an ASP.NET newsgroup, are you trying to print these documents via
a web application i.e. through a web browser...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

S_K - 22 Apr 2008 21:52 GMT
> > I have a directory full of a number of .PDF files that I need to
> > print.
[quoted text clipped - 7 lines]
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net

I'm sorry. It's an ASP.NET web application.

Thanks
Mark Rae [MVP] - 22 Apr 2008 22:06 GMT
>>> I have a directory full of a number of .PDF files that I need to
>>> print. Is there any simple way to do this?
[quoted text clipped - 5 lines]
>
> I'm sorry. It's an ASP.NET web application.

You're not going to be able to persuade a web application to control a
printer automatically for security reasons - all modern web browsers are
designed specifically to prevent this...

Your best bet would be to make the PDF documents available as hyperlinks.
This would allow the user to display the documents individually and print
them as required...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

S_K - 23 Apr 2008 16:01 GMT
> >>> I have a directory full of a number of .PDF files that I need to
> >>> print. Is there any simple way to do this?
[quoted text clipped - 17 lines]
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net

I'm sorry, there are over 300 .PDF documents stored on a remote
server. Displaying them indivitually and printing them is completely
out of the question! Is there anyway to print them on the server (not
client-web browser) side?

Steve
Mark Rae [MVP] - 23 Apr 2008 20:14 GMT
> I'm sorry,

There's no need to apologise...

> there are over 300 .PDF documents stored on a remote server.
> Displaying them individually and printing them is completely
> out of the question! Is there anyway to print them on the server (not
> client-web browser) side?

Yes, but not natively as PDF support isn't built into the .NET Framework.
However, there are many 3rd-party add-ins which you can use:
http://www.google.co.uk/search?sourceid=navclient&hl=en-GB&ie=UTF-8&rlz=1T4GZEZ_
en-GBGB252GB252&q=%22C%23%22+PDF+print


Alternatively, if this is a one-off exercise and you have networked or even
direct access to the server in question, maybe bespoke software is not the
most cost-effective solution...? Have you considered maybe just getting a
temp in and printing the documents manually? 300 documents isn't that
many...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

S_K - 23 Apr 2008 21:27 GMT
> > I'm sorry,
>
[quoted text clipped - 17 lines]
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net

Thanks Mark for your solution. I'll imediately look into it.
I do have direct access to the server in question.

By the way, thats 300 documents per week! While it would help the
unemployement rate  to hire a temp to print the 300 documents, I would
rather just give my user a PRINT button that prints everything in the
server directory.

Thanks again. As always you have been very helpful!

Steve
Mark Rae [MVP] - 23 Apr 2008 22:39 GMT
> By the way, thats 300 documents per week! While it would help the
> unemployement rate  to hire a temp to print the 300 documents, I would
> rather just give my user a PRINT button that prints everything in the
> server directory.

OK. In that case, and since you have direct access to the server in
question, I would strongly suggest that ASP.NET is not the right platform
for this...

Instead, I would recommend a WinForms app so that the printing exercise does
not put unnecessary strain on the web application...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

George Ter-Saakov - 24 Apr 2008 14:16 GMT
It's going to be hard to print document from server to clients printer.
Although it's possible.
1st step: You need to register printer on a server. Google "print from
Windows service" to see how to do it.
2nd step: Adobe Arobat support "DDE automation" or simple command string. So
something like
AcroRd32.exe /t "C:\test.pdf" "\\servername\printername" "AdobePS Tektronix
Phaser 840" "123.45.678.910"
will work

Visit this link http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm

-----------------------------------------------------------------------------------

How about merging all 300 pdfs into 1 big PDF file? Then you can open up it
in browser and have user to click "Print" button only once.
Then you do not need to mess with the printers/adobe....
Look for ITextSharp - free C# library to work with PDF.

George.

On Apr 22, 3:06 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
> "S_K" <steve_kers...@yahoo.com> wrote in message
>
[quoted text clipped - 22 lines]
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net

I'm sorry, there are over 300 .PDF documents stored on a remote
server. Displaying them indivitually and printing them is completely
out of the question! Is there anyway to print them on the server (not
client-web browser) side?

Steve
net.anuj@gmail.com - 01 May 2008 07:55 GMT
> It's going to be hard to print document from server to clients printer.
> Although it's possible.
[quoted text clipped - 41 lines]
> > This would allow the user to display the documents individually and print
> > them as required...

Create a small thick client application (let's call it the print
manager) that gets installed on the dealers machine's. This can be a
simple executable that need not run as a service or even in the task
tray. Once all of the documents have been generated (as separate
documents on the server) and saved to the appropriate location on the
server (preferably in the database) a special document should be
downloaded to the client (called a manifest) that contains a list of
all the files (or file IDs) that need to be printed as well as their
print options. The manifest should have a unique extension that is
recognized and associated with the print manager such that when the
file is opened, the print manager automatically launches. The print
manager will download each document listed in the manifest and
automatically print it. Because the print manager runs as a thick
client, it can directly communicate with the printer, setting the
approprate page size, orientation and duplex settings. Alternatively,
the manifest file could contain only the list of documents and the
print options could be sent as meta-data along with the document.
Prefered method for communicating with the server
dpk.kataria@gmail.com - 19 May 2008 09:03 GMT
> Hi,
>
[quoted text clipped - 5 lines]
> Thanks in advance.
> Steve

Hi

I have a number of pdf files in a directory. i want to print all and
want a .ps file.

please suggest me.

How can i do this in C#?

Hoping to hear from your side.

thanks in advance

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.