Notifications
Clear all

[Closed] Printing a file to a network printer?

 PEN

Any one have any pointers on this?

DosCommand?

22 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

DOS:

copy “filename.ext” “[\computername\printername](file:///computernameprintername)”

if your file is binary
copy /b “filename.ext” “[\computername\printername](file://computername/printername)”

from max (sample):
HiddenDOSCommand “copy “c:\ mp\log.txt” “[\\project\printer]( http://forums.cgsociety.org/ )””

it works for me…

Have you seen this?

http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx

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

printdocument.PrinterSettings.PrinterName = “\Sharename\printer”

Dunno, never did that before. Cheers.

 PEN

I’ll have a poke. Would be nice if it was simpler.

 PEN

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.

Are you using the example above? Are you creating the streamreader? Adding printPage event handler?

 PEN

I don’t want a UI at all. Just want to be able to print a pile of documents.

 PEN

not sure how to create the streamreader

 PEN

streamReader is created but I don’t know what to do with it.

Just a sec, I’ve created a custom class, I’m just writing an example in Max

Edit:

Done.

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

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

Cheers.

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

Page 1 / 2