views:

300

answers:

2

It seems that most Delphi applications fit into two classes: Database-centric Applications that use Reporting Systems for all their printing needs, and applications that don't need printing.

For those in the excluded middle (non-database printing, non-reporting system), there are components to help out. For example, I have been a Developer Express "Express Printing System" customer since early on in that product's life cycle. For printing out any component (grid, spreadsheet,etc) that is also a Developer Express Printing System component to help me out.

So far so good. What I'm looking for is an alternative way (in Delphi 2010) to generate one or two page printouts that contain, typically:

  • Titles, and Headings
  • Page Headers and Page Footers
  • Ability to include a large picture which is the primary thing on the page. In this case, the picture (bitmap) is a chart custom drawn by me.
  • 100% bulletproof output quality on every version of windows known to human kind, with every kind of printer known to human kind.

[UPDATE: I was previously having bizarre glitches with Developer Express printing components on color laser printers, which I am now quite hopeful I can sort out. ] ... Still I think it would be wise to look at other printing components out there so my "toolbox" of possible solutions for my current and future projects can include a simple reliable way of generating printer pages.

So I could really use suggestions. I am biased against Reporting Systems, even Code Based ones, but I am considering fast reports even though my use for it would be far from the typical use-case scenarios. There are no row and column data-sets involved in my printed pages.

Update/Final: It looks like FastReports is great. It can easily transfer any data from in memory in your application (such as an Image), to the current report page(s), like this:

procedure TForm2.Button1Click(Sender: TObject);
var
  pic:TfrxPictureView;
begin
  pic := frxReport1.FindObject('Picture1') as TfrxPictureView;
  pic.Picture.Assign(Image1.Picture);

  frxReport1.ShowReport;

  frxReport1.Print;
end;
A: 

I have been using the HtmlViewer component from www.pbear.com for all my printing solutions.

You have to create an html page (or two pagews) of course, but once you can do that, you can do anything you like (or at least what the html standard supplies). The HtmlViewer has a preview window so that can be used as a generic 'report' viewer and it can print the output immediatly.

You will be amazed what you can do with html, and it is easy to change the 'report' because it's just plain html.

If you should go that way, I will be happy to assist you in any question you might have. The component is free since a couple of years. So that could be an easy and inexpensive solution to your problem.

Edelcom
That's an interesting idea. It seems that the code is pre-unicode (Delphi 2006), but it might not be hard for me to port it up. Have you already ported it up to Delphi 2009/2010?However I think that since my stuff is 99% an image, I would just be trading one set of glitches for another. I would have to output .html and .png (or other image format) files to disk, as an intermediate step, which right now I don't need. It's 100% in-memory right now. This is really interesting though, and I appreciate being pointed at it.
Warren P
It has been ported to 2010 by someone else (which I can point you to if you should need it). You can use images inside a resource if you like, the component request for an image using an event if none is found in the html syntax (i.e. on disk). It's easy to set up (and as I said I will be glad to assist you). It really has worked for me very, very well, over the years. In so far, that I haven't needed any reporting tool for all of my software (db-centric or otherwise).
Edelcom
If you find html appealing, I would also consider the Embedded Web Browser from Bsalsa, it works in D2010 and requires IE6+
Daniel Maurić
It looks like intermediate dumps of files to disk (html on disk) would be required by this approach, which makes it not that likely for me to go that way.
Warren P
No, you don't have to have html in a file, you can load it from a stream. At least with Bsalsa, haven't used PBear.
Daniel Maurić
I will keep mental bookmark on this solution too. Although if I buy the Fast Reports 'enterprise' tool, which costs $100 more than the professional version, they'll do the generating-html bits for me too.
Warren P
I would never recommend components which use IE in what version what soever. You are creating dependancies (not to mention difference in rendering between version). The appealing thing about the HtmlViewer is that it is written in Delphi. It maybe not implement every standard, but least you know what to expect before hand (although it's features are pretty well implemented though, it implements most of the html and css standards quit good. Enough for the purpose. At of course you could put the html in the resource.
Edelcom
+2  A: 

Fast Report is suited my needs very well. They even have a scripting system. You could try if is good enough for you.

http://fast-report.com/en/

r4w8173
Unfortunately that product while well-loved by its users is "database centric", and so is not ideal for my needs. I do appreciate the suggestion, and will consider it next time I have a TTable that needs printing.
Warren P
I wouldn't say it's "database centric", it does support databases out of the box, but that is to be expected. You can easily display any data, I use it to print my non database related objects just fine, give it a better look...
Daniel Maurić
Okay, I must have misunderstood.
Warren P
This works very well for any generic printing needs also. The free-reports component (http://fast-report.com/en/download/free-report-download.html) even works well if you don't need some of the advanced features in the latest versions.
skamradt
I found "TfrxUserDataSet" in the help. No ADO needed, in memory only (virtual data). There are no demos that come with the product for that type of dataset, are there?
Warren P
What I need with the FastReport that I can't figure out how to do is have a TfrxPictureView, that is loaded not from a file-link (filename on disk) but directly from an in-memory TImage/TPicture.
Warren P
PrintArray and PrintStringList demos use TfrxUserDataSet.As for pictureView you can get it using:(frxReport1.FindObject('Picture1') as TfrxPictureView).LoadPictureFromStream(...
Daniel Maurić
Thanks dmauric.mp. It turns out Fast Reports is incredibly easy to learn.
Warren P