CAPS Universe documentation  1.0.4
All you need to know to be successful
Reference Printing Provider (libcapsraster)

Preparation

The preparation to run the Reference Printing Provider depends on the build configuration of the CAPS universe in your system. If you have built the DEBUG variant, libcapsbase supports some 'short cuts'. If not, you need the redirection variant.

If unsure, run the capsinfo tool with the parameter -v. If it mentions some environment variables to overwrite directories, you're running the DEBUG variant.

Using system INI files

If you need the redirection variant (you also need root permissions):

Note
Ask the tool capsinfo where the CAPS Printer Device Database Directory, the CAPS Printer Driver Database Directory and the CAPS Document Storage Directory are.

Using local INI files

If you can use the 'short cuts', you can define the directories of required INI files via environment variables.

If you build in-tree:

CAPS_PRINTER_DRIVER_DB_DIR=test/driver_db_dir CAPS_PRINTER_DEVICE_DB_DIR=test \
./reference-printing-provider --driver-ini=reference.ini --parameter-dir=device_param_dir 3<>/tmp/prn-orig.dat

If you build out-of-tree:

CAPS_PRINTER_DRIVER_DB_DIR=../libcapsraster/test/driver_db_dir CAPS_PRINTER_DEVICE_DB_DIR=../libcapsraster/test \
./reference-printing-provider --driver-ini=reference.ini --parameter-dir=device_param_dir 3<>/tmp/prn-orig.dat

You need to adapt the paths to these directories to your system setup.

At the end, you should have a printer known to the printing coordinator:

capsprinter list
'frieselfrasel'

Or:

capsprinter list -v
name: 'frieselfrasel'
description: 'Reference Printing Provider'
location: 'Inside your CPU'
state: Idle (ID 3)
message: 'Ready'

You now can "print" jobs on this printer. In the following example, from the libcapsraster sources:

capsdoprint test/format-a4-portrait.pdf

Since you started the Reference Printing Provider in a console, it now starts to output a large amount of debug info.

Got printing job 1777728552820175516. Going to process it...
libcapsraster:ensure_one_page_range:133: Page-Range: printing the whole document
libcapsraster:job_printing_defaults_log:1546: Job settings
libcapsraster:job_printing_defaults_log:1547: - copies to print: 1
libcapsraster:job_printing_defaults_log:1553: - auto-rotation activated
libcapsraster:job_printing_defaults_log:1562: - alignement: 0
libcapsraster:caps_rstr_select_by_mime_type:166: Selecting PDF rasterizer for this job
libcapsraster:job_page_count_calculate:212: Media count prediction: printing 1 media in a single turn, from a document with 1 pages
libcapsraster:handle_initial_page:151: Printing document once
Job 1777728552820175516 attached to the rasterizer
libcapsraster:job_page_get_next:177: Beginning the document with page 1
libcapsraster:mupdf_page_get_next:290: Medium size according to the PDF: 419.530 x 595.280 pts
libcapsraster:mupdf_page_get_next:297: Starting with a raster area of: 0.000/0.000 - 419.530/595.280 pts
libcapsraster:mupdf_page_get_next:303: Resulting into an area of the size: 419.530 x 595.280 pts
libcapsraster:medium_format_name_and_size_adapt:307: Intended medium size: 'a5' with 419.528 x 595.276 pts in portrait
libcapsraster:caps_rstr_page_rasterize:383: Start page rasterizing...
libcapsraster:print_rect:73: Media Rectangle: 595.28,841.89
libcapsraster:print_area:68: Media Print Area: 11.34,56.69 <-> 583.94,799.37
libcapsraster:print_rect:73: Media Print Size: 572.60,742.68
libcapsraster:print_rect:73: Source Print Size: 419.53,595.28
libcapsraster:print_area:68: Original margins: 11.34,56.69 <-> 11.34,42.52
libcapsraster:print_area:68: Rotated margins: 11.34,56.69 <-> 11.34,42.52
libcapsraster:print_area:68: Additionally scaled rotated margins: 11.34,56.69 <-> 11.34,42.52
libcapsraster:select_area_from_source:246: Use the full source width (419.53), due to larger destination
libcapsraster:select_area_from_source:259: Use the full source length (595.28), due to larger destination
libcapsraster:select_area_from_source:275: Nothing to consider at horizontal margins
libcapsraster:select_area_from_source:283: Nothing to consider at vertical margins
libcapsraster:print_rect:73: Rotated and scaled Print Rectangle: 595.28,841.89
libcapsraster:print_rect:73: Rotated and scaled Printable Rectangle: 572.60,742.68
libcapsraster:print_area:68: (Rotated) Source Area: 0.00,0.00 <-> 419.53,595.28
libcapsraster:print_rect:73: Final Raster Rectangle: 419.53,595.28
libcapsraster:print_rect:73: Final Raster Rectangle scaled: 419.53,595.28
libcapsraster:print_rect:73: Ready for Media Rectangle: 595.28,841.89
libcapsraster:page_setup:856: Document placing result is:
libcapsraster:page_setup:857: Destination medium size 595.276/841.890 points
libcapsraster:page_setup:858: Destination medium imageable area 11.339/56.693 … 583.937/799.370 points
libcapsraster:page_setup:861: Destination medium imageable size 572.598/742.677 points
libcapsraster:page_setup:864: Source intended print size 419.530/595.280 points
libcapsraster:page_setup:866: Mapping information is:
libcapsraster:page_setup:868: Raster x offset in destination medium 87.873 points
libcapsraster:page_setup:869: Raster y offset in destination medium 130.391 points
libcapsraster:mupdf_page_rasterize:421: Rasterizing page 1...
libcapsraster:mupdf_page_rasterize:439: Rasterizing page 1 done
libcapsraster:mupdf_page_rasterize:440: Resulting raster size is: 1748 x 2480 dots
libcapsraster:caps_rstr_raster_get:455: Post raster result is:
libcapsraster:caps_rstr_raster_get:456: Full Medium Dimesion: 2480 by 3508 dots
libcapsraster:caps_rstr_raster_get:457: Plain Raster Dimension: 1748 by 2480 dots
libcapsraster:caps_rstr_raster_get:458: Raster line stride 1748 bytes
libcapsraster:caps_rstr_raster_get:459: Dot size is: 1 bytes
libcapsraster:caps_rstr_raster_get:460: Dot color format: 4
libcapsraster:caps_rstr_raster_get:461: Buffer points to: 0x7fef2df06800
libcapsraster:caps_rstr_raster_get:462: Left/right margins: 47/47
libcapsraster:caps_rstr_raster_get:463: Top/Bottom margins: 177/236
Going to print page 1…done
Job 1777728552820175516 detached from the rasterizer
Job 1777728552820175516 done
static int mupdf_page_get_next(struct caps_rasterizer *rstr)
Definition: backend-mupdf.c:257
static int mupdf_page_rasterize(struct caps_rasterizer *rstr, const struct caps_rstr_page *page_conf, struct raster_adapt_preparation *setup)
Definition: backend-mupdf.c:387
unsigned job_page_get_next(struct document_desc *job, unsigned cpage)
Definition: doc-page-iterator.c:150
unsigned job_page_count_calculate(struct document_desc *job, unsigned pgs)
Definition: doc-page-iterator.c:166
void page_setup(struct document_desc *job, struct raster_adapt_preparation *setup, const struct caps_rstr_page *page)
Definition: doc-page-preparation.c:686
static void print_rect(const char *s, struct caps_rect r)
Definition: doc-page-preparation.c:75
static struct caps_area select_area_from_source(struct caps_rect source_sz, struct caps_rect media, struct caps_rect ptr, struct caps_area m)
Definition: doc-page-preparation.c:221
static void print_area(const char *s, struct caps_area a)
Definition: doc-page-preparation.c:70
static void ensure_one_page_range(struct caps_var_table *tab)
Definition: doc-parameter-processing.c:125
static void job_printing_defaults_log(const struct document_desc *job)
Definition: doc-parameter-processing.c:1816
int caps_rstr_raster_get(struct caps_rasterizer *rndr, struct caps_rstr_raster *raster_desc)
Definition: libcapsraster.c:405
int caps_rstr_page_rasterize(struct caps_rasterizer *rstr, const struct caps_rstr_page *page)
Definition: libcapsraster.c:375
void handle_initial_page(struct document_desc *job, unsigned pcnt)
Definition: libcapsraster-helper.c:96
static void medium_format_name_and_size_adapt(struct caps_rstr_page_desc *pg_desc)
Definition: libcapsraster.c:297
static int caps_rstr_select_by_mime_type(struct caps_rasterizer *rstr)
Definition: libcapsraster.c:136