Jump to content

PrintGraph Extra Documentation: Difference between revisions

From EDM2
Ak120 (talk | contribs)
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
Setting up a print job requires several steps:  
Setting up a print job requires several steps:  
* Load the functions with PrtGRxLoadFuncs
* Load the functions with PrtGRxLoadFuncs
* Intialise the printing environment with PrtGRxInit
* Initialise the printing environment with PrtGRxInit
* Choose a printer with PrtGRxPrinterDialog
* Choose a printer with PrtGRxPrinterDialog
* If necessary set the job properties with PrtGrxJobProperties
* If necessary set the job properties with PrtGrxJobProperties
Line 16: Line 16:
* Destroy the printer object with PrtGRxTerm
* Destroy the printer object with PrtGRxTerm
* If you wish, drop the functions with PrtGRxDropFuncs
* If you wish, drop the functions with PrtGRxDropFuncs
Since headers and footers often contain constants like the date or the document title and variables like the page number, the texts defined for these can contain special formatting characters.
Since headers and footers often contain constants like the date or the document title and variables like the page number, the texts defined for these can contain special formatting characters.


Line 22: Line 21:
All the input parameters that denote positions are by default in millimetres or 1/10 inch depending on the Measures property. You can convert from inches using the formula:
All the input parameters that denote positions are by default in millimetres or 1/10 inch depending on the Measures property. You can convert from inches using the formula:
  mm = 254 * inch
  mm = 254 * inch
All the line widths are defined in TWIPS:
All the line widths are defined in TWIPS:
  1 Point = 20 TWIPS
  1 Point = 20 TWIPS
  1 mm = 56.7 TWIPS (rounded to 57 for internal calculation)
  1 mm = 56.7 TWIPS (rounded to 57 for internal calculation)
 
;Warning:If you wish to print several documents concurrently (i.e. in parallel threads) you must initialise and terminate the environment for each thead with PrtGRxInit and PrtGRxTerm.
'''Warning:'''
If you wish to print several documents concurrently (i.e. in parallel threads) you must initialise and terminate the environment for each thead with PrtGRxInit and PrtGRxTerm.


==Formatting Characters==
==Formatting Characters==
To help define header and footer texts with PrtGRxSetFooter and PrtGRxSetHeader the following special formatting flags are defined:
To help define header and footer texts with PrtGRxSetFooter and PrtGRxSetHeader the following special formatting flags are defined:
<PRE>
{|class="wikitable"
┌────────┬────────────────────────────────────────────────────────┐
!$
│$      │If followed by one of the other characters in this table│
|If followed by one of the other characters in this table it indicates a formatting character follows, otherwise it is taken as a literal '$'
│        │it indicates a formatting character follows, otherwise
|-
│        │it is taken as a literal '$'                           │
!l
├────────┼────────────────────────────────────────────────────────┤
|Left align the following text
│l      │Left align the following text                           │
|-
├────────┼────────────────────────────────────────────────────────┤
!r
│r      │Right align the following text                         │
|Right align the following text
├────────┼────────────────────────────────────────────────────────┤
|-
│c      │Centre the following text                               │
!c
├────────┼────────────────────────────────────────────────────────┤
|Centre the following text
@       │Insert the current date formatted acording to the system│
|-
│        │settings. This is read every time a job is started; so
!@
│        │you can change the date format from job to job in the   │
|Insert the current date formatted according to the system settings. This is read every time a job is started; so you can change the date format from job to job in the same session.
│        │same sesssion.                                         │
|-
├────────┼────────────────────────────────────────────────────────┤
!?
?       │Insert the current time ( taken when the job is opened)
|Insert the current time (taken when the job is opened) formatted according to the system settings. This is read every time a job is started; so you can change the time format from job to job in the same session.
│        │formatted acording to the system settings. This is read
|-
│        │every time a job is started; so you can change the time
! !
│        │format from job to job in the same sesssion.           │
|Insert the current date and time (taken when the job is opened) formatted according to the system settings. This is read every time a job is started; so you can change the time format from job to job in the same session.
├────────┼────────────────────────────────────────────────────────┤
|-
!       │Insert the current date and time ( taken when the job is│
!#
│        │opened) formatted acording to the system settings. This
|insert the current page number (always Arabic)
│        │is read every time a job is started; so you can change
|-
│        │the time format from job to job in the same sesssion.   │
!
├────────┼────────────────────────────────────────────────────────┤
¦ or |
#       │insert the current page number (always arabic)         │
|Insert the title of the document (see PrtGRxOpenPrintJob)
├────────┼────────────────────────────────────────────────────────┤
|}
│¦ or | │Insert the title of the document (see PrtGRxOpenPrintJob│
 
│        │)                                                       │
└────────┴────────────────────────────────────────────────────────┘
</PRE>
 
===Example===
===Example===
  '$¦$rpage $#' would give:  
  '$¦$rpage $#' would give:
   
   
  '''Document Title                                      page 1'''  
  '''Document Title                                      page 1'''


  '$r@ page $#' would give (where date is defined as ISO with '/' separator):  
  '$r@ page $#' would give (where date is defined as ISO with '/' separator):
   
   
                                                           '''1995/03/18 page 1'''  
                                                           '''1995/03/18 page 1'''
 
;Warning:Formatting characters only apply to the page and table header and page footer texts.
'''Warning:'''
Formatting characters only apply to the page and table header and page footer texts.  


==Fill Styles==
==Fill Styles==

Latest revision as of 22:40, 30 October 2022

For more information visit PrintGraph.

Setting up a print job

Setting up a print job requires several steps:

  • Load the functions with PrtGRxLoadFuncs
  • Initialise the printing environment with PrtGRxInit
  • Choose a printer with PrtGRxPrinterDialog
  • If necessary set the job properties with PrtGrxJobProperties
  • Set the page margins with PrtGRxSetMargins
  • Set up the aspect of header with PrtGRxSetHeaderMode
  • Set up any header text with PrtGRxSetHeader
  • Set up any footer with PrtGRxSetFooter
  • Open the print job with PrtGRxOpenPrintJob
  • Print your texts, tables, bitmaps etc.
  • Close the print job with PrtGRxClosePrintJob
  • Destroy the printer object with PrtGRxTerm
  • If you wish, drop the functions with PrtGRxDropFuncs

Since headers and footers often contain constants like the date or the document title and variables like the page number, the texts defined for these can contain special formatting characters.

Note

All the input parameters that denote positions are by default in millimetres or 1/10 inch depending on the Measures property. You can convert from inches using the formula:

mm = 254 * inch

All the line widths are defined in TWIPS:

1 Point = 20 TWIPS
1 mm = 56.7 TWIPS (rounded to 57 for internal calculation)
Warning
If you wish to print several documents concurrently (i.e. in parallel threads) you must initialise and terminate the environment for each thead with PrtGRxInit and PrtGRxTerm.

Formatting Characters

To help define header and footer texts with PrtGRxSetFooter and PrtGRxSetHeader the following special formatting flags are defined:

$ If followed by one of the other characters in this table it indicates a formatting character follows, otherwise it is taken as a literal '$'
l Left align the following text
r Right align the following text
c Centre the following text
@ Insert the current date formatted according to the system settings. This is read every time a job is started; so you can change the date format from job to job in the same session.
? Insert the current time (taken when the job is opened) formatted according to the system settings. This is read every time a job is started; so you can change the time format from job to job in the same session.
! Insert the current date and time (taken when the job is opened) formatted according to the system settings. This is read every time a job is started; so you can change the time format from job to job in the same session.
# insert the current page number (always Arabic)
¦ or |
Insert the title of the document (see PrtGRxOpenPrintJob)

Example

'$¦$rpage $#' would give:

Document Title                                       page 1
'$r@ page $#' would give (where date is defined as ISO with '/' separator):

                                                         1995/03/18 page 1
Warning
Formatting characters only apply to the page and table header and page footer texts.

Fill Styles

Several of the Printer functions refer to a fill style. You can see the effect of a style for any printer by running the DEMO program and printing the box styles option. The numbers you pass to any of these functions is translated into a PATSYM_????? constant, and the output is, to a certain extent, device dependent. For an idea of what you will obtain see the pictures below.