Jump to content

printing using UDF and a dll


Recommended Posts

  • Replies 261
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

This is a printing UDF which allows you to print text in any font, size and colour at any position on the page, draw lines, curves, elipses, pies in any colour, and print images. Useful for labels, re

Just want to update from a user's side: This dll & udf is still working in 2017 using Win 10 current releases and it still seems to me the best option for complex printing tasks handled by Au

Do you think any one will guess which link you mean ❓ Please use this feature:  

Posted Images

This is a simple example of printing using my print UDF which uses a dll. It is not intended to do the sorts of thing you can do with the Word UDF by big daddy, but it allows you to print text in any font, size and colour and to draw straight lines in any colour. Useful for labels, reports and so on.

#include 'printMGv2.au3'
Global $hp
Local $mmssgg,$marginx,$marginy
$hp = _PrintDllStart($mmssgg);this must always be called first
if $hp = 0 then consolewrite("Error from dllstart = " & $mmssgg & @CRLF)
ConsoleWrite('dll version is' & _PrintVersion($hp,1) & @CRLF)

_PrintSetPrinter($hp);choose the printer if you don't want the default printer
_PrintStartPrint($hp)
$title = 'Printing with a dll'
$twid = _PrintGetTextWidth($hp,$title)
$tht = _PrintGetTextHeight($hp,$title)
_PrintSetLineWid($hp,10)
_PrintSetLineCol($hp,0x00ff00)
$pw = _PrintGetPageWidth($hp)
$tx = Int(($pw - $twid) /2)
$ty = 100
_PrintText($hp,$title,$tx,$ty)
;Draw a box around the text
_PrintLine($hp,$tx-50,$ty-50,$tx + $twid + 50,$ty - 50)
_PrintLine($hp,$tx + $twid + 50,$ty - 50,$tx + $twid + 50,$ty + $tht + 50)
_PrintLine($hp,$tx - 50,$ty + $tht + 50,$tx-50,$ty-50)
_PrintSetLineCol($hp,0x0000ff)
_PrintLine($hp,$tx + $twid + 50,$ty + $tht + 50,$tx - 50,$ty + $tht + 50)

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

Functions available are -

_PrintDllStart

_PrintDllClose

_PrintSetPrinter

_PrintGetPageWidth

_PrintGetPageHeight

_PrintGetHorRes

_PrintGetVertRes

_PrintStartPrint

_PrintSetFont

_PrintNewPage

_PrintEndPrint

_PrintText

_PrintGetextWidth

_PrintGetTextHeight

_PrintLine

_PrintGetXOffset

_PrintGetYOffset

_PrintSetLineCol

_PrintSetLIneWid

The link below is for a compressed link. If you download it, extract the link then double click on it and it will get the zip containing the UDF and the dll.

The whole thing is a bit underdeveloped.

If there is any interest then I will put some effort into it.

(Yes, I know it would be better if I didn't use a dll.)

Great job! :)
Link to post
Share on other sites

Great job! :)

Thanks Gif, I hope it works for people.

First post is updated with additions.

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 post
Share on other sites

Hi!

Run OK on a french-XP.

Thanks.

:)

Naturelment!

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 post
Share on other sites

What is the statut (licensing...) of the DLL?

Can I use with freedom?

The dll is for you to use as you want. If it causes any problems at all then I will try to fix it but I do not take any responsibility for any problems and I make no guarantees about its capabilities or fitness for purpose.

I want said than I had try with accent & euro caracter, with success.

I don't had try with "Arial Unicode" & very specials unicodes caracters.

I haven't tried any special Unicode examples either.

Edited by martin
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 post
Share on other sites

OK. I want sell it 1,000,000,000,000$ (or more).

Thanks. :P

Oooh, it's worth much more than that!

For info, I had try to call the DLL with (from) Python (+ctypes).

And it's run perfectly. :)

I wrote it because I thought it would be useful for AutoIters, but it can be used with anything. Nice to know it worked with Python.

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 post
Share on other sites

Re

I don't find anyway for PageSet (type / size).

Lapse of memory?

Too much difficult?

Am I blind?

You should be able to set the page if you use _PrintSetPrinter. Next to the combobox to choose a printer there should be a Properties button. This will access the printer properties and you should be able to set the page size.

If this doesn't work let me know.

Edit: spelling

Edited by martin
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 post
Share on other sites

I found a little error.

in printMGv2.au3, for _PrintRectangle, you write "Ellipse" in lieu of "Rectangle" (in DLL.call)

(the word rectangle is good in the DLL)

Thanks :) Now fixed. Mod uploaded.

Edited by martin
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 post
Share on other sites

:)

A bug!

_PrintPageOrientation(.. break AutoIt (with Python : "exception code 0xeedfade")

Yes it is a sort of bug. The page orientation should only be set before _PrintStartPrint or after _PrintEndPrint, so did you try changing the orientation after a _PrintStartPrint?

I will make it so that if _PrintStartPrint is active then _PrintPageOrientation returns an error.

Edited by martin
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 post
Share on other sites
  • 4 weeks later...

This is the most useful UDF I have ever had

I'll use it to fill pre-printed forms in my company.

Thanks for sharing

regards

Oh, thanks, it's always nice to know it's been useful. :)

(When I see a reply in my threads I expect to find there has been a problem! Better not speak too soon though.)

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 post
Share on other sites
  • 4 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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...