summaryrefslogtreecommitdiff
path: root/source/tools
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-11-21 14:39:26 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-11-23 11:17:35 +0100
commit1280bde7a824599bad9e277f6b3e74b850a1e6fc (patch)
treec106268328ea1e07ed991cdc13f2cfe1087d2b85 /source/tools
parentdd15bf347ca04cb79d1e009a7afb0f4c082820ca (diff)
downloadmupdf-1280bde7a824599bad9e277f6b3e74b850a1e6fc.tar.xz
Add 'X' option to disable document styles.
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/muconvert.c7
-rw-r--r--source/tools/mudraw.c7
-rw-r--r--source/tools/muraster.c15
3 files changed, 22 insertions, 7 deletions
diff --git a/source/tools/muconvert.c b/source/tools/muconvert.c
index 575574be..c3673852 100644
--- a/source/tools/muconvert.c
+++ b/source/tools/muconvert.c
@@ -11,6 +11,7 @@ static float layout_w = 450;
static float layout_h = 600;
static float layout_em = 12;
static char *layout_css = NULL;
+static int layout_use_doc_css = 1;
/* output options */
static const char *output = NULL;
@@ -34,6 +35,7 @@ static void usage(void)
"\t-H -\tpage height for EPUB layout\n"
"\t-S -\tfont size for EPUB layout\n"
"\t-U -\tfile name of user stylesheet for EPUB layout\n"
+ "\t-X\tdisable document styles for EPUB layout\n"
"\n"
"\t-o -\toutput file name (%%d for page number)\n"
"\t-F -\toutput format (default inferred from output file name)\n"
@@ -86,7 +88,7 @@ int muconvert_main(int argc, char **argv)
{
int i, c;
- while ((c = fz_getopt(argc, argv, "p:A:W:H:S:U:o:F:O:")) != -1)
+ while ((c = fz_getopt(argc, argv, "p:A:W:H:S:U:Xo:F:O:")) != -1)
{
switch (c)
{
@@ -98,6 +100,7 @@ int muconvert_main(int argc, char **argv)
case 'H': layout_h = fz_atof(fz_optarg); break;
case 'S': layout_em = fz_atof(fz_optarg); break;
case 'U': layout_css = fz_optarg; break;
+ case 'X': layout_use_doc_css = 0; break;
case 'o': output = fz_optarg; break;
case 'F': format = fz_optarg; break;
@@ -135,6 +138,8 @@ int muconvert_main(int argc, char **argv)
fz_drop_buffer(ctx, buf);
}
+ fz_set_use_document_css(ctx, layout_use_doc_css);
+
/* Open the output document. */
fz_try(ctx)
out = fz_new_document_writer(ctx, output, format, options);
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 20122563..7b77f195 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -201,6 +201,7 @@ static float layout_w = 450;
static float layout_h = 600;
static float layout_em = 12;
static char *layout_css = NULL;
+static int layout_use_doc_css = 1;
static float min_line_width = 0.0f;
static int showfeatures = 0;
@@ -293,6 +294,7 @@ static void usage(void)
"\t-H -\tpage height for EPUB layout\n"
"\t-S -\tfont size for EPUB layout\n"
"\t-U -\tfile name of user stylesheet for EPUB layout\n"
+ "\t-X\tdisable document styles for EPUB layout\n"
"\n"
"\t-c -\tcolorspace (mono, gray, grayalpha, rgb, rgba, cmyk, cmykalpha)\n"
"\t-G -\tapply gamma correction\n"
@@ -1284,7 +1286,7 @@ int mudraw_main(int argc, char **argv)
fz_var(doc);
- while ((c = fz_getopt(argc, argv, "p:o:F:R:r:w:h:fB:c:G:Is:A:DiW:H:S:T:U:LvPl:y:")) != -1)
+ while ((c = fz_getopt(argc, argv, "p:o:F:R:r:w:h:fB:c:G:Is:A:DiW:H:S:T:U:XLvPl:y:")) != -1)
{
switch (c)
{
@@ -1310,6 +1312,7 @@ int mudraw_main(int argc, char **argv)
case 'H': layout_h = fz_atof(fz_optarg); break;
case 'S': layout_em = fz_atof(fz_optarg); break;
case 'U': layout_css = fz_optarg; break;
+ case 'X': layout_use_doc_css = 0; break;
case 's':
if (strchr(fz_optarg, 't')) ++showtime;
@@ -1437,6 +1440,8 @@ int mudraw_main(int argc, char **argv)
fz_drop_buffer(ctx, buf);
}
+ fz_set_use_document_css(ctx, layout_use_doc_css);
+
/* Determine output type */
if (band_height < 0)
{
diff --git a/source/tools/muraster.c b/source/tools/muraster.c
index d65074d5..96f59162 100644
--- a/source/tools/muraster.c
+++ b/source/tools/muraster.c
@@ -353,7 +353,8 @@ static int fit = 0;
static float layout_w = 450;
static float layout_h = 600;
static float layout_em = 12;
-static char *layoutput_css = NULL;
+static char *layout_css = NULL;
+static int layout_use_doc_css = 1;
static int showtime = 0;
static size_t memtrace_current = 0;
@@ -485,6 +486,7 @@ static void usage(void)
"\t-H -\tpage height for EPUB layout\n"
"\t-S -\tfont size for EPUB layout\n"
"\t-U -\tfile name of user stylesheet for EPUB layout\n"
+ "\t-X\tdisable document styles for EPUB layout\n"
"\n"
"\t-A -\tnumber of bits of antialiasing (0 to 8)\n"
"\t-A -/-\tnumber of bits of antialiasing (0 to 8) (graphics, text)\n"
@@ -1398,7 +1400,7 @@ int main(int argc, char **argv)
x_resolution = X_RESOLUTION;
y_resolution = Y_RESOLUTION;
- while ((c = fz_getopt(argc, argv, "p:o:F:R:r:w:h:fB:M:s:A:iW:H:S:T:U:vP")) != -1)
+ while ((c = fz_getopt(argc, argv, "p:o:F:R:r:w:h:fB:M:s:A:iW:H:S:T:U:XvP")) != -1)
{
switch (c)
{
@@ -1420,7 +1422,8 @@ int main(int argc, char **argv)
case 'W': layout_w = fz_atof(fz_optarg); break;
case 'H': layout_h = fz_atof(fz_optarg); break;
case 'S': layout_em = fz_atof(fz_optarg); break;
- case 'U': layoutput_css = fz_optarg; break;
+ case 'U': layout_css = fz_optarg; break;
+ case 'X': layout_use_doc_css = 0; break;
case 's':
if (strchr(fz_optarg, 't')) ++showtime;
@@ -1527,13 +1530,15 @@ int main(int argc, char **argv)
}
#endif /* DISABLE_MUTHREADS */
- if (layoutput_css)
+ if (layout_css)
{
- fz_buffer *buf = fz_read_file(ctx, layoutput_css);
+ fz_buffer *buf = fz_read_file(ctx, layout_css);
fz_set_user_css(ctx, fz_string_from_buffer(ctx, buf));
fz_drop_buffer(ctx, buf);
}
+ fz_set_use_document_css(ctx, layout_use_doc_css);
+
output_format = suffix_table[0].format;
output_cs = suffix_table[0].cs;
if (format)