What should I use to programmatically generate printout/report i Delphi - delphi

I need to generate a report/printout programmatically.
My app currently uses FastReport to build a report, consisting of text, images, tables etc.
It does not bind to any database. Everything is built programmatically.
However, the finished report does not look the same in PDF and RTF, and the old code is generally very complicated.
Are there any better tools to programmatically make a printout or report? Preferably one that outputs PDF and DOC.

In my opinion you've already got the best! I've used QuickReports, Piparti (early ReportBuilder), Crystal(!) and ReportBuilder and I've written a few reports by sending commands direct to the printer. As far as I'm concerned FastReport is much better (although I haven't tried Rave - nor will I).
Is it a recent version of FR? The PDF output for us is fine.
They have some good examples of writing reports through code on their website I believe and if you're looking at re-writing all the reports in A.N.Other reporting product why not, instead, use the opportunity to re-write the reports in a more maintainable way using FR? (Assuming that's possible, of course). Perhaps a cleaner approach to the code of the report generation will make it easier for the FR converter to create the RTF/DOC output...
I've never had much luck generating decent RTF versions of reports from commercial report writers. The only decent output I got was through lovingly hand coding every report using hundreds of '{','}' and '\' and spending days reading the RTF specs. Never again!
A lot of it appears to be down to the order you add the text/lines/fonts/styles etc to the report and the RTF generator can find it difficult to get the best rendering - I think.

You can try Rave Reports.
It has built in components to generate PDF, RTF and HTML documents.
And also it comes free.

For non-database printing needs, FastReport already works (code-based reporting), but for direct printing of Documents you could consider the very-thorough ExpressPrintingSystem from developer express, which is a true delphi printing system, not a reporting system.
Also if you need to create a print documents, almost like a word processor, and then print those word-processor-like documents, consider TRichView. It supports .DOC files, something you asked about.
Some day you might need a banded-report generator again and if you do, FastReport really is the best.

Related

Printing in SSRS vs. Crystal Reports

I am trying to decide on a reporting service to use and so far I have the general feel that many people believe that SSRS is gaining ground on Crystal if it has not already surpassed it. From what I've researched, it seems that looking forward SSRS would be the best choice but one major flaw/weakness that it has opposed to CR is that when it comes to printing the reports CR is much more accurate and user-friendly than SSRS. The reason being is that in order to present most of these reports they must be in either a .pdf or paper format so this would be a major hiccup in regards to choosing SSRS.
Would anyone that has experience with this issue from either the CR or SSRS side have any advice or opinions on this?
The only printing-related feature I've can think of that is difficult in SSRS is the ability to place a background image and print fields on top of that. This can be done, but from what I understand, it is easier in Crystal than SSRS.
When simply creating a report in SSRS, you can easily forget to set some of the PDF related options such as page size and orientation, but if you remember to set these appropriately and preview your report output in PDF, I don't think you'll have many problems. Like printing Excel documents, without some optimization, page breaks can show up in awkward places, but it is easy to fix this, or catch this in desigining the report, if you are aware of the issue.
SSRS doesn't necessarily assume that reports will be printed. The designer is not aimed exclusively at page layout. And some of SSRS's features, such as dynamic expand/collapse of sections, won't work with printed output of course.

Edit PDF documents in Delphi

We have a requirement to add the ability to edit PDF documents witin a Delphi application.
I.e. given a PDF document, open it and generate a form with edit boxes on it which the user can use to update the PDF document.
Can anyone suggest a third part component that would provide this functionality or suggest some way of achieving this.
Thanks
I use QuickPDF. Well documented, lots of examples, good support. However updating text in a PDF is an art, not a science, and unless you have full control over the producer of the PDF you may find it hard to do in the general case. For example: I have seen PDFs where text is formed from individual characters, each inserted at a specific location, so hard to edit as words; and of course in some PDFs the 'text' is actually an image of text, requiring OCR before you can edit it.
You can try Gnostice PDFtoolkit.
DISCLAIMER: I work for Gnostice.
Take a look at Amyuni PDF Creator ActiveX, it is supported in 32 bit and 64 bit applications, you may find it useful now that Delphi has a 64 compiler.
Usual disclaimer applies

Printing from web pages (reports especially) with greater precision

I am re-engineering a windows application to be ported to web. One area that has been worrying is 'printing'.
The application is data intensive and complex reports need to be generated. The erstwhile windows application takes advantage of printer APIs and extends sophisticated control to the users. It supports functions like page break, avoiding printing on printed parts of the sheet (like letterhead), choice of layouts and orientation, etc. Please note that these setting are not done only while printing, they are part of report definition sometimes.
From what I know, we cannot have this kind of control while printing web pages. I am in a process of identifying options at my disposal. While I prefer to first look into something that will help me print from raw web pages, following are other thoughts:
Since reports can also be exported to .xls & .pdf versions, let user download one and print directly. This however limits my solution to the area of application that have export feature.
Use Silverlight (4.0) for report layout definition and print. I think Silverlight 4.0 (in beta right now) provides adequate control over the printer. I have so far been avoiding the need of any RIA plugin.
Meticulously generate reports on web with fixed dimensions. I am not sure how far this will go.
Please share practices that can be applied easily in my scenario.
For reporting in the past on the web, using .NET, I like to generate PDF, Excel, Word or CSV files. I really like iTextSharp which allows for creating of PDF's.
Word can accept HTML, so that is usually quote easy. For more control you can get into the Word interops http://nishantrana.wordpress.com/2007/11/03/creating-word-document-using-c/, but they left me frustrated. Not for implementation, but I felt the clean up was poor.
CSV are great for raw data dumps and that is it.
For HTML, you can get nice control using a style sheet targeted to print media. There are just certain things you cannot control, like browser header and footer.
Flash also has better print controls than plain HTML, though you might not know it since these features are rarely used by flash developers. Almost everyone should have Flash installed these days, so it's not like Silverlight where there's a good chance of someone needing to install a plugin (doubly so for a beta version). I am not sure how the Flash printer APIs compare to Silverlight's printer APIs and if they give you the level of control you need, but their documentation is public so you can look into it.
Also I think exporting to PDF is a good idea. I don't see why you can't extend this to cover all places that would need to print a report. Basically instead of printing directly from the windows app running on their desktop, the same exact code runs on your server and generates a PDF that they can then print themselves.
I don't think you're going to have much luck trying to do it with raw HTML unfortunately. For one of our clients, we went with the "generate PDF" route and it worked out quite well. PDFs have the additional advantage that you don't have to print them out: you can just email them to the boss/accountant/whatever saving a bit of paper.
PDF is the way to go, if you want absolute control over printed output. As bonus, you can also provide the option to download PDFs in your application.
With HTML, you are at the mercy of user's browser settings for page size, margin and how page breaks will be handled.

Best tools [practices] for printing annotated image (TPicture) based documents from Delphi

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;
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/
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.

Delphi printing primer

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.
Two links to get you started:
Printing with TPrinter
Printing via the TPrinter Canvas
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
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.
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.

Resources