Feature #12189
PDF printer: PUT CONTROL, control bytes and PAGE-SIZE in redirected printer output
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:
0%
billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:
History
#1 Updated by Greg Shah 7 days ago
Problem¶
Character-mode reports written with OUTPUT TO PRINTER (or OUTPUT TO PRINTER VALUE(name)) commonly assume a line printer:
OUTPUT TO PRINTER VALUE(cPrinter) PAGE-SIZE 60. PUT CONTROL cInitCodes. /* e.g. CHR(27) + "E" + CHR(27) + "(s16.66H" */ FOR EACH ...: DISPLAY ... WITH FRAME f-detail. END. PUT CONTROL CHR(12). OUTPUT CLOSE.
In FWD's GUI client, printer output becomes a PDF delivered to the user's browser. How that PDF treats PUT CONTROL data, raw control characters written with PUT UNFORMATTED, form feeds, and PAGE-SIZE is currently not defined: escape sequences meant for the printer can appear in the PDF as stray characters, and a very large PAGE-SIZE (for example 999, used to mean "unpaged" for continuous stationery) can produce one very long page or unexpected page breaks.
Work¶
- Establish OpenEdge's behaviour for the stream itself (what reaches the printer for
PUT CONTROL,PAGE-SIZE,PAGE,CHR(12)in data,PAGEDandPAGE-SIZE 0), as the baseline for pagination. - Define and implement the PDF printer's handling of control data:
PUT CONTROLoutput is not rendered as text;- common printer command languages (PCL and ESC/P escape sequences, and ESC/POS for receipt printers) are recognised and dropped as whole sequences, not byte by byte, so their parameters do not leak into the text;
- other non-printable characters are dropped;
- a form feed starts a new PDF page;
- the behaviour is configurable (drop, or keep as visible placeholders for debugging).
- Pagination: honour
PAGE-SIZEfor page breaks, headers and footers exactly as the 4GL computes them. For sizes larger than the physical page, break at the physical page length (configurable), and document the behaviour. - Pitch and font hints: where a recognised escape sequence selects a condensed pitch or landscape, optionally apply it to the PDF page (configurable), so that wide reports fit.
- Document the behaviour in the printing documentation.
Testcases¶
- A report with PCL initialisation codes, PAGE-SIZE 60, headers and footers: the PDF has the same page breaks as OpenEdge's printed output and no stray characters.
PAGE-SIZE 999andPAGE-SIZE 0reports longer than one physical page.- Form feeds in
PUT UNFORMATTEDdata; ESC/POS sequences (cash drawer kick, cut) written to a printer stream. - The same programs with the "keep placeholders" setting.