Changes between Version 24 and Version 25 of Docs/825gen2/Dev/Networking/NetworkPrintingCUPS


Ignore:
Timestamp:
01/19/24 16:44:46 (10 months ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/825gen2/Dev/Networking/NetworkPrintingCUPS

    v24 v25  
    383383#include "cairobmp.h"
    384384
    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.html
    387 // #define WIDTH  595
    388 // #define HEIGHT 842
    389 // #define WIDTH 320
    390385#define WIDTH 480
    391386#define HEIGHT 500
    392 
    393387
    394388int main(int argc, char **argv) {
     
    402396        printf("tmpFilename [%s]\n", tmpFilepath);
    403397
    404         // cairo_surface_t* surface = cairo_ps_surface_create(tmpfilename, WIDTH, HEIGHT);
    405398        cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_A1, WIDTH, HEIGHT);
    406399        printf("after surface create %d\n", cairo_surface_get_type(surface));
    407400        cairo_t *context = cairo_create(surface);
    408401
    409         LoadBMPToSurface(/*"/usr/images/bird.bmp"*/"/usr/images/cardinal_logo.bmp", surface, 0, 0);
     402        LoadBMPToSurface("/usr/images/cardinal_logo.bmp", surface, 0, 0);
    410403
    411404        // draw some text
     
    427420        cairo_set_dash(context, pattern, 2, 0);
    428421        cairo_set_line_width(context, 5);
    429         cairo_rectangle(context, 5, 105, /*280*/ 400, 300);
     422        cairo_rectangle(context, 5, 105, 400, 300);
    430423        cairo_stroke(context);
    431424
     
    439432        cairo_surface_destroy(surface);
    440433
    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";
    446435        n = cupsPrintFile(printerName, tmpFilepath, "cairo PS", 0, NULL);
    447436        // return value is job ID
    448437        printf("cupsPrintFile result %d\n", n);
    449438
    450         //unlink(tmpFilepath); // TODO don't delete file to allow testing
     439        //unlink(tmpFilepath); // TODO This is commented to allow testing - after testing is done uncomment so after print the tmp file will be deleted
    451440
    452441        return 0;