Has anybody ever pushed printer resources behind an Interface?

Has anybody ever pushed printer resources behind an Interface?

We've got an app that runs on a machine that must be connected to a printer, and it controls resources on the printer very closely. The problem is, the way it's designed now, we can't run it on any other computer if the same printer isn't attached.

I'm looking into pushing the printer-specific functions into an Interface so we can replace the printer with a stub, allowing us to test the app's logic without being connected to a real printer. The output of the stubbed Interface could go to a PDF printer or something similar if we need to see the output, or just a bitbucket if not.

For simple printing, that's not too bad, but if we want to test things like paper-out detection on forms in various (4) paper trays, it's a little more involved.

I looked through the code, and there are 7 distinct units that interface with VCL.Printers and API.WinSpool.

What I'm wondering is where to draw the line? Should I build the Interface over these two units? Or everything that refers to them?

Comments

  1. Create the Interface for your use case? I don't see the problem.

    ReplyDelete

Post a Comment