My Assistant
![]() ![]() |
|
|
Mar 9 2012, 05:59 PM
Post
#1
|
|
|
UtterAccess Veteran Posts: 450 |
I have an automated print job which needs to send a paper type code - the job prints on card and needs to select paper type "Thick". I've managed to select the bin using the id code but the printer pauses printing because the tray is set up as having thick paper in it and the printer won't print unless it gets a code for thick paper. If you manually confirm all is ok, the job proceeds - but it means a walk to the printer and this spoils an otherwise slick process.
Windows must know the code to send when the normal windows printer interface form is used. So I'm wondering how I get at this information ? Any help here much appreciated. Peter |
|
|
|
Mar 9 2012, 06:38 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 7,590 From: South coast, England |
Hi Peter
You will need to access the printer information through the device capabilities API, the constants for the Bins are DC_BinNames and DC_Bins. See my post here in the UA code archives that shows you how to use the devicecapabilities API for the Paper size. It is in the form 'frmPrintSetup' Also this MS website gives you the specific code for the paper bins. hth Edit: Corrected UA Code Archive link. This post has been edited by pere_de_chipstick: Mar 9 2012, 06:42 PM |
|
|
|
Mar 10 2012, 06:12 AM
Post
#3
|
|
|
UtterAccess Veteran Posts: 450 |
Hi,
Thanks very much for these. I've got the db and the ms article and I'm very encouraged that it seems possible to solve my problem. Thanks again for your help. Peter |
|
|
|
Mar 10 2012, 10:59 AM
Post
#4
|
|
|
UtterAccess Veteran Posts: 450 |
I've studied the MS article but that seems to deal just with bin id's. I've solved this problem - the job, which happens to be Access driving Word, pulls paper from the correct tray. I've looked at the features and the code in the test database which provides useful information on printer selection and paper sizes
e.g ' Get array of paper supported by the printer. lPaperCount = DeviceCapabilities(lpsDeviceName:=strDeviceName, lpPort:=strDevicePort, iIndex:=DC_PTypes, lpOutput:=aintPType(1), lpDevMode:=DEFAULT_VALUES) but I can't find anything dealing with Paper Type ( Thick, Thin, Labels, Transparencies etc.). This is the option which appears on the same printer dialogue page as Paper size and Paper Tray - both of which your sample db and MS Article deal with. I notice that DC_PTypes is a constant.. Private Const DC_PTypes = 2 ... but I don't understand what this represents. The Windows API function... Private Declare Function DeviceCapabilities Lib "winspool.drv" _ Alias "DeviceCapabilitiesA" (ByVal lpsDeviceName As String, _ ByVal lpPort As String, ByVal iIndex As Long, lpOutput As Any, _ ByVal lpDevMode As Long) As Long ...looks hopeful - winspool.drv suggests it might contain all the printer driver information for a given printer - which must include Paper Type - because this is a windows print (Printer Properties) function. But I'm not very experienced in fiddling with API functions - are there other parameters available which might include Paper Type ? Sorry if I'm missing the obvious ! If you can give me any more help here I'd be very grateful. Peter |
|
|
|
Mar 15 2012, 03:04 PM
Post
#5
|
|
|
UtterAccess VIP Posts: 7,590 From: South coast, England |
Hi Peter
Apologies for not getting back sooner but missed your last post. There is a further field in the DevMode mode structure of 'dmMediaType' with the description "One of the constants DMMEDIA from file API32.XT, indicating the type of paper or media to use". I'm not that familiar with the media type property, and will make some more checks, but in the mean time, I hope this helps. |
|
|
|
Mar 15 2012, 03:41 PM
Post
#6
|
|
|
UtterAccess VIP Posts: 7,590 From: South coast, England |
Hi Peter
The Media types has three preset values: DMMEDIA_STANDARD (1) Plain paper DMMEDIA_GLOSSY (2) Glossy paper DMMEDIA_TRANSPARENCY (3) Transparent film If your printer supports other media, (which I am assuming you card type is addressed as a diffrent media type) then you will need the device capabilities API to find the value of the mediatyper you need to pass in the printer set up. I understand the constant for DC_MEDIATYPENAMES is 34 but here are some websites that may help: http://msdn.microsoft.com/en-us/library/wi...2(v=vs.85).aspx last post here: http://social.msdn.microsoft.com/forums/en...62-28ccdf89975a http://www.lessanvaezi.com/changing-printe...he-windows-api/ hth |
|
|
|
Mar 17 2012, 08:26 AM
Post
#7
|
|
|
UtterAccess Veteran Posts: 450 |
Hi Bernie
I also found DMMedia in a web post dealing with winspool.drv but the post gave no details of this property. The further details and links you have provided will be just what I need to get me back on this. I'll do some further experimenting once I've studied the links you supply. Thanks a million for this. I thought I'd hit a dead end. I'll give you a further update when I've done some more work here. Peter |
|
|
|
Mar 29 2012, 04:27 PM
Post
#8
|
|
|
UtterAccess Veteran Posts: 450 |
Hi
I've followed up all the references you provided and it seems that I need the constant value for DC_MEDIATYPES. You supplied the value for DC_MEDIATYPENAMES as 34 (where did you get this value from ?) but as the MSDN article on DEVMODE says "To retrieve a list of the available media types for a printer, use the DeviceCapabilities function with the DC_MEDIATYPES flag.". I've searched extensively to find this enum but failed. Suprising as I'd have thought there would be a list somewhere. If you can provide any help here then this would be good. Thanks Peter |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 23rd May 2013 - 11:55 AM |