views:

255

answers:

4

I need to add printing capabilities to an app and I have been looking around for information about printing. Logical/physical sizes, dpi, font scaling, etc, lots to digest since I never programmed printing into any app before.

Are there any sites that would offer a primer on the topics of page sizes, margins and all the other elements required to understand printing on Windows? I've been looking around for a while but what I find is either cryptic or years old...

I've been playing around with TPrinter, but I would like to build solid printing functionalities and understand what I'm doing better.

Using a report solution is not an option, even though I'm sure it would provide better results much sooner.

Thank you,

Eric F.

+4  A: 

Two links to get you started:

Printing with TPrinter
Printing via the TPrinter Canvas

Smasher
I managed to find all the information I needed, thank you for posting these links.I took the time to note the fact that I couldn't use reporting solutions in my original question. This is due to software constraints, budget constraints, requirements and evaluation of several reporting solutions...Reinventing the wheel might take time away from the core of your project. But if done right, that wheel will fit perfectly where its supposed to fit...
Eric Fortier
A: 

The version of Delphi you´re using is important. A number of Delphis came with print engines like ReportSmith (ugh). Another option thinking laterally is to use MS Word as a print engine. I´ve hooked into instances of Word & Excel before & utilised their functionality. As to raw printing using TPrinter or the print method of TForm you´d have to be pretty desperate. I seem to recall the Pacheo / Texeira Delphi books coming with a pretty good overview so you might want to see if you can find a copy of that somewhere.

mcottle
You can't expect everyone to have MS word installed, so this is not really a solution.
Smasher
mcottle
+1  A: 

I think that you are looking too lowlevel.

Try looking at the build reporting tools (Rave or whatever is in your product). Personally i am using a product called Report Builder from Digital Metaphors.

But if you want to do the lowlevel stuff lot og good information can be found at efg's computer lab - printing

BennyBechDk
A: 

Well, I have done things a variety of ways in the past, including the "hard way" with TPrinter. In fact, I recently had to do that again to run a special inventory label printer.

On the other hand, sometimes you are better off taking work others have done and using it for your benefit. I agree that ReportSmith isn't so great, and also it's Delphi (and Windows) specific. Using Excel or Word has those limitations, plus the fact that the user has to actually have them installed.

One thing I have done to make printing easy for some simple applications is just to generate an HTML file and call the user's web browser, then they can print it. HTML tables can be created relatively easily for numerical data, and you can include photos, etc. as well. This works well for some applications, and works on every platform where a web browser is installed. The downside, of course, is that HTML isn't the most precise layout language.

Noah