CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Jun 2004
    Posts
    1,352

    Writing you r own printer driver?

    I have a project the requires a printer to print a very long sheet, however the driver supplied by the manufacture doesn't allow you print on a sheet that is longer than legal size.

    Do I have write my own driver?

    And if I do, how does one go about writing thier own printer driver?
    Rate this post if it helped you.

  2. #2
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    Re: Writing you r own printer driver?

    Hi,

    Basically, yes you would need to write your own driver. However, first off all you should check that the printer is physically capable of printing a longer sheet.

    How to write the driver is a fairly vast subject, but the main thing it will depend on is the printer emulation (PCL, PostScript, Epson FX, etc.) that you are going to use.

    Alan

  3. #3
    Join Date
    Jun 2004
    Posts
    1,352

    Re: Writing you r own printer driver?

    Quote Originally Posted by alanjhd08 View Post
    Hi,

    Basically, yes you would need to write your own driver. However, first off all you should check that the printer is physically capable of printing a longer sheet.

    How to write the driver is a fairly vast subject, but the main thing it will depend on is the printer emulation (PCL, PostScript, Epson FX, etc.) that you are going to use.

    Alan

    The emulation would be IBM.

    The Printer we want to work with is OKIDATA 320. It's IBM emulation driver will not let you print beyond legal size.
    Rate this post if it helped you.

  4. #4
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    Re: Writing you r own printer driver?

    Hi,

    In that case, it's a GPD style driver you need, MS provide an SDK to develop these, take a look on MSDN. There's no C++ required unless you want to develop your own user interface or do some additional processing of the print job.

    It's worth taking a look to see if there's an existing printer driver for a compatible printer already available with support for the paper size you want.

    Alan

  5. #5
    Join Date
    Jun 2004
    Posts
    1,352

    Re: Writing you r own printer driver?

    Quote Originally Posted by alanjhd08 View Post
    Hi,

    In that case, it's a GPD style driver you need, MS provide an SDK to develop these, take a look on MSDN. There's no C++ required unless you want to develop your own user interface or do some additional processing of the print job.

    It's worth taking a look to see if there's an existing printer driver for a compatible printer already available with support for the paper size you want.

    Alan
    Sorry I took so long to respond.

    What's a GPD style Driver?
    Rate this post if it helped you.

  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Writing you r own printer driver?

    Quote Originally Posted by ADSOFT View Post
    The emulation would be IBM.

    The Printer we want to work with is OKIDATA 320. It's IBM emulation driver will not let you print beyond legal size.
    Can this printer print legal size? If not, then you're stuck.

    If this is the case, then the printer engine cannot handle legal size. That is what determines what can or cannot be physically printed, not the software driver. Before you go on a wild-goose chase, make sure that the printer is indeed capable of doing what you want to do. If it isn't, then you have to bite the bullet and get another printer.

    Regards,

    Paul McKenzie

  7. #7
    Join Date
    Jun 2004
    Posts
    1,352

    Re: Writing you r own printer driver?

    Quote Originally Posted by Paul McKenzie View Post
    Can this printer print legal size? If not, then you're stuck.

    If this is the case, then the printer engine cannot handle legal size. That is what determines what can or cannot be physically printed, not the software driver. Before you go on a wild-goose chase, make sure that the printer is indeed capable of doing what you want to do. If it isn't, then you have to bite the bullet and get another printer.

    Regards,

    Paul McKenzie
    It can. It's actually larger than legal. We have to use the IBM PROPRINTER III, but we want to use the OkiData Driver or our own. The IBM driver has some issures.
    Rate this post if it helped you.

  8. #8
    Join Date
    Oct 2009
    Posts
    577

    Smile Re: Writing you r own printer driver?

    If I read your comments correctly you didn't try the original OKI printer driver til now. I have a OKI 5610 and no problems like the one you mentioned. When printing the test page you'll see the maximum size possible.

    You should consider that drivers provided by the hardware manufacturer surely will fulfil the maximum the printer is capable. An exception to that only can be due to using a non-native print emulation for compatibility reasons, e. g. PCL. But I can't see why your own driver should be better than the native drivers.

  9. #9
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    Re: Writing you r own printer driver?

    Hi,

    A GPD style driver is also called Unitool, or Unidrv, and is the main type of printer driver that MS ship with Windows.

    Basically the driver is provided as part of the system, and it can be configured for different printers using a GPD file. This is a text file defining the features supported, and the commands necessary to select them. So, a typical driver will consist of a .INF file describing the installation, a .GPD file describing the features, and a .DLL including the resources for the UI.

    You can see the .GPD file for the ML320-IBM driver after you install the driver, it will be in the SYSTEM32/spool/drivers/w32x86/3 folder, as OKD320IB.GPD. If you want to add support for additional paper sizes, basically you want to develop your own version of this file, with the paper sizes you want. There's information from MSDN on how to do it here: http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx

    Let me know if you need any more info.

    Alan

  10. #10
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Writing you r own printer driver?

    Just curious, wouldn't it be cheaper just to get a newer printer?

  11. #11
    Join Date
    Jun 2004
    Posts
    1,352

    Re: Writing you r own printer driver?

    Quote Originally Posted by Arjay View Post
    Just curious, wouldn't it be cheaper just to get a newer printer?
    No, our client base is using this printer. It's an industry standard(in the industry of our market).
    Rate this post if it helped you.

  12. #12
    Join Date
    Jun 2004
    Posts
    1,352

    Re: Writing you r own printer driver?

    Quote Originally Posted by alanjhd08 View Post
    Hi,

    A GPD style driver is also called Unitool, or Unidrv, and is the main type of printer driver that MS ship with Windows.

    Basically the driver is provided as part of the system, and it can be configured for different printers using a GPD file. This is a text file defining the features supported, and the commands necessary to select them. So, a typical driver will consist of a .INF file describing the installation, a .GPD file describing the features, and a .DLL including the resources for the UI.

    You can see the .GPD file for the ML320-IBM driver after you install the driver, it will be in the SYSTEM32/spool/drivers/w32x86/3 folder, as OKD320IB.GPD. If you want to add support for additional paper sizes, basically you want to develop your own version of this file, with the paper sizes you want. There's information from MSDN on how to do it here: http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx

    Let me know if you need any more info.

    Alan
    So if I edit the .GPD file then I have to copy it for every installation?
    Rate this post if it helped you.

  13. #13
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    Re: Writing you r own printer driver?

    Hi,

    So if I edit the .GPD file then I have to copy it for every installation?
    You would want to create your own driver, so would provide a .INF file (with the install instruction), a .GPD file (with the printer definitions), and a resource .DLL (with the dialog strings.)

    You would then install it onto each system using "Add Printer", or whatever other method you currently use to install printer drivers.

    Alan

  14. #14
    Join Date
    Nov 2010
    Posts
    1

    Re: Writing you r own printer driver?

    Quote Originally Posted by alanjhd08 View Post
    Hi,

    A GPD style driver is also called Unitool, or Unidrv, and is the main type of printer driver that MS ship with Windows.

    Basically the driver is provided as part of the system, and it can be configured for different printers using a GPD file. This is a text file defining the features supported, and the commands necessary to select them. So, a typical driver will consist of a .INF file describing the installation, a .GPD file describing the features, and a .DLL including the resources for the UI.

    You can see the .GPD file for the ML320-IBM driver after you install the driver, it will be in the SYSTEM32/spool/drivers/w32x86/3 folder, as OKD320IB.GPD. If you want to add support for additional paper sizes, basically you want to develop your own version of this file, with the paper sizes you want. There's information from MSDN on how to do it here: http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx

    Let me know if you need any more info.

    Alan
    I am dealing with a similar issue... I have a label printer and I am trying to get it to work with compatible labels that are of a different size to the ones in the .GPD file provided by the manufacturer. There is one that is close, 1 x 1.5 inches; while I want 1.5 x 1 inches. I figured I would just modify the .GPD file and change the values of the papersize and printable area, but whenever I change the file, the modified papersize disappears from the printers options. Is there something else that has to be changed along with edits to the .GPD file?

    Here is the part of the .GPD file that I changed:

    *Option: N30347
    {
    *rcNameID: 301
    *OptionID: 301
    *PageDimensions: PAIR(300, 900)
    *PrintableArea: PAIR(271, 728)
    *PrintableOrigin: PAIR(17, 136)
    *Command: CmdSelect
    {
    *Order: DOC_SETUP.7
    *Cmd: "<1B>L<02EE>"
    }
    *Constraints: LIST(ContinuousMode.OptionON)
    }

    Since I was just modifying an already installed driver, I was hoping to just modify the .GPD file but I fear that there is more to it than that. Is there something else I am not doing that I should do?

    Thanks!

  15. #15
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    Re: Writing you r own printer driver?

    I'm not sure if you can do this by editing a GPD already in the system. There are a few things to watch out for:

    Windows keeps a list of supported forms, and these are updated when you install the printer driver to include all the paper sizes supported in that driver. If you are adding a new size, it won't already be in the list so you will need to add it via the Forms tab in the Printers folder Server Properties dialog.

    Windows will create a *.BUD file which includes some binary information from the GPD, you may need to delete that.

    All printers have a minimum media width & height, which will vary depending on the input tray. If the paper size you define is below these limits, it won't show up.

    BTW - this thread is now a long way from Visual C++

Page 1 of 2 12 LastLast

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured