Printing a file to a network printer?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 10 October 2009   #1
Printing a file to a network printer?

Any one have any pointers on this?

DosCommand?
__________________
Paul Neale
http://paulneale.com
 
Old 10 October 2009   #2
Have you seen this?

http://msdn.microsoft.com/en-us/lib...ntdocument.aspx

Then in the submit button you can have something like this:

printdocument.PrinterSettings.PrinterName = "\\Sharename\printer"

Dunno, never did that before. Cheers.
__________________
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
http://www.ycdivfx.com
 
Old 10 October 2009   #3
I'll have a poke. Would be nice if it was simpler.
__________________
Paul Neale
http://paulneale.com
 
Old 10 October 2009   #4
Any one please, The dotNet solution will work if I can sort out how to send it a file to print. Right now I can print blank pages only.
__________________
Paul Neale
http://paulneale.com
 
Old 10 October 2009   #5
Are you using the example above? Are you creating the streamreader? Adding printPage event handler?
__________________
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
http://www.ycdivfx.com
 
Old 10 October 2009   #6
I don't want a UI at all. Just want to be able to print a pile of documents.
__________________
Paul Neale
http://paulneale.com
 
Old 10 October 2009   #7
not sure how to create the streamreader
__________________
Paul Neale
http://paulneale.com
 
Old 10 October 2009   #8
streamReader is created but I don't know what to do with it.
__________________
Paul Neale
http://paulneale.com
 
Old 10 October 2009   #9
Just a sec, I've created a custom class, I'm just writing an example in Max :P

Edit:

Done.

(
	dotnet.loadAssembly @"C:\KClasses.dll"
	
	local NPrinter= dotnetobject "KClasses.dnNetworkPrintFile"
	NPrinter.printit @"c:\test.txt" @"\\printer\sharename"
)


The printer name is optional, so if you omit it it will print on the default printer of the system.

Cheers.
Attached Files
File Type: zip KClasses.zip (9.2 KB, 5 views)
__________________
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
http://www.ycdivfx.com

Last edited by Kameleon : 10 October 2009 at 05:19 PM.
 
Old 10 October 2009   #10
I don't think you can just send any document directly. You'll have to be able to read the document first. So if it's text, you can use Graphics.DrawString in the PrintPageEventArgs, and if it's an image Graphics.DrawImage.

Also, I found a small overview in: http://msdn.microsoft.com/en-us/magazine/cc188767.aspx
__________________
MatManager - take control of your materials
Teacup - online material sharing inside 3D Studio
 
Old 10 October 2009   #11
Artur, your the man, saved my a$$.

Would love to know how to get it to work without the custom DLL as well though.
__________________
Paul Neale
http://paulneale.com
 
Old 10 October 2009   #12
No problem, it's a pleasure!

I'll work on a maxscript version when I get home Either way, if you want I can compile a custom dll with just that class, memory wise

Cheers.
__________________
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
http://www.ycdivfx.com
 
Old 10 October 2009   #13
I always prefer to use stright up Max script versions when ever possible as I need to ensure that it will work for clients. If I can't fix it my self it can become a problem. For the issue that I had at hand this worked great and got me over the hump. I kept trying doing it the other way but not sure what it is I'm missing.
__________________
Paul Neale
http://paulneale.com
 
Old 10 October 2009   #14
Originally Posted by PEN: Any one have any pointers on this?

DosCommand?


DOS:

copy "filename.ext" "\\computername\printername"

if your file is binary
copy /b "filename.ext" "\\computername\printername"

from max (sample):
HiddenDOSCommand "copy \"c:\\tmp\\log.txt\" \"\\\\project\\printer\""

it works for me...

Last edited by denisT : 10 October 2009 at 08:21 PM.
 
Old 10 October 2009   #15
Hmm, that isn't working to the network printer. Thanks, I'll poke more at it.
__________________
Paul Neale
http://paulneale.com
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:10 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.