Changes between Version 24 and Version 25 of Docs/825gen2/Dev/Networking/NetworkPrintingCUPS
- Timestamp:
- 01/19/24 16:44:46 (10 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Docs/825gen2/Dev/Networking/NetworkPrintingCUPS
v24 v25 383 383 #include "cairobmp.h" 384 384 385 // A4 width, height in points, from GhostView manual:386 // http://www.gnu.org/software/gv/manual/html_node/Paper-Keywords-and-paper-size-in-points.html387 // #define WIDTH 595388 // #define HEIGHT 842389 // #define WIDTH 320390 385 #define WIDTH 480 391 386 #define HEIGHT 500 392 393 387 394 388 int main(int argc, char **argv) { … … 402 396 printf("tmpFilename [%s]\n", tmpFilepath); 403 397 404 // cairo_surface_t* surface = cairo_ps_surface_create(tmpfilename, WIDTH, HEIGHT);405 398 cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_A1, WIDTH, HEIGHT); 406 399 printf("after surface create %d\n", cairo_surface_get_type(surface)); 407 400 cairo_t *context = cairo_create(surface); 408 401 409 LoadBMPToSurface( /*"/usr/images/bird.bmp"*/"/usr/images/cardinal_logo.bmp", surface, 0, 0);402 LoadBMPToSurface("/usr/images/cardinal_logo.bmp", surface, 0, 0); 410 403 411 404 // draw some text … … 427 420 cairo_set_dash(context, pattern, 2, 0); 428 421 cairo_set_line_width(context, 5); 429 cairo_rectangle(context, 5, 105, /*280*/400, 300);422 cairo_rectangle(context, 5, 105, 400, 300); 430 423 cairo_stroke(context); 431 424 … … 439 432 cairo_surface_destroy(surface); 440 433 441 const char *printerName = cupsGetDefault(); 442 printf("printer [%s]\n", printerName); 443 444 // cupsGetDefault is returning NULL for some reason, set printerName manually 445 printerName = "STARSK1_311"; 434 const char *printerName = "STARSK1_311"; 446 435 n = cupsPrintFile(printerName, tmpFilepath, "cairo PS", 0, NULL); 447 436 // return value is job ID 448 437 printf("cupsPrintFile result %d\n", n); 449 438 450 //unlink(tmpFilepath); // TODO don't delete file to allow testing439 //unlink(tmpFilepath); // TODO This is commented to allow testing - after testing is done uncomment so after print the tmp file will be deleted 451 440 452 441 return 0;