summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-05-22 17:12:43 +0100
committerRobin Watts <robin.watts@artifex.com>2013-06-08 21:56:58 -0400
commit60005383aae11f8b8fabd8926e439e7f0bdc29de (patch)
treee8127354528a2b5778e615359e1c074d3daabc57 /apps
parentb580657f6cf727a01248254fc11952a6b611c1d2 (diff)
downloadmupdf-60005383aae11f8b8fabd8926e439e7f0bdc29de.tar.xz
Simple PCL output
Mono only for now. Copy the appropriate fz_pcl_options for the printer required and pass that to fz_write_pcl_bitmap. Add pcl output to mudraw - .pcl produces laserjet 4 compatible pcl.
Diffstat (limited to 'apps')
-rw-r--r--apps/mudraw.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/apps/mudraw.c b/apps/mudraw.c
index 5b83f353..cab25ac0 100644
--- a/apps/mudraw.c
+++ b/apps/mudraw.c
@@ -12,7 +12,7 @@
enum { TEXT_PLAIN = 1, TEXT_HTML = 2, TEXT_XML = 3 };
-enum { OUT_PNG, OUT_PPM, OUT_PNM, OUT_PAM, OUT_PGM, OUT_PBM, OUT_SVG, OUT_PWG };
+enum { OUT_PNG, OUT_PPM, OUT_PNM, OUT_PAM, OUT_PGM, OUT_PBM, OUT_SVG, OUT_PWG, OUT_PCL };
enum { CS_INVALID, CS_UNSET, CS_MONO, CS_GRAY, CS_GRAYALPHA, CS_RGB, CS_RGBA };
@@ -31,7 +31,8 @@ static const suffix_t suffix_table[] =
{ ".pam", OUT_PAM },
{ ".pbm", OUT_PBM },
{ ".svg", OUT_SVG },
- { ".pwg", OUT_PWG }
+ { ".pwg", OUT_PWG },
+ { ".pcl", OUT_PCL }
};
typedef struct
@@ -71,7 +72,8 @@ static const format_cs_table_t format_cs_table[] =
{ OUT_PGM, CS_GRAY, { CS_GRAY, CS_RGB } },
{ OUT_PBM, CS_MONO, { CS_MONO } },
{ OUT_SVG, CS_RGB, { CS_RGB } },
- { OUT_PWG, CS_RGB, { CS_MONO, CS_GRAY, CS_RGB } }
+ { OUT_PWG, CS_RGB, { CS_MONO, CS_GRAY, CS_RGB } },
+ { OUT_PCL, CS_MONO, { CS_MONO } }
};
/*
@@ -591,7 +593,8 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
int savealpha = (out_cs == CS_RGBA || out_cs == CS_GRAYALPHA);
pix = fz_new_pixmap_with_bbox(ctx, colorspace, &ibounds);
-
+ fz_pixmap_set_resolution(pix, resolution);
+
if (savealpha)
fz_clear_pixmap(ctx, pix);
else
@@ -637,6 +640,24 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_write_pwg(ctx, pix, buf, append, NULL);
append = 1;
}
+ else if (output_format == OUT_PCL)
+ {
+ fz_pcl_options options;
+
+ fz_pcl_preset(ctx, &options, "ljet4");
+
+ if (strstr(output, "%d") != NULL)
+ append = 0;
+ if (out_cs == CS_MONO)
+ {
+ fz_bitmap *bit = fz_halftone_pixmap(ctx, pix, NULL);
+ fz_write_pcl_bitmap(ctx, bit, buf, append, &options);
+ fz_drop_bitmap(ctx, bit);
+ }
+ else
+ fz_write_pcl(ctx, pix, buf, append, &options);
+ append = 1;
+ }
else if (output_format == OUT_PBM) {
fz_bitmap *bit = fz_halftone_pixmap(ctx, pix, NULL);
fz_write_pbm(ctx, bit, buf);