Goto:
4C Home
|
4C Docs
|
PDFReport Home
4C PDFReport - Getting Started
4C PDFReport - Getting Started
To get started using the 4C PDFReport class to generate PDF documents it is important
to get familiar with several concepts and changes to some 4C system files and programs
as well as some new Global and System PCLs
-
Any application that will use the PDFReport class will need to have it's own
sys.pdf_font and sys.pdf_dftype data files in the application directory.
Default sys.pdf_font and sys.df_dftype data files are included in the skel.df isdump
file in HOME_4C/lib.
You can also just copy them from either HOME_4C/system or HOME_4C/demo if needed.
You can and should modify the data in these files to match your needs.
Here is a more detailed defintion of both sys.pdf_font and sys.pdf_dftype
-
sys.pdf_font -
This file species which fonts your application can use in PDFReports and the type of the
font.
-
font_name -
An application defined font name that your application will use
-
font_type -
One of "Internal", "TrueType", "Type1" or "None"
-
font_intname -
If the font_type is internal, then it is one of the 14 internal name choices allowed.
There will be a search option allowed when defining an Internal sys.pdf_font.
If the font_type is TrueType you must specify a fullpath to the "ttf" font file in font_path[0].
If the font_type is Type1 you need to specify the fullpath to the "afm" font file in font_path[0]
and the fullpath to the "pfb" file in font_path[1].
If the font_type is none then there is no font specified and it can be used in cases where
the display field does not use a font such as an image display field.
-
font_path -
Used for TrueType and Type1 fonts.
-
font_encoding -
Either "Standard" or "UTF8"
If you download and save TrueType or Type1 fonts you may want to save them in an application
specific directory under HOME_4C/fonts.
If you do then you can use the env var ${FC_FONTS}/<dir>/<fontfile> in the path names.
-
sys.pdf_dftype -
This file specifies defaults that the display field will use including font, ptsz, underline style,
positioning within the display fields "rectangle" as well as fg/bg and border colors.
-
pdft_dftype - An application defined name that is used to select the values for some
properties of a PDFReport display field
-
pdft_fontname - The Application sys.pdf_font.font_name to use as a default for this
pdft_type
-
pdft_fontptsz - The point size to use as a default for display fields using this
pdft_type
-
pdft_ulstyle - The underline style to use. This is one of "Text", "Rect" or "None"
-
Text - means that the text of display field will be underlined but the rest of the
area occupied by the display field rectangle will not be underlined.
-
Rect - The text of the display is underlined and the underline extends from the left of
the "rectangle" used by the display all the way to the right of the display field "rectangle".
The left and right of the display field rectangle are defined as the left and right border area
of the display field "rectangle".
-
None - No underlining is applied to the display field
-
pdft_halign - How the text of a display field is horizontally aligned in the display field
"rectangle".
This can be one of "Left", "Right" or "Center" and works similarly to the way s_dftype.sdt_halign
works
-
pdft_valign - How the text of a display field is vertically aligned in the display field
"rectangle".
This can be one of "Top", "Center" or "Bottom" and works similarly to the way s_dftype.sdt_valign
works
-
pdft_fgrgb - R:G:B value for text in the display field
-
pdft_bgrgb - R:G:B value for the background of the display field.
-
pdft_borderrgb - R:G:B value for the border of the display field.
-
pdft_desc - A short description of how the pdft_dftype is used or meant to be used.
-
Other 4cSys file and program changes include
-
sys.program -
The following fields were added to the sys.program file definition and are available for
modification on the Program Characteristics screen for PDFReport class programs.
-
sys.pr_papersize -
The paper size to use for the PDFReport.
This can be any of the std papersizes all PDF documents support.
There is a drop down list that you can select from.
Currently this can only be changed in the Program Characteristics and is not
a run runtime changeable option.
-
sys.pr_pdftmrgn
-
sys.pr_pdfbmrgn
-
sys.pr_pdflmrgn
-
sys.pr_pdfrmrgn
The default top, bottom, left and right margins in pts.
-
sys.pr_pdfscale -
A y/n flag to specify if the PDF should request the viewer to not scale the PDF.
This may be useful in cases where you are printing on a pre printed form.
-
sys.pr_linewidth -
The line width in pts to use in line drawing.
This defaults to .75
-
sys.pr_ulheight -
The height in pts to use when drawing underlines.
-
sys.pr_orient -
The default orientation to use for the PDF dcoument.
It can be either Landscape or Portrait and initially is set to Portrait.
Currently, the PDF default values set in the Program Characteristics are not modifiable at run
time but the sys.pdf_setoption() System PCL could easily allow some changes if needed.
-
sys.dpy_field -
Some of the following fields were added to sys.dpy_field and are modifiable in the Display Fields
of a PDFReport class program.
Others were already defined in sys.dpy_field but are also used in PDFReport programs.
-
sys.df_pdfdftype -
The sys.pdf_dftype.pdft_dftype to default the display field values from.
All values defaulted from sys.pdf_dftype can be overriden in the display field options.
Changing sys.df_pdfdftype will reset all the values defaulted to values from the newly
specified sys.df_pdfdftype.
Changing values in the sys.pdf_dftype file do not affect any currently defined display fields
in and PDFReport class program.
-
sys.df_fontname -
In PDFReport programs this must a font_name defined in sys.pdf_font for the application
-
sys.df_fontptsz -
The pt size to use with the font for this display field.
-
sys.df_halign -
How to align the display field horizontally within it's rectangle.
-
sys.df_valign -
How to align the display field vertically within it's rectangle.
-
sys.df_ulstyle -
The style if any to use for underlining the display field.
-
sys.df_fgrgb, sys.df_bgrgb and sys.df_borderrgb -
The RGB values to use when displaying the dfld.
-
sys.df_rectleft -
This is a 4C float var that
specified the leftmost start position to use for positioning the display field on the page.
Col 0 is the first column of the printable page and columns are 12pts in width.
-
sys.df_recttop -
This is a 4C float var that
specified the top most start position to use for positioning the display field on the page.
Row 0 is the first row of the printable page and rows are 12pts in height.
-
sys.df_rectwidth -
The width to use for the display field rectangle.
If not set then 4C will calculate it based on the text to display and the font used.
-
sys.df_rectht -
The height to use for the display field rectangle.
If not set then 4C will calculate it based on the text to display and the font used.
-
sys.df_lblpdft -
The sys.pdf_dftype to use for setting defaults for any top/side label specified for the
display field.
-
sys.df_lblfont -
The font_name to use for any top/side label.
-
sys.df_lblptsz -
The pt size to use for any top/side label
-
sys.df_lblrgb -
The FG RGB value to use for any top/side label
-
sys.df_lblhalign -
How to align the text of a Top label horizontally above the display field.
-
sys.df_lblvalign -
How to align the text of a Side label vertically to the left of the display field.
-
sys.df_lblulflag -
A flag to indicate if the Side/Top label should be underlined.
From the Display Field screen of a PDFReport you can select a context menu option
to "Test PDF" which will allow you to see how a single report will display on the page.
You can change options on the "Test PDF" screen without modifying the original PDFReport program.
-
sys.pdf_info -
This file is used to retrieve information about the current PDFReport running and
sometimes to set some options for the PDFReport.
It is only ever used in momory and never created on disk.
-
The following Global PCLs can be used in PDFReport programs
-
sys.pdf_drawgrid() -
This will draw a grid on the current PDFReport page using the current PDF page settings.
The 4cSys program for viewing one report of a PDFReport program allows you to specify
whether to draw a grid or not.
This should be helpful during development.
-
sys.pdf_save(<savetopath>) -
Save the current PDFReport to the fullpath specified in savetopath.
After saving the PDFReport can still be modified and have more pages added to it.
-
sys.pdf_view() -
Copy the current PDFReport to the client FC_SESSION directory and open
call sys.cl_open() to open it in the client systems PDF viewer program.
-
sys.pdfinfo_view() -
Display info about the current PDFReport program.
This may be useful in debugging.
-
The following System PCLs can be used in PDFReport programs
-
sys.run_rpt
-
sys.pdf_getinfo
-
sys.pdf_getoption
-
sys.pdf_setoption
-
sys.pdf_drawline
-
sys.pdf_drawrect
-
sys.pdf_drawimage
-
sys.pdf_addpage
-
sys.pdf_setfont
-
sys.pdf_textwrite
-
sys.pdf_setdfrgb
Next - PDFReport examples
Back to Top