diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2015-05-19 17:22:01 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2015-05-19 17:22:53 +0200 |
commit | 0dc2cbf8fedd5615898b09314d0c899c6e911baa (patch) | |
tree | 7dd23ead25bcf9c7419700ffd27c68d95cbd6524 /platform | |
parent | 9adccf1e2697cc103715d3c2f916c04bdbcd516a (diff) | |
download | mupdf-0dc2cbf8fedd5615898b09314d0c899c6e911baa.tar.xz |
epub: User stylesheets.
Add -U option to mupdf and mudraw to set a user stylesheet.
Uses a context to store user the stylesheet, just like the AA level.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/x11/pdfapp.c | 8 | ||||
-rw-r--r-- | platform/x11/pdfapp.h | 1 | ||||
-rw-r--r-- | platform/x11/x11_main.c | 3 |
3 files changed, 11 insertions, 1 deletions
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index 3d727ed1..1fb2f2d4 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -302,6 +302,14 @@ void pdfapp_open_progressive(pdfapp_t *app, char *filename, int reload, int bps) { fz_register_document_handlers(ctx); + if (app->layout_css) + { + fz_buffer *buf = fz_read_file(ctx, app->layout_css); + fz_write_buffer_byte(ctx, buf, 0); + fz_set_user_css(ctx, (char*)buf->data); + fz_drop_buffer(ctx, buf); + } + #ifdef HAVE_CURL if (!strncmp(filename, "http://", 7)) { diff --git a/platform/x11/pdfapp.h b/platform/x11/pdfapp.h index 46f09640..1bac5872 100644 --- a/platform/x11/pdfapp.h +++ b/platform/x11/pdfapp.h @@ -57,6 +57,7 @@ struct pdfapp_s float layout_w; float layout_h; float layout_em; + char *layout_css; int pagecount; diff --git a/platform/x11/x11_main.c b/platform/x11/x11_main.c index 80c86a23..9fe3b955 100644 --- a/platform/x11/x11_main.c +++ b/platform/x11/x11_main.c @@ -835,7 +835,7 @@ int main(int argc, char **argv) pdfapp_init(ctx, &gapp); - while ((c = fz_getopt(argc, argv, "p:r:A:C:W:H:S:")) != -1) + while ((c = fz_getopt(argc, argv, "p:r:A:C:W:H:S:U:")) != -1) { switch (c) { @@ -852,6 +852,7 @@ int main(int argc, char **argv) case 'W': gapp.layout_w = fz_atof(fz_optarg); break; case 'H': gapp.layout_h = fz_atof(fz_optarg); break; case 'S': gapp.layout_em = fz_atof(fz_optarg); break; + case 'U': gapp.layout_css = fz_optarg; break; default: usage(); } } |