Jump to content

printing using UDF and a dll


martin
 Share

Recommended Posts

Hi, Martin !

I had problem with your link ("martin's downloader").

I had:

_ Erreur sur la page (error on the page)

_ And, when I want details: Accès refusé (access denied)

Then I can download the file, with copy & paste the URL from the (red) button, in the adress field.

It is OK for me. But simplist users can prefer a classic URL (Everybody does not drive to the left...)

@-salutations

--

Michel Claveau

Link to comment
Share on other sites

Hi, Martin !

I had problem with your link ("martin's downloader").

I had:

_ Erreur sur la page (error on the page)

_ And, when I want details: Accès refusé (access denied)

Then I can download the file, with copy & paste the URL from the (red) button, in the adress field.

It is OK for me. But simplist users can prefer a classic URL (Everybody does not drive to the left...)

@-salutations

--

Michel Claveau

Hi Michel,

I have tried it a couple of times and when I click the red button it just asks if I want to save the file and I don't get the problem you desribed.

I use the same program for various files and the serial coms udf for example has had several hundred downloads since I started using this way of providing files. I also get a lot a lot fewer people complaining that they can't get my files. (In fact you are the first person to report a problem, though of course others could have not told me.) Anyway, as I can't see what the problem or reproduce it I have done nothing about it.

I only tried using Firefox. What browser did you use? (Tous le monde ne tent pas le droit..)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 4 weeks later...

Hi, I use your udf. Great! I'm using it to print bulletin of Lotto and Superenalotto (lottery in Italy). Normally my printer use Economode (to save ink). Can I disable this Economode while I print with your udf?

I would cahange some settings of the printer before printing and then set like before.

I noticed if I use

_PrintSetPrinter($hp)
I can change temporary settings (as I want), but I prefer make these changes in background.

Maybe I ask a lot.

A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]
Link to comment
Share on other sites

Another question.

How can I abort a printing before print?

If I see that the page is too big, I want restart the printing more little.

I tried

_PrintEndPrint($hp)
        _printAbort($hp)
        _PrintStartPrint($hp)

but print 2 pages.

A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]
Link to comment
Share on other sites

Another question.

How can I abort a printing before print?

If I see that the page is too big, I want restart the printing more little.

I tried

_PrintEndPrint($hp)
        _printAbort($hp)
        _PrintStartPrint($hp)

but print 2 pages.

I found, this is the code

_printAbort($hp)
        _PrintEndPrint($hp)
        _PrintStartPrint($hp)
A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]
Link to comment
Share on other sites

  • 2 weeks later...

I don't see how that will help anyone wanting to wrap text so that it fits into a given width.

It will help in the way that the string is chopped up into pieces that fit to an A4 page (83 letters). Then the idea is to print the text and move printcoordinates down one line for the next piece of string.

-> Repeat.

you can feed any string into this and it will come out as 83 letters long strings until nothing remains in the main string.

Link to comment
Share on other sites

It will help in the way that the string is chopped up into pieces that fit to an A4 page (83 letters). Then the idea is to print the text and move printcoordinates down one line for the next piece of string.

-> Repeat.

you can feed any string into this and it will come out as 83 letters long strings until nothing remains in the main string.

83 characters do not give a width. You have to use the supplied functions to find the width of text. 83 spaces do not give the same width as 83 'H' characters unless you are using a fixed space font, and it depends on the font size and style. To be useful the minimum requirement for the function is that it should fit text into a given width and height, using a certain font, size and style, and return the number of words actually fitted.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 1 month later...

Hi Martin,

Thx for the great udf.

I did a `hello world` & it works great!

I am novice at programming, need some help please.

I am planning to make a Check Printing script.

Check paper size = 8 inch width x 3.3 inch height.

Printing in landscape mode.

I want my users to be independent of the Printer Preferences (which is typically set to A4 size, Portrait mode) .

I have read all 8 pages of this thread and I could not gather much.

Can you please help me with the basic script which will help me print in landscape mode on a check of size 8 inch width x 3.3 inch height without modifying the standard printer preferences (which are set to a typical A4 size sheet in Portrait mode).

Thx for your help!

Best regards,

Vai

Link to comment
Share on other sites

Hi Martin,

Thx for the great udf.

I did a `hello world` & it works great!

I am novice at programming, need some help please.

I am planning to make a Check Printing script.

Check paper size = 8 inch width x 3.3 inch height.

Printing in landscape mode.

I want my users to be independent of the Printer Preferences (which is typically set to A4 size, Portrait mode) .

I have read all 8 pages of this thread and I could not gather much.

Can you please help me with the basic script which will help me print in landscape mode on a check of size 8 inch width x 3.3 inch height without modifying the standard printer preferences (which are set to a typical A4 size sheet in Portrait mode).

Thx for your help!

Best regards,

Vai

Setting the orientation is simple, you use the _PrintPageOrientation function.

To set the paper size programmatically I think I need to add a new function. 8 inch x 3.3 inch seems like a strange size, are you sure that's correct? 8 x 3 3/8 sounds more likely to me. (8 x 3.375)

You could simply leave the printer set at A4, put the paper in you want to use, and offset the position of everything down from the top by (297 - 8*25.4)/2 = 46.9, set landscape and I would think it would work

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Hi, I use your udf. Great! I'm using it to print bulletin of Lotto and Superenalotto (lottery in Italy). Normally my printer use Economode (to save ink). Can I disable this Economode while I print with your udf?

I would cahange some settings of the printer before printing and then set like before.

I noticed if I use

_PrintSetPrinter($hp)
I can change temporary settings (as I want), but I prefer make these changes in background.

Maybe I ask a lot.

Sorry Fabry, I missed that post.

I have no idea how to set the Economode I'm afraid. I would probably have to get special capabilities from the DevMode structure to start with but I regret that I'm not going to try.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Setting the orientation is simple, you use the _PrintPageOrientation function.

To set the paper size programmatically I think I need to add a new function. 8 inch x 3.3 inch seems like a strange size, are you sure that's correct? 8 x 3 3/8 sounds more likely to me. (8 x 3.375)

You could simply leave the printer set at A4, put the paper in you want to use, and offset the position of everything down from the top by (297 - 8*25.4)/2 = 46.9, set landscape and I would think it would work

Hi,

As per your calculations, it worked, but a bit off:

My code is

#include 'printMGv2.au3'
Global $hp
Local $mmssgg,$marginx,$marginy

$Payto = "My Company Inc"

$hp = _PrintDllStart($mmssgg)   ;this must always be called first
$newselect = _PrintSetPrinter($hp)

_PrintPageOrientation($hp,0)    ;landscape
_PrintStartPrint($hp)
_PrintSetFont($hp,'Verdana',18,0)
_PrintText($hp,$Payto,10, 46.9)

_PrintEndPrint($hp)
_PrintDllClose($hp)             ;this must always be called last

The text "My Company Inc" was printed 12mm from top & 14mm from left.

I could not figure out why 12mm from top and 14mm from left ?

I guess it should have printed 10mm from left. Do I understand this correct ?

Please suggest.

Thx

Vai

Link to comment
Share on other sites

Hi,

As per your calculations, it worked, but a bit off:

My code is

#include 'printMGv2.au3'
Global $hp
Local $mmssgg,$marginx,$marginy

$Payto = "My Company Inc"

$hp = _PrintDllStart($mmssgg)   ;this must always be called first
$newselect = _PrintSetPrinter($hp)

_PrintPageOrientation($hp,0)    ;landscape
_PrintStartPrint($hp)
_PrintSetFont($hp,'Verdana',18,0)
_PrintText($hp,$Payto,10, 46.9)

_PrintEndPrint($hp)
_PrintDllClose($hp)             ;this must always be called last

The text "My Company Inc" was printed 12mm from top & 14mm from left.

I could not figure out why 12mm from top and 14mm from left ?

I guess it should have printed 10mm from left. Do I understand this correct ?

Please suggest.

Thx

Vai

The dimensions are all in 0.1 mm, so you need to multiply the values you used by 10.

The offset is from the position you would have printed on A4. You need to take into account the X and Y offset for the printer when dealing with the paper size. If you print at 0,0 then it will appear on the page at

_PrintGetXOffset($hp), _PrintGetYOffset($hp);these can be zero for some printer, values are in 0.1mm units

It looks like your offsets are approximately 130 and 73 (13mm from left and 7.3mm from top in landscape) and you migh not be able to print as near to the edge of the check as you would like. Maybe you could turn the check round, print in portrait and work out some new offsets, but you will need to try to see if your printer can cope with that.

$xpos = 100

$ypos = 469

_PrintText($hp,$Payto,$xpos - _PrintGetXOffset($hp), $ypos - _PrintGetYOffset($hp))

If your offset is larger than the position you specify then some text will be missing!

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 4 weeks later...

Martin,

Is there a way to print muliptle copies via the dll?

Thanks,

Bob

That's something that hasn't been considered so far. Of course you could always loop for each page or each document.

I could deal with it by having a new function or just add an extra parameter in the _PrintStartPrint function.

_PrintStartPrint($hDll,$PrintCopies = 1)

Is that the sort of thing you mean?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

That's something that hasn't been considered so far. Of course you could always loop for each page or each document.

I could deal with it by having a new function or just add an extra parameter in the _PrintStartPrint function.

_PrintStartPrint($hDll,$PrintCopies = 1)

Is that the sort of thing you mean?

Yes, that is what I mean. I would rather have it as an option in the _PrintStartPrint, but either way would be fine. Looping has its own set of issues and would get it to work, but in my mind is unnecessarily complex. If there was a way to have the udf change the number of pages it would be great.

Thanks,

Bob

Edited by YellowLab

You can't see a rainbow without first experiencing the rain.

Link to comment
Share on other sites

Yes, that is what I mean. I would rather have it as an option in the _PrintStartPrint, but either way would be fine. Looping has its own set of issues and would get it to work, but in my mind is unnecessarily complex. If there was a way to have the udf change the number of pages it would be great.

Thanks,

Bob

OK. New version made with a parameter for copies in the _PrintStartPrint function. See download link in first post.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 2 weeks later...

Hi Martin,

Nice UDF!

I'd like to use it for dumping RAW files to my printer.

I have PCL files printed to a file by a program, I'd like to forward them to my default printer without any change.

I thought I could use the _PrintBytesDirect function. But I do not fully understand the usage.

What does the variable $sPrinter mean?

There is somekind of debug message, can I disable that?

If i make an array with three bytes, it only prints the first one (the debug message says there are 3 bytes sent).

Thank you for your help.

Ooris

Link to comment
Share on other sites

Hi Martin,

Nice UDF!

I'd like to use it for dumping RAW files to my printer.

I have PCL files printed to a file by a program, I'd like to forward them to my default printer without any change.

I thought I could use the _PrintBytesDirect function. But I do not fully understand the usage.

What does the variable $sPrinter mean?

There is somekind of debug message, can I disable that?

If i make an array with three bytes, it only prints the first one (the debug message says there are 3 bytes sent).

Thank you for your help.

Ooris

It sounds like I've left some junk in the dll.

I would think that to print raw files it would be easier to use a liitle bit of AutoIt, although I could add something to my udf but it doesn't sound very useful.

To print the raw files you can use something like

Run('Copy "' & $fullpathtorawfile & '" /B \\Computername\PrinterShareName')

Note that you must use the Pinter share name and you must get the share name from the PC that the printer is connected to.

If the printer is on the local PC then 127.0.0.1 can be used instead of the Computername.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...