Search the Wiki

Viewing 141 to 175 of 409 items

Mirrored Margins for Duplexing

TECH TIP: Mirrored Margins for Duplex Output You can create mirrored margins for duplexed output by using the Report.OnStartPage event. As an example, try adding the following code to dm0061.pas in the main reports demo application: procedure Tfrm0061.ppOrderListStartPage(Sender: TObject); begin if (ppOrderList.AbsolutePageNo mod 2 > 0) then begin ppOrderList.Engine.Page.PrinterSetup.MarginLeft := 0.5; ppOrderList.Engine.Page.PrinterSetup.MarginRight := 0; end  Full Article…

0

Initialization Problem

TECH TIP: Troubleshooting problem such as “Initialization of the DLL WINNT\..\Drivers\..\HPBFDF0.DLL failed.” This error only occurs when an application is run from within Delphi with the Integrated Debugging option turned on. It is an issue that exists between the Delphi debugger and the HP driver. The solution is to add the directory of the printer driver DLL’s  Full Article…

0

How To…Print to the Printer and File Device

Question “How do I print my report to the printer and a file device (PDF, Text, etc.) at the same time?” Solution Use the TppReport.OnPrintDialogClose event to create the file device and assign its Publisher and PageRequest property to the report’s. Download: PrintToPrinterAndArchive.zip PrinterToPrinterAndPDF.zip PrintToPrinterAndTextFile.zip Sample Delphi code: uses ppPDFDevice; procedure TForm1.ppReport1PrintDialogClose(Sender: TObject); begin //Create  Full Article…

0

How To…Print a Report Backwards

Question “How do I print my report backwards from last page to first?” Solution Start by caching the pages to memory.  Next rearrange the pages as you need by manually starting and ending the print job using the TppDevice.StartJob and TppDevice.EndJob routines. Download: PrintReportBackwards.zip Sample Delphi code: var liIndex: Integer; lDevice: TppDevice; lPrinterDevice: TppPrinterDevice; lPage:  Full Article…

0

How To…Get DefaultPrinterSetup

Question “How can I get the printer’s default settings, such as the paper name?” Solution The Printer.DefaultPrinterSetup property provides access to the printer’s default settings. Here is an example that iterates over the installed printers and populates a list box with the printer name and default paper name. Download: DefaultPrinterSetup.zip Sample Delphi code: uses ppPrintr;  Full Article…

0

How To…Configure Printer Specific Settings

Question “How can I configure the printer’s proprietary settings, such as the print quality, stapler, color, etc?” Solution Use the Report.PrinterSetup.DeviceSettings property to configure a Printer’s proprietary features (print quality, color, stapler, etc.). At design-time, use the Report Designer’s Object Inspector to select the PrinterSetup.DeviceSettings property. Next, press the Edit… button to display the Printer’s built-in  Full Article…

0

Exact Object Positioning

TECH TIP: Printed Paper and Exact Object Positioning ReportBuilder is designed to position objects exactly on the page. The issue is that the printer drivers often have bugs and the printer hardware itself can introduce inaccuracies. When you define a report in ReportBuilder you define the paper size and margins. The report layout contains objects  Full Article…

0

ESC Calls

ReportBuilder renders to the printer using the Delphi TCanvas class and via calls to Windows GDI functions. Use the TppPrinter.SendEscape() routine to manually send ESC commands to the printer. See the ppPCL.pas file and the TppPCL topic in the ReportBuilder help for more information about controlling the printer with ESC calls.

0

Detecting Whether Report Printed to Printer

TECH TIP: Detecting Whether Report Was Printed to the Printer The Report.AfterPrint event can be used to determine whether the report was printed to the printer (rather than preview, …). Example: procedure TForm1.ppReport1AfterPrint(Sender: TObject); begin if (ppReport1.PrinterDevice <> nil) then ShowMessage('Report was printed to the printer'); end; Note: If the user cancels the report while it  Full Article…

0

Detecting Whether PrintDialog Cancel

TECH TIP: Detecting Whether PrintDialog’s Cancel Button Was Selected When the print dialog is displayed to the user, you can determine whether the Cancel button was selected by using the  Report.OnPrintDialogClose event. Example: procedure TForm1.ppReport1PrintDialogClose(Sender: TObject); begin if ppReport1.PrintDialog.ModalResult = mrCancel then ShowMessage('Use chose to cancel the print request'); end;  

0

Delegate Copies

TECH TIP: Printing Copies By default ReportBuilder processes requests to print copies internally, by sending multiple copies of each page to the printer. Some printers have the ability to receive a page and generate the copies on their own. This can speed performance, particularly on slower printers. The following example shows how to delegate the  Full Article…

0

Default PrintToFile Dialog

Modify the RBuilder\Demos\EndUser\ReportExplorer example to do this as shown below: {—————————————————————————} { TmyEndUserSolution.LoadEndEvent } procedure TmyEndUserSolution.LoadEndEvent(Sender: TObject); begin ppReport1.OnPreviewFormCreate := PreviewFormCreateEvent; ppReport1.OnPrintDialogCreate := PrintDialogCreateEvent; end; {procedure, LoadEndEvent} {—————————————————————————} { TmyEndUserSolution.PrintDialogCreateEvent } procedure TmyEndUserSolution.PrintDialogCreateEvent(Sender: TObject); begin ppReport1.PrintDialog.AllowPrintToFile := True; ppReport1.PrintDialog.TextFileName := 'c:\myReport.txt'; ppReport1.PrintDialog.DeviceType := dtReportTextFile; end;    

0

Default Printer Name and Paper

TECH TIP: Windows Default Printer Settings Default Printer Name You can get the name of the computers default printer by accessing ReportBuilder’s global printer list object – ppPrinters. uses ppPrintr; var lsPrinterName: String begin lsPrintername := ppPrinters.DefaultPrinterName; end; Default Printer Setup Place the following code in the OnClick event-handler of a button on a form.  Full Article…

0

Custom Paper Sizes on Windows 2000

TECH TIP: Custom Paper Sizes on Windows Windoes XP/2000/NT have a completely different printing architecture from Win 9x. This is particularly apparent when it comes to custom paper sizes. Window XP handles paper sizes via Forms that are defined at the operating system level. Open the Windows printer panel Select File | Server Properties. The  Full Article…

0

Custom Paper Sizes

TECH TIP: Troubleshooting Custom Paper Sizes Some printers cannot handle custom paper sizes, or they can only handle custom paper sizes within a limited range of values. Troubleshooting Tips: To test paper sizes you can run demo 121 in the main reports demo app. This demo displays a printer settings dialog and is very useful  Full Article…

0

Controlling the Printer

TECH TIP: Controlling the Printer The PrinterSetup Class You can control which printer is selected for a report and its associated properties at either design-time or run-time. You can also do things like print to two different printers at once or have a report that consists of multiple section type subreports with each section going  Full Article…

0

Control Bin

TECH TIP: Selecting Paper Bins for Each Page Sometimes you may want to print the first page of a report to the manual bin and then print the remaining pages to the default bin. You can use the Report.OnStartPage event to set the bin for any page. Example: procedure TForm1.ppReport1OnStartPageEvent(Sender:TObject); var lsBinName: String; begin if  Full Article…

0

Continuous Paper

TECH TIP: Printing to Continuous Paper Layout For continuous printing (for example a receipt) use Title/Summary and removing the Header/Footer. Set the PrintHeight of each to phDynamic. Layout the DetailBand to print a single line item. Set the margins to 0 or to the smallest that the printer driver will support (some printers have an unprintable  Full Article…

0

Canvas Does Not Allow Drawing

The exception ‘Canvas does not allow drawing’ is a Delphi exception that is raised when an application cannot get a valid handle to a Canvas associated with a bitmap, screen, or printer.   Trouble Shooting Memory/Resource LeaksWe recommend running the application using a tool, such as FastMM, or AQTime, that can check for memory/resource leaks.  Full Article…

0

Why Preview May Not Match Printed Output

ReportBuilder uses the Printer device context to perform all calculations required to generate the report pages. This includes measuring text, wrapping text, and calculating the vertical page space required by a stretchable component such as a memo. Using the Printer device context results in a very high degree of accuracy when printing to the printer.  Full Article…

0

Troubleshooting: Endless Pages

1. Check each report/childreport and make sure that the Report.DataPipeline property is assigned OR AutoStop is set to True. 2. Try setting all Detailband.PrintHeight to phDynamic. It may be that you have a fixed height detail band that is too large to print on a page. 3. As a test, try commenting out all event-handler  Full Article…

0

How To…Toggle Page Orientation

Question “How do I toggle the page orientation from the preview window?” Solution Create a preview plugin that creates a new button to alter the page orientation of the report and regenerate when clicked. Download: ToggleOrientationPlugin.zip Sample Delphi code: type TmyToggleOrientationPlugin = class(TppPreview) private FOrientationButton: TppTBXItem; procedure OrientationButtonClickEvent(Sender: TObject); public procedure CreateToolbarItems; override; end; implementation  Full Article…

0

How To…Toggle DrillDowns

Question “How do I expand or collapse all drilldowns from the preview window?” Solution Create a preview plugin that adds a new button to the main toolbar.  When this button is clicked call the TppReport.ExpandDrillDowns or TppReport.CollapseDrillDowns as needed and regenerate the report. Download:  PreviewAndToggleExpandAll.zip Sample Delphi code: type TMyPreviewPlugin = class(TppPreview) private FCustomButton: TppTBXItem;  Full Article…

0

How To…Show the Outline in a TppViewer

Question “How do I display the report outline used with the preview window in a TppViewer object on a form?” Solution This can be done by manually creating a TppReportOutline object and placing it inside a TPanel on the form. Simply create the outline object, set its Parent to the TPanel and assign its Viewer  Full Article…

0

How To…Preview in a Panel

Question “How can display the Preview as part of a form?” Solution This example shows how to create an instance of the Preview plug-in and display it on a panel. The Preview is a non-visual class that managers the viewer, toolbar, outline and other UI controls. It requires a parent, which can be a form  Full Article…

0

How To…Prevent Beep on ESC

Question “How do I prevent my computer from beeping when I press the ESC button in the preview?” Solution Create a preview plugin that overrides the KeyDown event.  Inside this event, check for the escape key press and change it preventing the default beep. Download: NoBeepOnESC.zip Sample Delphi code: TMyPreviewPlugin = class(TppPreview) private protected procedure  Full Article…

0

How To…Hide the Preview Toolbar Buttons

Question “How do I control the toolbar buttons of the preview window in ReportBuilder?” Solution Use the OnPreviewFormCreate event to access the preview button pass-thru properties and control them any way you need.  You will need to type cast the TppReport.PreviewForm property to a TppPrintPreview object to access the button properties. Download: PreviewHideButtons.zip Sample Delphi code:  Full Article…

0

How To…Change the Report Color

Question “How do I change the color of objects inside the report from the preview window?” Solution Create a preview plugin that adds a new button to the toolbar.  Once this button is clicked, loop through every object in the report changing its color as you go.  Then regenerate the report to the previewer. Download:  Full Article…

0

How To…Automatically Navigate Within the Previewer

Question “How do I automatically navigate/scroll once the preview is loaded?” Solution With the addition of the scrollable previewer for RB 14, it is increasingly necessary to automatically navigate or scroll to a pre-defined position inside a report. This can easily be done by using the TppViewer.OnPrintStateChange event and the TppViewer.Busy property. 1. Access the  Full Article…

0

How To…Add Preview Hot Key Support

Question “How do I add hot key support to the preview window?  For instance pressing F8 prints the report?” Solution Create a preview plugin that overrides the KeyDown routine.  From there you can capture any key presses and perform any task you need. Download: HotKeyPrintPlugin.zip Sample Delphi code: type TmyHotKeyPrint = class(TppPreview) public procedure KeyDown(var  Full Article…

0

How To…Add a Button to the Preview

Question “How do I add a custom button to the preview toolbar?” Solution Create a Preview Plugin that overrides the CreateToolbarItems routine. Use the Toolbar.AddButton routine to add a new button to the toolbar before the default buttons are created. Take a look at the TppPreview.CreateToolbarItems routine located in the ppPreview.pas file for examples of  Full Article…

0

Hide Print Button on Print Preview

Question “How can I hide the Print button of the Report Preview?” Solution Here are two options: 1. Implement Report.OnPreviewFormCreate event: uses ppPrvDlg; procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject); begin TppPrintPreview(ppReport1.PreviewForm).PrintButton.Visible := False; end; 2. Implement a custom TppPreviewPlugin: This solution is best for the case in which you need to hide the Print button for all (or  Full Article…

0

Controlling Preview Dialog

TECH TIP: Controlling the Built-in Previewer You can control the built-in preview form via the Report.OnPreviewFormCreate event. For example the following code sets the Print Preview form to maximized and sets the Viewer ZoomSetting to 100%: procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject); begin ppReport1.PreviewForm.WindowState := wsMaximized; TppViewer(ppReport1.PreviewForm.Viewer).ZoomSetting := zs100Percent; end; Note: You will need to add ppViewr to the  Full Article…

0

PDF Unicode Support

ReportBuilder 12 introduced full unicode support for the native PDF device included with ReportBuilder. (Delphi 2009 and later). Below are some tips on how to utilize this feature and an overview of some of the new options. Encoding The PDF device now supports two types of font encoding. ANSI charset encoding and Unicode encoding. This  Full Article…

0

PDF Fundamentals

Exporting a report to a PDF file using the built-in PDF device is very simple using ReportBuilder. Setting the TppReport.AllowPrintToFile property to True will enable the Print To File section of the Print Dialog.  From there the PDF file type can be selected as well as a custom file name before the report is exported.  Full Article…

0