Académique Documents
Professionnel Documents
Culture Documents
Operations
The entry point por the web server is the login page:
http://localhost/cgi-bin/repwebserver.dll/login
To test installation you can call version command, with version command you also obtain
the location of configuration files.
http://localhost/cgi-bin/repwebserver.dll/version
After login you can execute configured reports, see Installation instructions about how to
configure the available reports and users.
You can operate the report web server by providing a complete URL with required param
values, that is if you execute a report, you can add it to favorites because all execution
information is stored in the provided URL.
If you need security, run the web server in a secure web server so the URL and all the
informatino will be encoded.
http://localhost/cgi-bin/repwebexe.bin/version
The web report server URL is formed when you advance in login, selection etc, so you
don't need to know them, but for developers here is a list of them:
Parameter
Description
name
User name accessing the report server by default only the user Admin with
blank password is available. You can alter the configuration file to add users
username (execute /version command to know where is located), this user name will be
assigned to a report parameter if exists one named pusername, this is usefull
for executing reports obtaining diferent results depending on the logged user
Password for the selected user, this will travel on the internet so it's
password
recommended to use a secure server
aliasname You can configure several report groups in the configuration file
reportname The report file name
Possible values
with 0 (default), with 1 returns a native Report Manager Metafile, useful for
example to work with WebReportManX web component
Assigns this parameter to a parameter inside the report named pusername, if
pusername
exists
Assigns the language index to the report, to show parameter descriptions and
language
result in the selected language.
When metafile parameter exports to text file, if set to 1, the file will be
oemconvert
converted to OEM charset
When metafile parameter exports to text file, sets the output driver, default
textdriver
'PLAIN'
When metafile parameter exports to csv file, sets the separator string, default
separator
','
After testing datasets and connections you can drop easily fields to report sections.
Select the data page beside the structure page of the report, you will see your dataset and
other variables you can insert in your report, other useful informatino like data types is
also available.
You can drag any field and drop it in the detail section.
You can click the component see and change the properties.
You can now preview the report, and navigate throught pages.
Close the window and drop some labels, to drop a label click the label button in the
palette in the top of the window, then click and extend the label in the detail section.
We wil add a rectangle, drop a rectangle, clic in it, clic To Back Button and position and
size it like this figure:
To adjust detail size click the detail item in the design tree or the surface of the Detail
section, then alter Height property to 2 (cms).
Page header and footer are sections that will print on each page, headers at the top of
page and footer at the bottom of page, you can add more than one page headers or
footers, it will print in the natural order.
You can also assign a print condition to this sections so if you have more than one page
header you can switch between them by placing an exclusive condition for example, note
that print condition of page footer is evaluated at the same time that page header, that is at
page printing begin because the space for the footer must be reserved then.
You click the add button of the tree to add a header or footer section (if you have more
than one subreport you must select the correct subreport first):
In this sample we will place a simple label to the report page header,set the height to 1
cm. and change the size of the font:
Preview the report and you will see the placed label in each page.
Now follow this steps:
This component will show page number, you can add a label beside it:
Preview the report, you will see page number at the bottom of each page.
The subreport header is a section that the engine prints only once at the beginning.
The summary is printed after all the sections of the subreport, there you place information
about totals etc...
A group is a special section type that is printed at the begining and at the end of the
subreport but also after an expression change, if not change expression is assigned
will be printed at the beginnning of subreport and footer will be printed at the end so we
can use them as headers and summary.
Add a group, name this group as subreport1 for example, set height of header and
footer to 1 cm, place some text there:
Preview the report and see where this new sections are printed.
We will count our customers and print the count in the summary, place an expression in
the summary, and set expression property to 1, Aggregate to Group, Ag.Type to Sum.
Aggregate expressions calculate values based in the number of records of the datset, the
aggregate operation selected will be processed for each record, in this case it will sum the
expression (1) for each record, giving the count of customers, if you want to sum the lines
of a order you must place in expression the line_total dataset field for example.
If you preview the report and go to the last page you will see the count of customers:
Group header and footer
Now we will group the sample customers dataset by the first character of his name.
Note that if you want to group data it must be ordered correctly, we can't group the
customers by city if they are not ordered by city.
We will count also the number of customers for each initial character, the same procedure
you can do for printing order items and order totals.
In the main dataset use a order by clause that specify each group field:
For compatibility reasons, the expression of each group must contain other groups fields
that is, for a grouping by custno,orderno and partno:
FormatStr('0000000000',CUSTNO)
FormatStr('0000000000',CUSTNO)+FormatStr('000000000',ORDERNO)
+FormatStr('000000000',PARTNO)
That is: the change of any field when processing PARTNO group will break the
PARTNO group.
If you left page size Default, the engine will not select any page size before printing, that
is will use the default system page size, you can select a predefined page size or define a
new one (only Windows supports custom page sizes with limitations).
If you left page orientation Default, the enine will not select any page orientation before
printing, that is will use the default system page orientation.
You can configure the report to a specific page size, and also force printer orientation, the
default is use current configured printer page and orientation.
Language property allow you to design the report to print it in multiple languages, the
language property only affect labels, you design the report in english, then switch to
another language, and modify labels, before printing you can switch language from
Report Manager Designer and Report Manager components in Delphi/Kylix/Builder
(language property).
Printer Fonts property allow Microsoft Windows platform the option to use printer
fonts in dot matrix printers so the report will be printed in Native Printer fonts, with the
best precision and speed. To do so you must install the correct driver for the selected
printer, or the printer driver that the physical printer is emulating via Hardware.
Note: To print in Linux in fast test mode you can install the ps2ascii as a filter in your
printer spooler. If you have some sample of doing it, please e-mail me so I can include it
in documentation.
Two Pass Report property allow to know additional information about the report before
printing the first page, if you select this, you can use the pagecount function to obtain the
total number of pager of the report. If this option is set, the report will be calculated
entirely, then printed. It can consume more system resources and the preview is slower
because the entire report is calculated before the engine show the first page.
Duplex and paper source is implemented only for Microsoft Windows, allow the
selection of a paper source (print drawer source) and enable duplex (two side) print on
printers having this feature (usually high volume laser printers).
Page margins are used as the origin for printing sections, bottom margin limits the space
used in the bottom of the page, and right margin limits the space used to the right of the
page that is when printing horizontally (labels for example).
Prefered save format change the way the report is stored to file, you can select plain text
to save the report definition as text and track changes with some version control system,
to obtain a smaller file but not human readable select zlib compressed.
Printer selection
You can force the report to select a specified printer. There are predefined printer
configuration names, and each printer configuration name can be linked to a system
installed printer, it's also useful to determine wich printer will use devicefonts (Windows
only) and to fine adjust the position of the page in the physical page.
By selecting system configuration you force all users use a single configuration (you
must be root in Linux or Administrator in Windows).
Printer selection in Windows has some issues, see known issues and workarounds.
Report grid
Report grid is a very useful tool when designing reports, it allows to easily align
components.
The grid options are stored for each report, you can access them selecting grid option
item in display menu.
If the grid is not enabled, it has no effect, but it can be still visible.
If you select draw lines property, a grid of lines will draw instead points (the default).
Command line tools are very usefull to provide access to report processing to other
applications, shell scripts... You can also link to the report library.
Command Use
reptotxt This command converts a .rep file to a plain text files
This command converts a plain file to a .rep file, you can process a report or
txttorep
alter it with text processing tools and then save it as a report definition
This command process and print a report definition, you can select a range
printrep
of pages, number of copies and parameters
This command process a report definition saving it to a Adobe pdf format
printreptopdf file or to a native format, Report Metafile, the native format can be viewed
with metaview or Internet explorer plugin, and printed with metaprint
This command prints a Report Metafile format file, you can select a range of
metaprint
pages and number of copies.
This command generate a executable with a report inside it so it can be
compilerep
distributed independenly (Windows only)
To obtain a description and instructions for use this command line tools write the
command without parameters in a command window.
Report Libraries
Report Manager supports report libraries, you can store reports inside database tables, so
they are centraliced in a single place.
You can configure available libraries at Report Manager designer, go to File Menu,
Libraries and configuration:
It's recommended you create the library from this dialog, after testing the database
connection, a library consists in two tables, the reports table and the groups table. In the
report table the reports and report descriptions are stored, the groups table is needed to
store the tree structure of the library. You can browse the library after the creation.
You can create new folders and new reports.
Use the save to library and open from library options and file menu to manage the reports
inside the library.
Delphi/Bulider/Kylix components support also report libraries from the IDE, you can
even test your reports without compiling your application. Use a TRpAlias to setup
database connections and check report library access, then link your
PDF/CLX/VCLReport to the TRpAlias, select a connection name and a report name.
You can create report libraries with PosgreSQL, but you need to create a domain BLOB
in your database to identify the binary datatype:
Report Manager executes a SQL standard sentences to create report libraries, if you
experience problems you can create the libraries manually.
Parameter features
Report parameters is a powerful feature, here is a list of samples you can do with
parameters
You can define the parameters, and also preview how the parameters will show to the
user.
Parameter definition
Parameter definition window allows to add, modify and delete parameters, you can assign
parameters to datasets (parametrized querys). The parameters can be visible or not visible
to the user. You can assign a single parameter to multiple datasets.
Parameter types
Type Description
String, Integer, Float,
Basic types, they contain fixed values
Date, Time, DateTime
Boolean False or True values
Contains a expression evaluated before any dataset is open, so the
Expres.Bef.Open
result can be assigned to a parametrized query for example
Contains a expression evaluated after opening all datasets, so it can
Expres.Aft.Open
contain dataset fields
You use this parameter type assigning it to at least one dataset, you
must provide a search string, the engine will search in the sql
String Substi. sentence for that string and will replace it with the value of the
parameter. This can be used to pass the entire sql sentence as a
parameter or only the WHERE clause for example.
You provide two list, one for value captions, and other for real
values, the engine will show to the user a combo box to select from
the caption list, and will assign the corresponding value from list of
values.
Value list
A dataset can be specified to fill the value list, when the parameter
window is shown the list is filled with the dataset, first field of the
dataset will be descriptions, and second field on the dataset will be
real values.
It's a merge of String Substi and Value List, the value to be replaced
will be a combination of selected values separated by commas. Very
useful to use with querys like:
The user will be able to select more than one value, a checklist box
Multi select
will be provided on parameters window.
The value list can also be loaded from a dataset, like Value List
parameter type.
Special parameters
There are special parameters that can be used to interact with the engine itself, just define
and assign values to them:
Name Purpose
Replaces the connection string with the provided
ADOCONNECTIONSTRING
in this parameter
Replaces the connection string in "ALIAS"
ALIAS_ADOCONNECTIONSTRING
connection with the provided in this parameter
Path to a user defined dbxconnections file, to alter
DBXCONNECTIONS
password, database path at runtime
DBXDRIVERS Path to a user defined DBXDRIVERS file.
Default destination, on preview window, send mail
MAIL_DESTINATION
option
Default subject, on preview window, send mail
MAIL_SUBJECT
option
Default body, on preview window, send mail
MAIL_BODY
option
Optional, force a filename for the attatched file,
MAIL_FILE
you should include file extension
Replaces database connection parameter
PARAMNAME with the value in the parameter.
Useful to provide user name, password, database
path, before executing the report
Validation
You can set a validation expression for a parameter, the validation of parameters is done
in the moment of showing the parameters to the user, if the validation is not valid, the
error message is shown to the user, this is true also for integrated web server. Note the
validation is not done before running the report, to do validations before running the
report you can use the checkexpression evaluator function.
Lookup help for parameters
Sometines a parameter is specified as a code number (customer code, family code). You
can specify a lookup search so the user can browse a dataset to find the code number.
The simple case is to select a code number from a small dataset. Imagine you have a
parameter FAMILY_CODE, and the user must enter the family code as a number. The
final result will be a button beside the parameter input, when the user click the button all
the available families are shown, the user select it by name and the family code is
assigned to the parameter.
Another case is to select a code from a large dataset where the user should search for, like
a customers table.
Steps to create a lookup dataset to assist the user on parameters window, with search
feature, usually to loockup on large datasets:
This is called a parametrized query, the query is send throught the database driver, and
translated by the driver to a similar syntax, the parameters must be reconized by the
database driver and the database engine (usually a sql server).Depending on the SQL
server the query will translate by the database driver natively with different syntax:
This query is "compiled" by the database engine, usually this process parse the query,
translating to a native (and fast) format, selects a optimization method (query plan)
including indexes used by the engine, the query can be compiled once (also called
prepare procedure), and execute multiple times, the successive executions will be lot
faster because the database engine can bypass the parse of the query and analizing index
statistics to select the best path to execute the query.
So passing parameters to a database involves the database driver and database server,
some database drivers, does not support large parameters or does not implement some
parameter types (date,time), others are a bit tricky about detecting them, for example:
Also because the query is compiled by the database server and a optimization plan must
be selected, the parameters can not be placed in any part of the SELECT sentence.
The above sentence is not valid because a parameter inside the order by clause is usually
not valid, think that changing the order of a query can change the way the query is
optimized by the database server, for example if the where clause and the order by clause
references same field, only one index is needed, if they differ, a diferent query plan
(index path) is needed to execute the query, so a recompilation of the query is needed.
Some database drivers and servers allow parameters inside the select fields part but
others not:
Note: When you missplace a parameter, the database driver can ignore not returning you
any error.
Workarounds
Using query parameters is efficient and the prefered way, but when database drivers have
some problem, or it's not possible to do it you must find alternative methods. For
example, if the database driver does not accept Date parameter type, you can define the
parameter as string, the syntax of the date will be defined, then by dabase server, for
example '31-JAN-2004' or '01/31/2004'.
For example:
You can create a string substitution parameter assigned to one or more datasets with
properties:
Property Value
Name ORDERBYCLAUSE
Value ORDER BY 1,2,3
Search For ORDER BY 1,2,3
Description Order by clause
ORDER BY 2,1,3
Will search for the string ORDER BY 1,2,3 inside the sql sentence, if found, it will be
replaced by ORDER BY 2,1,3 then , the new generated sql sentence is executed.
This is also usefull to change some part of the where clause (or the entire clause) or also
to change the entire sql sentence at runtime.
paramname:='NewStringValue'
Linked querys
A subreport can have only a main dataset, but you can open as many datasets as you
want, and you can link this datasets to the main dataset or to other dataset linked to the
main dataset. You can also use the child subreport property of a section to merge
subreports.
For example:
• A main dataset with a query to obtain the order lines and order header
• A customers dataset linked to the main datset (customer number) to obtain the
data for the customer
• A ship company dataset linked to the customer dataset by (ship company number)
To link a dataset with another dataset you must select the property Master Dataset. A
linked dataset must have parameters, the name of the parameters must be the same as the
field names of the linked dataset.
Here is a sample:
When you assign a main dataset to a subreport, this subreport, prints the details once for
each record. So while printing a subreport, if the main dataset has a linked query , it will
be updated, for example if the custno field in the main dataset changes and the linked
query is parametrized with this field, the linked query will change, and the new field
values will be available to print.
Child subreports
You usually assign a main dataset to a subreport, and the subreports are printed in order.
But you can change this behaviour by assigning Child Subreport property to a section,
usually you assign this property to a detail section, so the child subreport will be
processed after printing the detail section.
Think about a customers report, the main subreport can contain a detail with the company
name:
And another subreport will print the orders for that customers
You must link the orders dataset to the customers dataset so when a customer is printed,
the orders dataset is updated and the child subreport is processed with the new data.
Child subreports are useful to link and print many to many datasets. See you can calculate
subtotals for each subreport or child subreport.
Printing labels (horz.desplacement/vert.despacement)
• Create a new report, and setup the main dataset, test it placing some labels and
fields
• Set page margins as the top-left label distance of the first label
• Set the with and height of the detail as the with and height of the labels plus the
label distance
• Set detail Horz.Desp. property to true for left to right labels, or Vert.Desp to true
for up to down labels.
• You can test the adjustment by placing a shape of type rectangle and print it (in
Windows, if the driver is correct, the preview of the printable area should be
exact)
• If the printer has printable area limitations you can omit the first row or column
by adding this space to top-left page margins or not use this space
If you want to begin printing labels after 10 labels then you must provide 10 empty
records, so the space of this labels will be skiped.
The building of the dataset can be server side, if you use for example a SQL database
engine you can write a stored procedure with a parameter like number of blank records,
number of copies to print and return the built dataset.
To prepare a dataset to be passed to the reporting engine with a number of records you
can use TClientDataset and assign the dataset to the reporting engine:
cdataset:TClientDataset;
...
cdataset.FieldDefs.Assign(itemsdataset.FieldDefs);
cdataset.CreateDataset;
cdataset.Append;
cdataset.Post;
cdataset.Append;
begin
cdataset.Fields[i].AsVariant:=itemsdataset.Fields[i];
end;
cdataset.Post;
// At design time you must assign the clientdataset to the report using
a TRpAlias component
CLXReport1.Execute;
Usually the reports of a project have the same page header or the same report header. For
example if you are designing several reports related to a enterprise, may be interesting to
include the logo and the name of the enterprise. Then you cut and paste this header in
about 100 reports. As a generic application, when you sell it the new customer wants to
change the position of the logo and center the enterprise name, will you change the 100
reports?
The answer to this problem is to store this page header in a external file and especify all
the reports to load the page header from this file, so changing this file you are changing
the 100 reports at once.
Each section in Report Manager have External path property, when the report is loaded,
each section with this property assigned will try to load the section from the specified
file, the external path can be an expression by preceding the string by the @ symbol.
When working with external sections you are responsible for writing and reading them .
The first time you want to include a internal section you assign the External path
property, then right click the External Path property and select save option of the
popup menu.
Next time you open the report it will try to load the section from the file or field. If you
want to use this external section in another report you assign External Path property
and select load option of the popup menu.
External section can be stored in a database table, click in 'External database' property
and Report Designer will show a dialog where you can enter data about where the section
is stored:
You can dropdown the combo boxes to see the available tables for the connection, fields
and values, if you enter a new value the designer will ask you if you want to create a new
record in the table to store the section.
Expression evaluator
The expression evaluator is a powerful tool included in Report Manager engine. It allows
to evaluate complex expressions accessing dataset fields, convert field types,
interactuate with the report to know the available free space in the current page, the
current data group...
The Report Manager expression evaluator is like a scripting language but without
iteration operators.
There are lot of report component properties that are expressions: print condition, skip
page condition,...
To design advanced reports you should understand how the evaluator interactuates with
the engine:
• Before the print process, the expression evaluator is initialized, the engine add
useful functions you can use: Page, Free_space, CurrentGroup...
• After the datasets of the report are open (this is done before print anything), the
evaluator can access dataset fields with the syntax: ALIASNAME.FIELD (if the
fields contain spaces use the clausors: [ALIASNAME.CITY NAME])
• Any component with a Identifier property assigned is also added to the
evaluator name space, you can reference them using the syntax M.IDENTIFIER,
or IDENTIFIER, also report parameters are included in the evaluator name
space.
• The engine evaluates expressions in components in a natural way, that is Print
Condition of a section is evaluated before printing this section, if a expression
contains a reference to an Identifier (another report component), it will use the last
value of the component value (last evaluated expression property)
• The exception of the rule are aggregate values, if you assign Aggregate property
of a report component, the expression will be evaluated once for each record of
the main dataset assigned to the subreport containing the report component, then
the aggregate operation is done (sum, stddev...)
Evaluator syntax
• To create a variable assign a value to it: (newvariable:=0), but better if you create
the variable adding a report parameter.
• All variables can be of any type, if an operator does not allow the combination of
diferent types it will raise an exception (error), that is like using variant type in
object pascal language or like basic language
• Sentence separator operator (;) has more precedence than assignment operator so
you should use parentesis: (variable1:=2);(variable2:=4);
• Because the evaluator is expression based and not program based, when using the
sentence separator, the result of the expression will be the last evaluated
expression, for the sample above the result will be 4.
• It allows the use of the conditional IIF operator, that is use/evaluate one
expression if the condition is true or other expression if false
• Variables are accessed as M.VARIABLENAME or VARIABLENAME, dataset
fields are accessed as ALIASNAME.FIELDNAME, or also FIELDNAME, but
last syntax is not recommended because can cause confusion with variable names,
it's not recomended to use an ALIAS with name 'M' .
Evaluator operators
Some samples:
Index Meaning
0 Value as string
1 Selected values on multiple selection
2 Selected indexes on multiple selection
PARAMINFO(paramname:string;
3 Selected items on multiple selection
index:integer)
4 Full list of items
5 Full list of values
6 Datasets linked to the parameter
7 Parameter description
8 Parameter hint
9 Parameter error message
10 Parameter validation expression
Building expressions
When you are editing a report, in the expression properties appears a button, clicking this
button a expresion builder helper is shown.
There you can find information about available functions, variables and database fields,
and you can syntax check expressions.
Barcode printing
Barcode limitations
In Linux, the qt library (version 2.3) have only a resolution of 100dpi (dots per inches) so
with some printer drivers the barcodes printed are not readable, that is because the
rectangles of the barcode are slightly bad positioned because this low resolution. If you
export the report to Adobe PDF format and print them using Adobe Acrobat Reader you
will obtain better quality. You can try to use other printer driver or change the module of
the barcode (size of the narrowest rectangle). You can also try to install latest CUPS
drivers, it's reported to work better.
Type Description
bcCode_2_5_interleaved,
bcCode_2_5_industrial, 2 of 5 code family, supports all properties, this code allow an
bcCode_2_5_matrix, unlimited number of digits
bcCodeITF14
bcCode39, Code39 Family, supports all properties, this code allow an
bcCode39Extended unlimited number of alphanumeric characters, the barcode
with is wider than other that only supports digits, if
Calc.Checksum is set an additional character checksum is
added, the start and stop characters (*) are automatically
added.
Code 128 family, A and B allow alphanumeric coding, the B
allow also lowercase chars. The C allow only numeric
values but gerenerates the narrowest barcode. The
bcCode128 generates a B and C mixed barcode, full
optimized, so a code like 234534AB generates a 128C
segment and a 128B segment, so the barcode is 50% smaller
than using 128B.
bcCode128A, bcCode128B,
bcCode128C, bcCode128
To generate EAN128 valid codes you must use the
application fields and separator digits, you can use the 102
code or any char with a ascii code greater than 102 to
represent a separator digit, a EAN128 code always begins
with a separator, a sample:
#102+'10896021'+#102+'21456738XABT'
bcCode93,
Code93 family, alphanumeric barcodes
bcCode93Extended
bcCodeMSI MSI barcodes, only digits
bcCodePostNet Postnet barcode, only digits
bcCodeCodabar Codabar barcode, digits, and A..D letters and some simbols
bcCodeEAN8, European EAN barcodes, the last digit is a checksum and
bcCodeEAN13 can be calculated if Calc.Checksum property is set
Valid ratio values are between 2.0 and 3.0, except for 2_5_matrix between 2.25 and 3.0.
Usually the ratio is 2.0 and it's adjusted to 2.25 on 2_5_matrix. Larger the ratio value
wider the barcode output.
Calc.Checksum property
Modul
The Modul property is used to build the barcode as the size of the narrowest bar.
Rotation property
You can rotate the barcode by a square angle, this property is in degrees.
Composite reports
Composite reports means concatenation of full processed reports, the union is serial but
the free space for the last page of the previous report can be used by the next report.
To compose reports you must set two pass report option in all the reports implied.
You must have two TRpReport objects available, you can place two TVCLReport
components in a form for example, the TVCLReport.Report property contains the
TRpReport object if you assigned a filename, or used LoadFromStream method of
TVCLReport.
Lets name ReportOne and ReportTwo as the two TVCLReport components, the code to
preview or print the composite report is:
//
uses rpreport,rpgdidriver...
rpgdidriver.CalcReportWithProgress(ReportOne.Report);
ReportTwo.Report.Compose(ReportOne.Report,false,nil);
ReportTwo.Execute;
//
You must have at least two ActiveX component, set the filename and calculate the report
before composite. For example, for three reports:
reportman1.filename = "c:\repsamples\sampl2.rep"
reportman1.CalcReport(True)
reportman2.filename = "c:\repsamples\sampl3.rep"
reportman2.Compose(reportman1.Report, False)
reportman2.CalcReport(True)
reportman3.filename = "c:\repsamples\sampl4.rep"
reportman3.Compose(reportman2.Report, False)
reportman3.Preview = True
reportman3.Execute()
Print output and design for dot matrix and pos devices
Page setup
Page size is very important to configure, else you will obtain longer lines and longer
pages and not the correct output.
You can define margins to 0, because the page size will define the practical print out of
the printer, that is the printable area.
Page Width=80 characters with/ 10 characters per inches = 8 inchess = 8*2.54 cms =
20.32 cms
Page Height=66 lines / 6 lines per inches = 11 inchess = 11*2.54 cms = 27.94 cms
Select user defined paper size and enter the correct values.
For thermal receipt printers usually the font A is 12cpi and font B is 17 cpi, so set a
page with of 42 /12cpi=3,3 inchess=8..6cms. The characters for font B are 3.3*17=56 at
this size. The physical real page width can differ.
For impact receipt printers usually the font A is 10cpi and font B is 12 cpi, so set a page
with of 33/10cpi=3,3 inchess=8..6cms. The characters for font B are 3.3*12=40 at this
size. The physical real page width can differ.
For receipt printers you can establish a page length of 11 inchess=27.94 cms. If you
don't use page headers-footers, or repeatable group headers, will be just like there was not
page breaks, the ticket printer driver does not send form feeds.
If you have problems or want to enable better quality escape codes (bold,italic, 12cpi,
20cpi) you can select another driver by clicking at printer setup button. You can select a
printer in the list and the driver it will use. If you don't select a driver, standard output
will be used.
You can also select a printer queue (system printer) so the output will be done to the
selected printer.
At page setup you can force cash drawer open (the engine will send the escape
command to the printer), before or after printing the report.
With Microsoft Windows and a good quality print driver installed you can still use the
driver to provide fast printing with printer native fonts. You must select the blank text
driver and check the Device fonts option.
With this method, the engine will select the best affordable font for the texts, but the
graphic elements and images will be printed also (usually the graphic elements print slow
on impact printers).
Note this print method does not output lines, but calls Windows API for any graphic and
text operation, and for page size selection, the source of any problem (page displacement,
garbage output) is usually the print driver.
The graphic elements (drawings and images) are ignored, based on the page size, the
number of lines of the report are determined at a rate of 1/6 lines for inch so for a 11 inch
page size the page will be build with 66 text lines.
The length in characters of each line is determined by the first text element placed in the
line (or 10cpi is selected if no text in this line), the font step (you can specify a Font Step
in the designer) of this text will determine the font size for that line (only one font size is
allowed for each line but multiple font styles can be combined in one line). If the text
element Font Step indicates By Size value, the engine will use the following table:
The text elements are placed vertically rounded to 1/6 inch, so the better way to design a
report for text output is set grid height to 1/6 inch that is 0.1666 inch or 0.42333 cms.
Also set the horz.grid size as the most common size of it, for example for a 10cpi report
set horz. grid to 0.1 inch or 0.254 cms. Also resize the section heights to multiples of
1/6 inch, you can do it automatically by selection the option in Edit menu.
Set horizontal page size correctly or at least narrower than the real page size (printer
capability), if you print a 132 column report in a 80 cols printer, the printer will skip two
lines for each report line.
The final output will be a number of lines formatted with the selected driver (escape
codes), or no formatting at all (PLAIN driver). Depending on the selected driver the last
line of each page will finish with a Form Feed instead a Line Feed.
Internal implementation
When the final output is created in memory, the engine send it to the printer in this way:
Microsoft Windows
A new print document is created with the Windows API, to disable the driver, the
document is queued as a RAW type document, so the text go to the printer throught the
selected port in printer configuration without processing in the printer driver. If oem
option is checked then the text is processed first with CharToOem API function.
Linux
The lines are saved to a temporary file, and using unix like interprocess comunication
(pipes) the engine calls lpr command line tool, if oem option is checked then the file is
processed first by the recode command line tool.
The -P printerqueue parameters are omited if the default printer is used. The -r will force
deletion of the temporary file after processing it, the -l indicates the lpr command to send
the file directly to the device without using any print filter, and the -J gives a job title for
the printer queue.
Drivers overview
This is a small guide to perform preprinted form filling. Usually you have a form, in
printed format, or pdf and you want to fill values in boxes provided by this form.
The background image will be placed in one section of our report so we can place items,
expressions, labels on top of it.
If the form is already printed, you should use a image scanner to obtain the
background image, check the dots per inch property of the scanner, you will place the
same value in dpi property in the section you place the image.
If the form is provided as pdf you should use a tool to convert it to a image file, each
page must be a separate image file, you will get a good result using Adobe Acrobat 6
professional.
Usually the best image format for the background image is a Windows Bitmap format, 8
bit color depth (indexed), if the report have the property prefered save format set to
binary/zlib, the bitmap will be stored in compressed format, make sure to check this
property before adding the background images.
If the images are real life photos the best compression can be acchieved with jpeg format.
2. Place items
After setting the background image property, you can drag & drop fields on top of the
image, the background image can appear also in preview or also printed, checking the
background style. You should set page margins to 0 if you scanned or exported the whole
image.
Here is a sample:
4. Final adjustments
By adjusting margins you can adjust output, if your want to print also the background you
don't need adjustments.
A sample result:
In memory datasets
There is a special database driver, Mybase, that will allow the use of in memory datasets.
• Read the dataset from a file a Mybase binary or XML formatted file (created by
TClientDataset component from Borland tools)
• Read the dataset from a plain text file, with the help of a field definition file, this
files are usually files with one line for each row and fixed size fields. There is a
wizard no create the field definition file.
• Sort the dataset by any field, with the Index Fields property you specify the
fields separated by ; symbol (CUSTNO;ORDERNO for example).
• Get the records from any other already defined dataset. You use the UNIONS list
to specify which datasets will be used to fill the in memory dataset, if you select
more than one dataset, the numer of fields and field types must be the same.
• Group the union, by selecting union grouping, the in memory dataset will by
grouped by the fields specified in the Index Fields property.
• Stablish master detail relationships, this is a filter based on fields of another
dataset. Use the Master Fields property combined with Index Fields property
to perform field relation equivalences.
Sample
Imagine we are reporting sales by customer but very detailed. We will use a subreport
with a group, customer number, the trick is that at the group header we want to print
total by customer, so expression evaluator sums will not work.
You can solve the problem by using linked querys, but this linked query will be executed
each time a CUSTNO changes in the main dataset, if there are 200 customers, 201 querys
will be executed (once for each custno and the main query).
To enhace performance we will execute 2 querys one for the detail and another for all
totals by customer.
No datasource needed, both querys will be executed only once to enhace performanc and
net bandwith.
Now to show the correct grand total (TOTALS.AMOUNT) for each customer at the
group header:
Master fields relates to field names in DETAIL, that will be used with IndexFields to
perform a filter in
INMEMTOTAL dataset. In this case the filter will result in only one row, but it's not
limited in any way.
For example a INMEMORY DATASET can contain lot of rows and the filter can reduce
the result set:
IndexFields: CUSTNO;ORDERNO
MasterFields: CUSTNO
Internal
Name Type Description
Name
Horizontal position for the component, this is relative for
Left PosX Twips the parent section position in the page, the left position can
be modified at run time because other properties like Align
Vertical position for the component, this is relative for the
Top PosY Twips parent section position in the page, the left position can be
modified at run time because other properties like Align
Align Align TRpPosAlign The alignment is used to move the component down or
right when the section resizes while the report is
processing
Name Description
None No align, default
The component will be placed at the right of
Right
the section
The component will be placed at the bottom
Bottom
of the section
Right/B The component will be placed at the right
ottom and the bottom of the section
* Twips are internally stored as an integer representing 1440 points per inchess, when
you are in the designer they are converted to your selected unit in preferences, cms or
inches.
Internal
Name Type Description
Name
Horizontal alignment for the text inside
the box defined by the component. The
text can be aligned Left (also None),
H.Alignment Aligment H.TextAlign
Right and Center. Bidi property can alter
the meaning of this property. Internally
stored as an integer.
Vertical alignment for the text inside the
box defined by the component. The text
V.Alignment VAlignment V.TextAlign
can be aligned top (also None), bottom
and center. Internally stored as an integer.
Font name (Type face family name) for
Microsoft Windows operating systems,
this property will be used when the engine
WFont Name WFontName WideString
runs in this operating system and the
driver uses system fonts, usually GDI and
Qt.
Font name (Type face family name) for
Linux operating systems, this property
will be used when the engine runs in this
LFont Name LFontName WideString
operating system and the driver uses
system fonts, usually using Qt printing or
display system.
Font when the result is a PDF file, the
generation of pdf files does not requires
PDF Font Type1Font TRpType1Font an X Server running in Linux, but can use
only one of the standard PDF fonts in
current implementation.
Font size in standard points unit, that is 72
Font size FontSize Integer
points=1 inchess
Font step for dot matrix output and text
Font step FontStep TRpSelectFontStep output with a printer driver selected, the
engine will select the nearest size
Font color, internally stored as a quad
Font Color FontColor Color
byte 0BGR integer
Combination of a set of possible effects
for the font: bold, italic, underline and
Font Style FontStyle Integer
strikeout, all the styles are compatible.
Internally stored as an Integer.
Left to right reading language support
(bidirectional). The Bidi property is stored
for each language in the report page setup.
Internally stored as a string list containing
the value for each language.
Name Description
Bidi No No Bidi support enabled
Bidi enabled, will print right to
Bidi
Bidi BidiModes BidiMode left text but no change in the
Partial
H.Alignment property is done
Bidi enabled, will print right to
Bidi
left text and will reverse the
Full
H.Alignment property
Subreport properties
A report contains at least one subreport, and a subreport contains at least one detail.
Section properties
Sumary
The sections are contained inside subreports, depending on the section type it will print
after the detail (group header), before the detail (group header), or in special places (page
headers and footers)
Sumary
Internal
Name Type Description
Name
rectangle, square, rounded rectangle, rounded
Shape Shape TRpShapeType square, ellipse, circle, horizontal line, vertical line,
oblique 1 and oblique 2
solid, dash, dot, dash-dot, dash-dot-dot, clear
Pen
PenStyle TPenStyle
Style
Clear means transparent pen
Pen
PenColor TColor Pen color as a RGB integer
Color
Pen Pen width in twips (0=minimum device width),
PenWidth TRpTwips
Width 1440 twips=1 inch
solid, clear, horizontal pattern, vertical pattern,
Brush
BrushStyle TRpBrushStyle diagonal pattern 1, diagonal pattern 2, cross pattern,
style
diagonal cross pattern, dense 1 to 7 patterns
Brush
BrushColor TColor Pen color as a RGB integer
Color
Internal
Name Type Description
Name
Draw Style DrawStyle TRpImageDrawStyle Value Meaning
Draws the image using the
Resolution property to determine
Crop
size, then cut the part of the image
outside the component size
Draws the image no using the
Stretch Resolution property but adapting
to the size of the component size
Full Draws the image using the
Resolution property to determine
size, then ignores component size,
you can use this property with
parent sectoin autoexpand
property to draw different image
sizes optimizing page space
Draws the image repeating it until
the component size is filled, this is
Tile used to obtain for example beatiful
backgrounds from small sized
bitmaps
The image can be embedded (Image
propery) or obtained throught this
expression property, the expression is
evaluated, if the expression result is a
binary database field will try to read the
Expression Expression WideString
image from there, see below the image
formats supported. If the field is a string
field or the result of evaluation is a string
the engine will try to load the image as a
file reference.
Embedded image, stored with the report
structure containing a image stream. When
Image Stream TStream embedding large images you should set
prefered save format in page setup to
binary/gzip to enhace performance.
Resolution of the image in pixels per inch
Resolution unit, the size of the bitmap and the
dpires Integer
(dpi) resolution will determine the final size
depending on the Draw Style property
Because Report Manager driver architechture, the image formats supported depends on
the output driver used, the server applications use the PDF driver.
Windows
Image type Windows QT Linux QT HTML PDF
GDI
TCLXReport TCLXReport TVCLReport TPDFReport
Windows Bitmap,
Yes Yes Yes Yes Yes
regular
Windows Bitmap, RLE Yes Yes Yes No No
Windows Bitmap, Yes Yes Yes Yes Yes
Monochrome
JPeg Image (any
Yes Yes Yes Yes Yes
method)
PNG Image Yes Yes No No No
XPM Images Yes Yes No No No
Gif Image No No No No No
Notes:
• The image files supported by the Report Servers (TCP and Web) are the same as
the TPDFReport.
• The text ourput driver does not support any image or drawing
• The TVCLReport and TCLXReport components can extend graphic file formats
by calling from Delphi/Builder/Kylix source code the RegisterGraphicFileFormat
function, this will allow loading of different file image formats like GIF or PNG
Native pdf output is implemented, you may experiment that the pdf output is lighting fast
compared to Acrobat Distiller and other print drivers that output pdf, this is because the
translation is done directly from Report Manager native format to Adobe PDF format.
To enable truetype font embedding in a report, at the designer select Edit->Select all
texts, then at object inspector select Truetype font option in PDF Font property.
But you may take consideration the following issues and limitations:
Linux does not have a standard font service in the operating system itself, instead of this
it has libraries that provides some services, and of course there is the X library.
There are funtions in the X protocol to retrieve sizing infomation about installed fonts (in
the server), but this information is not complete, and there is no way to retrieve full font
data (the font file), some work have been done, there is a project called X print server in
early stages, this requires the installation of a X print server process, and X print client
libraries, but this is not the good way.
There is also a font information library Xft, the good thing is that it can work optionally
with font servers, the bad thing is that does not provide enought information (font file
data). Anyway it depends on a running X server (bad thing for console applications).
Applications like OpenOffice take the font information from the computer executing the
X client program not the X server so the X server protocol probably does not allow to
work with sever side installed fonts.
Another library providing font services Fontconfig, font config provides font
informantion and font matching services, but does not provide enought information (char
sizes and full font data), it's designed as very basic font information system.
But a great library is usually available in Linux systems, freetype library, Report
Manager implementation is done using the version 2.1.8, but it's compatible with 2.X
version, you will find it as freetype2 in your linux distribution , and the shared object
needed is libfreetype.so. Usually is installed by default, probably minimal console Linux
installations does not install it, Report Manager will need it only if you use TrueType font
embedding or linking.
Because freetype allows the access to Type1 fonts information, the Type1 fonts can be
also used in a pdf but only linking is available, because of the requirements of PDF
specification there is additional work to embed Type1 fonts.
Unfortunatelly the freetype library does not implement font maching (and font
information file catching), bug at least it can provide full information about font files,
also extended information and can also render fonts. So simple font matching is done in
code at Report Manager engine.
Report Manager uses /etc/fonts/fonts.conf file to search for font directories, the font
information is cached the first time a TrueType font embedding is required, but to
retrieve this information costs reading all font files and get information about the fonts
(font names, styles...) to perform font maching. This process is done once, but it's
expensive when you execute only one report (printreptopdf command line tool for
example). Note that this overhead will not appear if you don't embbed PDF fonts.
Depending on the number of fonts you have installed it will be not noticeable.
The good thing is that you don't need a X server generate the pdfs with TrueType
embedding.
The font maching algorith inside Report Manager is really simple, search for the same
family name and style, else search for a similiar family name, else get a default font and
apply the style. Note that Fontconfig does not force font maching to his own unique way
like Microsoft Windows do (give few options), but you must provide preferences about
the most important features of the font to match. Maybe a future enhacement to use
FontConfig for font matching but for now it only adds a dependence to enhace a little the
matching algorithm (maybe only font information caching is only the reason to use it).