martin Posted August 13, 2008 Author Share Posted August 13, 2008 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 **That's fine with me. You could give a link to this thread as well. 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 More sharing options...
ptrex Posted August 13, 2008 Share Posted August 13, 2008 @progAndy Is this not OK for you ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_CreateDC ; Description ...: Creates a device context (DC) for a device using the specified name. ; Syntax.........: _WinAPI_CreateDC($sDriver, $sDevice) ; Parameters ....: $sDriver - Specifies driver name, "winspool" for printing, "display" for screen ; $sDevice - Specifies device name ; Return values .: Success - handle to a DC for the specified device ; ==================================================================================================== Func _WinAPI_CreateDC($sDriver, $sDevice) Local $aResult $aResult = DllCall("GDI32.dll", "hwnd", "CreateDC", "str", $sDriver, "str", $sDevice, "long", 0, "long", 0) Return $aResult[0] EndFunc ;==>_WinAPI_CreateDC regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ptrex Posted August 13, 2008 Share Posted August 13, 2008 @progAndy Is this not OK for you ; #FUNCTION# ==================================================================================================== ; Name...........: _WinAPI_CreateDC ; Description ...: Creates a device context (DC) for a device using the specified name. ; Syntax.........: _WinAPI_CreateDC($sDriver, $sDevice) ; Parameters ....: $sDriver - Specifies driver name, "winspool" for printing, "display" for screen ; $sDevice - Specifies device name ; Return values .: Success - handle to a DC for the specified device ; ==================================================================================================== Func _WinAPI_CreateDC($sDriver, $sDevice) Local $aResult $aResult = DllCall("GDI32.dll", "hwnd", "CreateDC", "str", $sDriver, "str", $sDevice, "long", 0, "long", 0) Return $aResult[0] EndFunc ;==>_WinAPI_CreateDC regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ProgAndy Posted August 13, 2008 Share Posted August 13, 2008 No, this is not enough I'd like to draw directly to the document with GDI-functions. This is not possible with this UDF. Now I'm trying to create one which uses the API directly, without a DLL. The problem is now, how to get the Page size *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 Link to comment Share on other sites More sharing options...
martin Posted August 13, 2008 Author Share Posted August 13, 2008 (edited) No, this is not enough I'd like to draw directly to the document with GDI-functions. This is not possible with this UDF. Now I'm trying to create one which uses the API directly, without a DLL. The problem is now, how to get the Page size Can't you get that with GetDeviceCaps as done in GRS's UDF?You can use the GDI functions with GRS's UDF. I've tried printing text and a curve and a screenshot using GDI with GRS's udf and it works fine. It would be better to use that than get the printer DC from my dll. The aim should be to get an AutoIt UDF which makes my dll redundant. Edited August 14, 2008 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 comment Share on other sites More sharing options...
ptrex Posted August 14, 2008 Share Posted August 14, 2008 @martin Would you be so kind to share these examples. It would save me the time to troubleshout this on my side. @ProgAndy A shortcut to the DC is using COM for the moment. $commdlg1=ObjCreate("mscomdlg.commondialog") If Not IsObj($commdlg1) then Exit $cdlPDReturnDC=256 $cdlPDNoPageNums=8 $cdlPDSelection=1 $cdlPDAllPages=0 $CommDlg1.Flags = $cdlPDReturnDC + $cdlPDNoPageNums If $CommDlg1.hdc < 0 Then Exit $CommDlg1.ShowPrinter So maybe it would be OK to combine COM and WinAPI to get it going. regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ProgAndy Posted August 14, 2008 Share Posted August 14, 2008 The HDC from COM, that's possible with DLLcall, too To GRS's UDF: I din't find that function, thats graet ! I'll use these functions to create a bigger Printing UDF *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 Link to comment Share on other sites More sharing options...
martin Posted August 14, 2008 Author Share Posted August 14, 2008 @martinWould you be so kind to share these examples. It would save me the time to troubleshout this on my side.ptrexI posted an example in GRS's thread here. 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 More sharing options...
ptrex Posted August 15, 2008 Share Posted August 15, 2008 @ProgAndyThe HDC from COM, that's possible with DLLcall, too To GRS's UDF: I din't find that function, thats graet ! I'll use these functions to create a bigger Printing UDFI was planning to start working on this. But since you guys are much more expierienced in this area, I will leave it to you.I am sure you come up with a total replacement of Martin's DLL and the COM approach I showed. @martinVery nice. Thanks again.regards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ChrisL Posted September 19, 2008 Share Posted September 19, 2008 Martin.. I have encountered a little issue with your dll file. If I use _PrintSetPrinter($hp) and manaully choose the printer from the Windows Printer Selector then all of the printer settings are obeyed, eg the size and to show me a preview before it prints (epson driver prefference) but if I use _PrintSelectPrinter($hp,"24x16") 24x16 is the name of the printer it ignores the settings and prints an A4 without showing me the preview (epson driver prefference) #include 'printMGv2.au3';the print UDF 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) Exit endif ;choose the printer if you don't want the default printer ;If _PrintSetPrinter($hp) = 0 then Exit Msgbox(0,"","Action Cancled");see also _PrinterSelectPrinter _PrintSelectPrinter($hp,"24x16");Automatically choose the printer 24x16 _PrintPageOrientation($hp,1);set landscape printing _PrintSetDocTitle($hp,"24x16") _PrintStartPrint($hp) $pght = _PrintGetpageheight($hp) - _PrintGetYOffset($hp) $pgwd = _PrintGetpageWidth($hp) - _PrintGetXOffset($hp) _PrintImage($hp,"24x16.jpg",_PrintGetXOffset($hp),_PrintGetYOffset($hp),$pgwd,$pght) _PrintEndPrint($hp) _PrintNewPage($hp);Not really needed if no more pages to be printed _printDllClose($hp) Any ideas. Thanks Chris [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ChrisL Posted September 19, 2008 Share Posted September 19, 2008 Ahhh I have sussed out what is happening, when choosing manually the printer it uses the printing prefferences. When selecting automatically it is using the Printing defaults! [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
martin Posted September 19, 2008 Author Share Posted September 19, 2008 Ahhh I have sussed out what is happening, when choosing manually the printer it uses the printing prefferences. When selecting automatically it is using the Printing defaults!Yes. You could change the defaults of course but I don't think I know how to do that programmatically. I'll think about it, but don't be too hopeful 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 More sharing options...
ChrisL Posted September 20, 2008 Share Posted September 20, 2008 Yes. You could change the defaults of course but I don't think I know how to do that programmatically. I'll think about it, but don't be too hopeful Rather than changing the defaults is it possible to use the printing preferences when _PrintSelectPrinter($hp,"24x16") or do you have to use defaults? Something seems a bit wierd with the defaults, even though there (manaually) set the same as the preferences it prints slightly different. [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
martin Posted September 20, 2008 Author Share Posted September 20, 2008 Rather than changing the defaults is it possible to use the printing preferences when _PrintSelectPrinter($hp,"24x16") or do you have to use defaults? Something seems a bit wierd with the defaults, even though there (manaually) set the same as the preferences it prints slightly different.I can set the various aspects of a printer and I can have a new function or extend the setprinter function.I prefer not to try and set everything so I suggest I set only these propertiesOrientation; (although there is already a function for this)PaperSize; to predifined format eg A4, Letter Small etc,PaperLength: overrides PaperSizePaperWidth:overrides PaperSizeScale:Copies: Colour or monochrome:Bin Source?Print quality?Yuk, it goes on forever.What do you think? 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 More sharing options...
ChrisL Posted September 20, 2008 Share Posted September 20, 2008 I can set the various aspects of a printer and I can have a new function or extend the setprinter function.I prefer not to try and set everything so I suggest I set only these propertiesOrientation; (although there is already a function for this)PaperSize; to predifined format eg A4, Letter Small etc,PaperLength: overrides PaperSizePaperWidth:overrides PaperSizeScale:Copies: Colour or monochrome:Bin Source?Print quality?Yuk, it goes on forever.What do you think?I'm sure it could go on and on but it sounds good to me what your proposing. The issue I have is that when using the printer preferences it obeys the Scale to Fill with no border (it's a large format Epson) when using the Defaults even though I tell it to fill the page it seems to refuse. I can tweak it by manually setting the offset value to 0 rather than using the function in the dll but it still leaves a slight border. It would be great and very kind of you if you do get time to add these functions.Chris [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
martin Posted September 20, 2008 Author Share Posted September 20, 2008 I'm sure it could go on and on but it sounds good to me what your proposing. The issue I have is that when using the printer preferences it obeys the Scale to Fill with no border (it's a large format Epson) when using the Defaults even though I tell it to fill the page it seems to refuse. I can tweak it by manually setting the offset value to 0 rather than using the function in the dll but it still leaves a slight border. It would be great and very kind of you if you do get time to add these functions.ChrisI don't really understand the problem I don't think. Why do you need scale to fit? Is your layout to a fixed format and size regardless of the printer paper?If that is the case you would need to say "design width and height related to the paper width and height means I need a scaling factor of X%", and then you set that in the scaling parameter of this (fictitious at the moment) function. Is that correct?I am not going to be able to have a scale-to-fit option. I have no idea how to do that and I don't intend to try to find out, although I'll listen to any suggestions. 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 More sharing options...
ChrisL Posted September 21, 2008 Share Posted September 21, 2008 I don't really understand the problem I don't think. Why do you need scale to fit? Is your layout to a fixed format and size regardless of the printer paper?If that is the case you would need to say "design width and height related to the paper width and height means I need a scaling factor of X%", and then you set that in the scaling parameter of this (fictitious at the moment) function. Is that correct?I am not going to be able to have a scale-to-fit option. I have no idea how to do that and I don't intend to try to find out, although I'll listen to any suggestions.I can scale the image prior to printing it to make sure it is the right dimensions, your fictitious solution could help. It's hard to explain without seeing it. I don't have the printer here but I'll get a couple of screen shots next week of the preview.When Manually selecting the printer from the dropdown box it uses the preferences and$pght = _PrintGetpageheight($hp) - _PrintGetYOffset($hp)$pgwd = _PrintGetpageWidth($hp) - _PrintGetXOffset($hp)gives a different result to using the Defaults even though defaults and preferences are set the same. I guess this could be something strange with the printer driver?? I do some grabs and post them next week. Thanks [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ChrisL Posted September 22, 2008 Share Posted September 22, 2008 Hi Martin, I have some screen grabs now. Picture A is using the Printing Preferences and manually choosing the printer _PrintSetPrinter($hp) Picture B is Setting the printer in the Code which seems to use the Defaults. _PrintSelectPrinter($hp,"24x36") Picture C is Setting the printer in the Code which seems to use the Defaults but not asking the DLL for the Width and height and offset but manually setting the sizes. You can see that the preferences and the Defaults are setup the same so I don't really understand why there is a difference. This is the Code #include 'printMGv2.au3';the print UDF 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) Exit endif ;choose the printer if you don't want the default printer ;If _PrintSetPrinter($hp) = 0 then Exit Msgbox(0,"","Action Cancled");see also _PrinterSelectPrinter _PrintSelectPrinter($hp,"24x36");Automatically choose the printer 24x36 _PrintPageOrientation($hp,1);set landscape printing _PrintSetDocTitle($hp,"24x36") _PrintStartPrint($hp) $pght = _PrintGetpageheight($hp) - _PrintGetYOffset($hp) $pgwd = _PrintGetpageWidth($hp) - _PrintGetXOffset($hp) ;Msgbox(0,"",$pgwd & "x" & $pght) _PrintImage($hp,"24x36.jpg",_PrintGetXOffset($hp),_PrintGetYOffset($hp),$pgwd,$pght);0,0,2160,2790); << Manual settings _PrintEndPrint($hp) _PrintNewPage($hp);Not really needed if no more pages to be printed _printDllClose($hp) This was why I was asking if it is possible to set the printer in the code but get it to use the preferences method rather than the defaults. Cheers Chris [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
martin Posted September 22, 2008 Author Share Posted September 22, 2008 Hi Martin, I have some screen grabs now. Picture A is using the Printing Preferences and manually choosing the printer _PrintSetPrinter($hp) Picture B is Setting the printer in the Code which seems to use the Defaults. _PrintSelectPrinter($hp,"24x36") Picture C is Setting the printer in the Code which seems to use the Defaults but not asking the DLL for the Width and height and offset but manually setting the sizes. You can see that the preferences and the Defaults are setup the same so I don't really understand why there is a difference. This is the Code #include 'printMGv2.au3';the print UDF 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) Exit endif ;choose the printer if you don't want the default printer ;If _PrintSetPrinter($hp) = 0 then Exit Msgbox(0,"","Action Cancled");see also _PrinterSelectPrinter _PrintSelectPrinter($hp,"24x36");Automatically choose the printer 24x36 _PrintPageOrientation($hp,1);set landscape printing _PrintSetDocTitle($hp,"24x36") _PrintStartPrint($hp) $pght = _PrintGetpageheight($hp) - _PrintGetYOffset($hp) $pgwd = _PrintGetpageWidth($hp) - _PrintGetXOffset($hp) ;Msgbox(0,"",$pgwd & "x" & $pght) _PrintImage($hp,"24x36.jpg",_PrintGetXOffset($hp),_PrintGetYOffset($hp),$pgwd,$pght);0,0,2160,2790); << Manual settings _PrintEndPrint($hp) _PrintNewPage($hp);Not really needed if no more pages to be printed _printDllClose($hp) This was why I was asking if it is possible to set the printer in the code but get it to use the preferences method rather than the defaults. Cheers Chris Is there a difference in the page layout between prefences and defaults? At the moment I have no idea how to find the preferences but I'll try to find out. 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 More sharing options...
ChrisL Posted September 22, 2008 Share Posted September 22, 2008 Is there a difference in the page layout between prefences and defaults?At the moment I have no idea how to find the preferences but I'll try to find out.No unfortunately there isn't I've been through it loads of times to check, all I can see is _PrintSetPrinter($hp) uses printing preferences and _PrintSelectPrinter($hp,"24x36") uses printing defaults.The only other thing I was thinking was can you send the paper size to it? [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now