Results 1 to 12 of 12
  1. #1
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Automatic detection of printer properties (97, 2000, XP)

    This could be an interesting question for you "Word macro"-brains out there!

    Is it possible to detect that the (usually HP LaserJet) printer where a document is to be printed has:
    a) an automatic duplexing unit - IF yes THEN we want to print the document in duplex, and/or
    [img]/forums/images/smilies/cool.gif[/img] two trays - IF yes THEN we want to print page 1 on letterhead from the lower tray, and pages 2 ff on plain paper from the upper tray

    This would be wanted within the template which sets up the Word document.

    Currently the user has to go through a whole lot of manual clicking on tabs and buttons to achieve the desired result
    OR has to chose one of a number of "printers" which have been set up with the required options (e.g. PRT1234 for ordinary Simplex, PRT1234D for Duplex, or PRT1234L for Letterhead, all defined to print to the same real physical printer).

    Or is there a better way of doing this?

    Thanks!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic detection of printer properties (97, 2000, XP)

    Ja gibt es.

    Try this. I found it quite helpful.

    Sie m
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic detection of printer properties (97, 2000, XP)

    p.s. You want "Papierf
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Automatic detection of printer properties (97, 2000, XP)

    That reference would be wonderful if
    a) I could program Win-32 APIs
    [img]/forums/images/smilies/cool.gif[/img] I understood "computing" German!

    Can this not be done via a Word macro, folks?
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic detection of printer properties (97, 2000, XP)

    German's not that hard. Drucken means printer. There are translators on the net that'll decipher all of it for you. The VBA is all English. Oh well.

    Since there is no Printer object in VBA as there is in VB (why oh why is this so?), there's no easy way (maybe no way at all). You could try programming the FilePrint dialog, but you won't get access to much. See "Built-in dialog box arguments lists" in the VBA help. wdDialogFilePrint will let you programmatically change most of the settings on the print dialog. I wonder if VBScript has a printer object we can access... Hummm.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  6. #6
    New Lounger
    Join Date
    May 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic detection of printer properties (97, 2000, XP)

    Edited: <!t><!/t> and <!t><!/t> tags added around the URL to make the link live. -Mod.

    Hi John, I am a newie to Woody's Lounge. Have you solved your printing problem?

    I work for a law firm and have document which are automatically generated to the print (the user does not even see the document). Our problem was that when these documents are created they may only be one page in length and yet I do not know how many pages it will generate. Also, in some documents page 1 goes to tray 1, page 2 to letterhead tray and the remainder to tray 3.

    I solved this problem by embedding PCL Escape Codes in Word Print fields at the beginning of each page. If you look at the web site: http://support.microsoft.com/default.aspx?...b;EN-GB;q135569

    To embed these codes your printer driver MUST be PCL 5 compatible:

    To Print to the letterhead paper tray which is the Multi-purpose tray on our printer:

    1. Go to the beginning of the page in Word and press ENTER
    2. Press CTRL F9 to create a word field
    3. Type PRINT 27"&l4H" ie. & lower case L 4 and capital h (CASE IS IMPORTANT)

    The code must be on a row of its own.

    If you ever come across the PCL 6 code list I would be interested in obtaining a copy of them.

    Hope your find this useful
    Cheers
    Margaret

  7. #7
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Automatic detection of printer properties (97, 2000, XP)

    I have pointed my VBA programmer at the problem and he has gone away, muttering... He is able to display some printer properties, but we are in the throws of trying to decide what they mean and how they correspond to the REAL printer (and all the types of HP printer we have)! Thanks for your help!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  8. #8
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Automatic detection of printer properties (97, 2000, XP)

    Hello Margaret

    Yes, I too have had 'fun' embedding PCL codes (from PCL 2 onwards) in text files. I have never found you needed to put them on separate lines, though - might perhaps be a peculiarity of Word?

    The problem is that we have a number of HP printer models, and even within a printer model we might have variations like different numbers of input paper trays, duplex facility or not, and so on, on different physical printers so we need to determine just before print time what the properties of the selected printer actually are! Dead easy if you have only the one model with the same features on each printer...

    When you get to PCL 6 printers, you may have problems because (as you will have seen for yourself if you print "to file") there are no intelligible PCL code strings any more in the print data stream. I think HP have deliberately made it impossible to do what we can currently doing with PCL 5, since there is no way to determine where in a PCL 6 print data stream to insert a PCL escape sequence. They might perhaps explain this "improvement" by saying that the amount of print data is now reduced by compressing the commands into a smaller space - but we all know that it was done just to make things difficult for their customers, don't we!! That said, it's always possible that your method will still work with PCL 6, because you are inserting the PCL 5 command strings before the Word document is processed by the print driver to produce the print data stream. It would interesting to try this (but inapplicable to my specific situation because of the requirement for dynamic printer properties determination, as stated above).

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic detection of printer properties (97, 2000, XP)

    I've played with the API calls a bit more and I'm less impressed than before. It appears the information returned is not always reliable. For example, I query the printer object for Duplex on two printers -- one has a duplexer and one does not but the DC_DUPLEX parameter returns true for both! Not a real bright student.

    Anyway, I have an idea I think is worth exploring -- go to HP's web site and see it they have an ActiveX control or object library for their printers with works like their Jet Direct interface. You can get anything you want from Jet Direct...
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  10. #10
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Automatic detection of printer properties (97, 2000, XP)

    Although real-time discovery is the holy grail, you might do better to stand back and ask whether a database or .INI file solution might not be better/faster/cheaper. If your IT folks (is that you?) can maintain the file with the desired parameters, all your macro has to do is read the name of the ActivePrinter and the database/.INI file and go from there.

  11. #11
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wetherby, Yorkshire, England
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic detection of printer properties (97, 2000, XP)

    If I understand you correctly, you have the printer set up as separate printers depending on whether you want upper paper tray or lower ( or whatever). If that is so a simple macro set up as a button on the command bar will do what you want. Something like this ( quickly thought thro and may be able to be refined):

    Sub specialprint()
    ActiveDocument.PrintOut Background:=False, Range:=wdPrintFromTo, from:="1", to:="1"
    ActivePrinter = "myBlankPaperPrinter"
    ActiveDocument.PrintOut Background:=False, Range:=wdPrintFromTo, from:="2", to:="100"
    ActivePrinter = "myDefaultPrinter"

    End Sub

    Hope it works for you.
    Peter

  12. #12
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Automatic detection of printer properties (97, 2000, XP)

    Thanks to all for further comments!

    Since we have several hundred printers on our network, many down slow WAN links, I don't relish Yet Another Maintenance Task (YAMT) to keep a file up-to-date with which printer has what features, and distribute the file to a server local to the user who is doing Word. The Holy Grail of dynamic determination is, for us, a Must Have!

    I'm disappointed that the API has found to be wanting - we haven't got far enough here to find out whether this also happens in our circumstance.

    I was hoping to avoid having to define a number of different logical printers (each containing a specific combination of configuration options) for the same physical printer, but that may have to be done to enable a "user choice" at print time.
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •