Sign in to follow this  
Followers 0
Biatu

Printing to file?

5 posts in this topic

Is there a way to print to a file without using rundll PrintUI, etc...?

My current attempt is to use the _addPrinter from jguinch's UDF to add a printer with a file as the port name, (which

works under windows, but the func is broken for autoit atm) then set default, lastly print an html file using IE funcs

so i can get the PCL file.


What is what? What is what.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

As I said you in the >Printer UDF topic, your syntax was not correct

Now, if you want to print into a file without being prompted for the file name, you can create your own local port (as a file) and use it with your printer when you install it.

I just edit my UDF to add _AddLocalPrinterPort and _RemoveLocalPrinterPort, which will allow you to create a local "file" port :

#Include "printers.au3"

Local $sPrinterName = "My Dell 2335dn Printer"
Local $sDriverName = "Dell 2335dn MFP"
Local $sOutput = @TempDir & "\output.pcl"


_AddPrinterDriver($sDriverName, "Windows x64", @ScriptDir & "\Printer\PCL\WINXP_VISTA_64\", @ScriptDir & "\Printer\PCL\WINXP_VISTA_64\sdf1m.INF")
_AddLocalPrinterPort($sOutput)

_AddPrinter($sPrinterName, $sDriverName, $sOutput)

; ... here you call you IE page for printing
Edited by jguinch
1 person likes this

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks jguinch, a this helps alot :)

I understand my syntax was wrong, and didnt know I had to make a port. I had come across that concept in various other languages during research from other sources, but creating a local port was not an option with ur udf atm. The reason I needed to print to PCL was so that I could send that raw to port 9100 over network. But your example in the previous thread voided this one out.

My script is designed to ping an IP on an isolated LAN for a printer. When printer echos, I run a func to grab printer.xml from port 5200 to get model number. Afterwards, depending on the model number i have a switch for different network interface formats, for example 5330, 2335, and 2355 all have a similar layout. I remove all @CRLF and @TAB then StringBetween where I can get the firmware version.

Then use IE automation to print the Network Configuration Page, but the current version of the script shows a print dialog which can be confusing when you have 30 printers in the list all saying 2335, or 5330 mono, etc. So I needed to print silently-directly to the IP that we ping before.
I tried working with TCPIPport func of urs and...i failed, so i looked for alt...eventually running into PCL. 

The firmware update is in PCL format too so if I could find a way to directly send the printer that firmware I shouldn't have a problem.

Edited by Biatu

What is what? What is what.

Share this post


Link to post
Share on other sites

but the current version of the script shows a print dialog

How do you call the print action ?

If you are using the IE.au3 UDF, you can use _IEAction ($oIE, "printdefault") (with the good default printer defined of course)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

How do you call the print action ?

If you are using the IE.au3 UDF, you can use _IEAction ($oIE, "printdefault") (with the good default printer defined of course)

 

That's all fine, i have all the resources i need to complete the script. Thank you

I believe "printdefault" is in the help file, or i seen it before elsewhere.

Edited by Biatu

What is what? What is what.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0