Jump to content
martin

printing using UDF and a dll

Recommended Posts

Small addition to UDF and dll.

New function _PrinListPrinters returns a list of all the installed printers.

Link in first post updated.

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.

Share this post


Link to post
Share on other sites

Hey martin, I have been experimenting with your UDF and dll, it works great! I was wondering if you would post the sorce for your dll or if you could add the parameter for setting the angle of escapement of a font, and secondly a function for drawing round rectangles.

Share this post


Link to post
Share on other sites

Hey martin, I have been experimenting with your UDF and dll, it works great! I was wondering if you would post the sorce for your dll or if you could add the parameter for setting the angle of escapement of a font, and secondly a function for drawing round rectangles.

Glad you like it GRS.

I'm not going to publish the source for the dll.

The escapement is set in the last parameter of the function PrintText.

Rounded corners for rectangles is a good idea. I'll add that. I can change the _PrintRectangle to have 2 more parameters which default to zero like this

_PrintRectangle($hDll,$iTopx,$iTopy,$iBotx,$iBoty,$iCornerx=0,$iCornery=0)

Then the corners will have elliptical curves from $iCornery above or below to $iCornerx left or right of the corner.

EDIT. I decided not to change the _PrintRectangle function and instead added a function _PrintRoundedRectangle so that using the new dll with an old UDF won't cause a problem.

Link to new UDF and dll added to first post.

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.

Share this post


Link to post
Share on other sites

Hi Martin,

I tried to use this tool to create serial letters in PDF format. Now i have the problem that PDFCreator stops working after a few prints.

Do you have any ideas?

Also is there a possibility to add the PRINTFILE NAME? If i use autosave creating PDFs i have no chance to find the files without an identifier.

Thanks

Megaflops

Share this post


Link to post
Share on other sites

Hi Martin,

I tried to use this tool to create serial letters in PDF format. Now i have the problem that PDFCreator stops working after a few prints.

Do you have any ideas?

I don't know. Are you remembering to use _PrintEndPrint after finishing each document?

Can you give a link to the PDFCreator you use if it's freeware and I'll test it.

Also is there a possibility to add the PRINTFILE NAME? If i use autosave creating PDFs i have no chance to find the files without an identifier.

Thanks

Megaflops

I'll add a function _PrintSetTiltle which I hope will solve that problem. I won't be doing that until this weekend 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.

Share this post


Link to post
Share on other sites

I don't know. Are you remembering to use _PrintEndPrint after finishing each document?

Can you give a link to the PDFCreator you use if it's freeware and I'll test it.

I'll add a function _PrintSetTiltle which I hope will solve that problem. I won't be doing that until this weekend though.

Hi Martin,

thanks for the fast response.

1) Yes, I have _PrintEndPrint in the code. Also each document has just one page.

2) I use the PDFCreator from http://www.pdfforge.org/ . Here some Autoit examples for the COM object http://www.autoitscript.com/forum/index.ph...p;hl=postscript

3) I will wait for _PrintSetTiltle

megaflops

Share this post


Link to post
Share on other sites

Hi Martin,

thanks for the fast response.

1) Yes, I have _PrintEndPrint in the code. Also each document has just one page.

2) I use the PDFCreator from http://www.pdfforge.org/ . Here some Autoit examples for the COM object http://www.autoitscript.com/forum/index.ph...p;hl=postscript

3) I will wait for _PrintSetTiltle

megaflops

A new version with _PrintSetDocTitle included in the UDF has been uploaded. See link in first post.

I have tried PDFCreator and all seems OK. Can you tell me how you were using it to print several documents which produced the error?

I don't see the reason for the link to the COM object because that is an alternative way to print without using my udf and dll.

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.

Share this post


Link to post
Share on other sites

A new version with _PrintSetDocTitle included in the UDF has been uploaded. See link in first post.

I have tried PDFCreator and all seems OK. Can you tell me how you were using it to print several documents which produced the error?

I don't see the reason for the link to the COM object because that is an alternative way to print without using my udf and dll.

Hi Martin,

thank you for that function. It works fine now. The problem with PDFCreator was mor or less because I used Vista. Now where I run my prog on WIN 2003 Server it works. However I need the posiblility to define the document name.

The reason for using PDFCreator is that I have to create PDF files. So I will print to PDFC and than i use the COM object to generate postscript.

megaflops

Share this post


Link to post
Share on other sites

Hi Martin,

thank you for that function. It works fine now. The problem with PDFCreator was mor or less because I used Vista. Now where I run my prog on WIN 2003 Server it works. However I need the posiblility to define the document name.

The reason for using PDFCreator is that I have to create PDF files. So I will print to PDFC and than i use the COM object to generate postscript.

megaflops

OK, glad it works.

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.

Share this post


Link to post
Share on other sites

Hi Martin, I made a small change to my copy of your printMGv2.au3

Func _PrintDllStart(ByRef $sErr, $vPath = 'printmg.dll')
    
    $hDll = DllOpen($vPath)
    If $hDll = -1 Then
        SetError(1)
        $sErr = 'Failed to open printmg.dll'
        Return -1;failed
    EndIf

    Return $hDll;ok
    
    
EndFunc

The reason for this was I wanted the dll in another location not in the root folder of my script and with this mod I could specify it as an option to put the dll else where.

I thought I'd post here if anyone else wanted to do this!

Chris

Share this post


Link to post
Share on other sites

Hi Martin, I made a small change to my copy of your printMGv2.au3

Func _PrintDllStart(ByRef $sErr, $vPath = 'printmg.dll')
    
    $hDll = DllOpen($vPath)
    If $hDll = -1 Then
        SetError(1)
        $sErr = 'Failed to open printmg.dll'
        Return -1;failed
    EndIf

    Return $hDll;ok
    
    
EndFunc

The reason for this was I wanted the dll in another location not in the root folder of my script and with this mod I could specify it as an option to put the dll else where.

I thought I'd post here if anyone else wanted to do this!

Chris

The udf will work as long as the dll is in the Windows folder, the script folder or one of the folders searched by windows in the PATH list.

If none of those is suitable then your solution is needed. Since it won't affect any old scripts I've made your change to the UDF and I have replaced the current download. (I should have set up a new download and version but instead I'm off to bed!)

Thanks ChrisL.


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.

Share this post


Link to post
Share on other sites

Thank You for this handy udf & dll.

I only have this one problem with them:

It all works fine with the DefaultPrinter under W2K and also with _PrintSelectPrinter under WXPProf.

But _PrintSelectPrinter with W2K doesn't work: the Printer receives the job but goes into some strange paper-out-error.

I think this has to do with either _PrintSelectPrinter or with W2K , for the print (contents, size) is always the same.

Any idea?

Thanks

Michael

Share this post


Link to post
Share on other sites

Thank You for this handy udf & dll.

I only have this one problem with them:

It all works fine with the DefaultPrinter under W2K and also with _PrintSelectPrinter under WXPProf.

But _PrintSelectPrinter with W2K doesn't work: the Printer receives the job but goes into some strange paper-out-error.

I think this has to do with either _PrintSelectPrinter or with W2K , for the print (contents, size) is always the same.

Any idea?

Thanks

Michael

It seems that Win2000 has to have the default printer set in a different way so I expect that this is the cause of the problem. I've found out how it should be done and I'll try to get a version of the dll to allow for this written sometime during the next week. I'll pm you a copy when I've done it and I would be grateful if you could test it as I don't have access to W2K.


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.

Share this post


Link to post
Share on other sites

It seems that Win2000 has to have the default printer set in a different way so I expect that this is the cause of the problem. I've found out how it should be done and I'll try to get a version of the dll to allow for this written sometime during the next week. I'll pm you a copy when I've done it and I would be grateful if you could test it as I don't have access to W2K.

Thanks for the fast answer. I'm going to test your dll as soon as possible. In the meantime changing the default printer will do...(I hope)

Michael

Share this post


Link to post
Share on other sites

Hi, Martin!

How you know, I use your DLL with a Python's class, who wrapp PrintMG.dll.

In the header of the (Python's class) source, I quoted, only, "Martin from autoit's forums". Because I have no others infos.

Is it OK for you ?

** sorry for my bad english **

Edited by Michel Claveau

Share this post


Link to post
Share on other sites

Could you add a function to return the Printer DC?


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Could you add a function to return the Printer DC?

Yes. I'll see if I can add it when I do the W2K thing.

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.

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...