[gs-commits] mupdf 1.7a.24 Merge 'mudraw' into 'mutool' binary.

Tor Andersson tor at ghostscript.com
Mon May 25 11:23:49 UTC 2015


commit ecb7ed0e80be1af30df8c43ac78ee212fb4c1734
Author: Tor Andersson <tor.andersson at artifex.com>
Date:   Mon May 25 13:22:59 2015 +0200

    Merge 'mudraw' into 'mutool' binary.
    
    Use "mutool draw" or symlink mutool to mudraw to use mudraw.

diff --git a/Makefile b/Makefile
index 8e45697..1bd50ff 100644
--- a/Makefile
+++ b/Makefile
@@ -233,15 +233,8 @@ $(OUT)/cmapdump.o : include/mupdf/pdf/cmap.h source/pdf/pdf-cmap.c source/pdf/pd
 
 # --- Tools and Apps ---
 
-MUDRAW := $(addprefix $(OUT)/, mudraw)
-MUDRAW_OBJ := $(addprefix $(OUT)/tools/, mudraw.o)
-$(MUDRAW_OBJ) : $(FITZ_HDR) $(PDF_HDR)
-$(MUDRAW) : $(MUPDF_LIB) $(THIRD_LIBS)
-$(MUDRAW) : $(MUDRAW_OBJ)
-	$(LINK_CMD)
-
 MUTOOL := $(addprefix $(OUT)/, mutool)
-MUTOOL_OBJ := $(addprefix $(OUT)/tools/, mutool.o pdfclean.o pdfextract.o pdfinfo.o pdfposter.o pdfshow.o pdfpages.o)
+MUTOOL_OBJ := $(addprefix $(OUT)/tools/, mutool.o mudraw.o pdfclean.o pdfextract.o pdfinfo.o pdfposter.o pdfshow.o pdfpages.o)
 $(MUTOOL_OBJ): $(FITZ_HDR) $(PDF_HDR)
 $(MUTOOL) : $(MUPDF_LIB) $(THIRD_LIBS)
 $(MUTOOL) : $(MUTOOL_OBJ)
@@ -289,7 +282,7 @@ endif
 MUVIEW := $(MUVIEW_X11) $(MUVIEW_WIN32)
 MUVIEW_CURL := $(MUVIEW_X11_CURL) $(MUVIEW_WIN32_CURL)
 
-INSTALL_APPS := $(MUDRAW) $(MUTOOL) $(MUVIEW) $(MUJSTEST) $(MUVIEW_CURL)
+INSTALL_APPS := $(MUTOOL) $(MUVIEW) $(MUJSTEST) $(MUVIEW_CURL)
 
 # --- Examples ---
 
diff --git a/docs/man/mudraw.1 b/docs/man/mudraw.1
deleted file mode 100644
index 390e78c..0000000
--- a/docs/man/mudraw.1
+++ /dev/null
@@ -1,107 +0,0 @@
-.TH MUDRAW 1 "March 31, 2015"
-.\" Please adjust this date whenever revising the manpage.
-.\" no hyphenation
-.nh
-.\" adjust left
-.ad l
-
-.SH NAME
-mudraw \- render PDF/XPS/CBZ/EPUB documents
-
-.SH SYNOPSIS
-.B mudraw
-.RI [ options ]
-.RI file
-.RI [ pages]
-
-.SH DESCRIPTION
-.B mudraw
-will render a document of a supported document format to image files,
-convert to another vector format, or extract the text content.
-
-The supported input document formats are: pdf, xps, cbz, and epub.
-
-The supported output image formats are: pbm, pgm, ppm, pam, png, tga, pwg, and pcl.
-The supported output vector formats are: svg, pdf, and debug trace (as xml).
-The supported output text formats are: plain text, html, and structured text (as xml).
-
-.SH OPTIONS
-.TP
-.B \-p password
-Use the specified password if the file is encrypted.
-.TP
-.B \-o output
-The output format is inferred from the output file name.
-Embed %d in the name to indicate the page number (for example: "page%d.png").
-Printf modifiers are supported, for example "%03d".
-If no output is specified, the output will go to stdout.
-.TP
-.B \-F format
-Enforce a specific output format. Use this when outputting to stdout.
-.TP
-.B \-R angle
-Rotate clockwise by given number of degrees.
-.TP
-.B \-r resolution
-Render the page at the specified resolution.
-The default resolution is 72 dpi.
-.TP
-.B \-w width
-Render the page at the specified width (or, if the -r flag is used,
-render with a maximum width).
-.TP
-.B \-h height
-Render the page at the specified height (or, if the -r flag is used,
-render with a maximum height).
-.TP
-.B \-f
-Fit exactly; ignore the aspect ratio when matching specified width/heights.
-.TP
-.B \-W width
-Page width in points for EPUB layout.
-.TP
-.B \-H height
-Page height in points for EPUB layout.
-.TP
-.B \-S size
-Font size in points for EPUB layout.
-.TP
-.B \-c colorspace
-Render in the specified colorspace.
-Supported colorspaces are: mono, gray, grayalpha, rgb, rgbalpha, cmyk, cmykalpha.
-Some abbreviations are allowed: m, g, ga, rgba, cmyka.
-The default is chosen based on the output format.
-.TP
-.B -G gamma
-Apply gamma correction.
-Some typical values are 0.7 or 1.4 to thin or darken text rendering.
-.TP
-.B -I
-Invert colors.
-.TP
-.B \-s [mft5]
-Show various bits of information:
-memory use,
-features,
-timings, and/or
-md5 checksum.
-.TP
-.B \-A bits
-Specify how many bits of anti-aliasing to use. The default is 8.
-.TP
-.B \-D
-Disable use of display lists. May cause slowdowns, but should reduce
-the amount of memory used.
-.B \-i
-Ignore errors.
-.TP
-.B pages
-Comma separated list of page numbers and ranges (for example: 1,5,10-15).
-If no pages are specified, then all pages will be rendered.
-
-.SH SEE ALSO
-.BR mupdf (1),
-.BR mutool (1).
-
-.SH AUTHOR
-MuPDF is Copyright 2006-2015 Artifex Software, Inc.
diff --git a/docs/man/mupdf.1 b/docs/man/mupdf.1
index 42d8011..8d50f79 100644
--- a/docs/man/mupdf.1
+++ b/docs/man/mupdf.1
@@ -1,4 +1,4 @@
-.TH MUPDF 1 "April 7, 2015"
+.TH MUPDF 1 "May 25, 2015"
 .\" Please adjust this date whenever revising the manpage.
 
 .SH NAME
@@ -149,7 +149,6 @@ Sending a \fBSIGHUP\fR signal to the mupdf process will also cause the viewed
 file to be reloaded automatically, for use in e.g. build scripts.
 
 .SH SEE ALSO
-.BR mudraw (1),
 .BR mutool (1).
 
 .SH AUTHOR
diff --git a/docs/man/mutool.1 b/docs/man/mutool.1
index c88565c..bbed7c6 100644
--- a/docs/man/mutool.1
+++ b/docs/man/mutool.1
@@ -1,4 +1,4 @@
-.TH "MUTOOL" "1" "April 2, 2015"
+.TH "MUTOOL" "1" "May 25, 2015"
 .\" Please adjust this date whenever revising the manpage.
 .\" no hyphenation
 .nh
@@ -15,6 +15,94 @@ mutool <sub-command> [options]
 mutool is a tool based on MuPDF for dealing with PDF files in various manners.
 There are several sub commands available, as described below.
 
+.SH DRAW
+mudraw [options] file [pages]
+
+The draw command will render a document to image files,
+convert to another vector format, or extract the text content.
+
+The supported input document formats are: pdf, xps, cbz, and epub.
+
+The supported output image formats are: pbm, pgm, ppm, pam, png, tga, pwg, and pcl.
+The supported output vector formats are: svg, pdf, and debug trace (as xml).
+The supported output text formats are: plain text, html, and structured text (as xml).
+
+.TP
+.B \-p password
+Use the specified password if the file is encrypted.
+.TP
+.B \-o output
+The output format is inferred from the output file name.
+Embed %d in the name to indicate the page number (for example: "page%d.png").
+Printf modifiers are supported, for example "%03d".
+If no output is specified, the output will go to stdout.
+.TP
+.B \-F format
+Enforce a specific output format. Use this when outputting to stdout.
+.TP
+.B \-R angle
+Rotate clockwise by given number of degrees.
+.TP
+.B \-r resolution
+Render the page at the specified resolution.
+The default resolution is 72 dpi.
+.TP
+.B \-w width
+Render the page at the specified width (or, if the -r flag is used,
+render with a maximum width).
+.TP
+.B \-h height
+Render the page at the specified height (or, if the -r flag is used,
+render with a maximum height).
+.TP
+.B \-f
+Fit exactly; ignore the aspect ratio when matching specified width/heights.
+.TP
+.B \-W width
+Page width in points for EPUB layout.
+.TP
+.B \-H height
+Page height in points for EPUB layout.
+.TP
+.B \-S size
+Font size in points for EPUB layout.
+.TP
+.B \-U filename
+User CSS stylesheet for EPUB layout.
+.TP
+.B \-c colorspace
+Render in the specified colorspace.
+Supported colorspaces are: mono, gray, grayalpha, rgb, rgbalpha, cmyk, cmykalpha.
+Some abbreviations are allowed: m, g, ga, rgba, cmyka.
+The default is chosen based on the output format.
+.TP
+.B -G gamma
+Apply gamma correction.
+Some typical values are 0.7 or 1.4 to thin or darken text rendering.
+.TP
+.B -I
+Invert colors.
+.TP
+.B \-s [mft5]
+Show various bits of information:
+memory use,
+features,
+timings, and/or
+md5 checksum.
+.TP
+.B \-A bits
+Specify how many bits of anti-aliasing to use. The default is 8.
+.TP
+.B \-D
+Disable use of display lists. May cause slowdowns, but should reduce
+the amount of memory used.
+.B \-i
+Ignore errors.
+.TP
+.B pages
+Comma separated list of page numbers and ranges (for example: 1,5,10-15).
+If no pages are specified, then all pages will be rendered.
+
 .SH CLEAN
 mutool clean [options] input.pdf [output.pdf] [pages]
 .PP
@@ -174,7 +262,6 @@ Print all the objects in the file in a compact one-line format suitable for pipi
 Print the outline (table of contents).
 
 .SH SEE ALSO
-.BR mudraw (1).
 .BR mupdf (1),
 
 .SH AUTHOR
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 882ce66..4483ad4 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -7,7 +7,6 @@
 
 #ifdef _MSC_VER
 #include <winsock2.h>
-#define main main_utf8
 #else
 #include <sys/time.h>
 #endif
@@ -847,7 +846,7 @@ trace_realloc(void *arg, void *p_, unsigned int size)
 	return &p[1];
 }
 
-int main(int argc, char **argv)
+int mudraw_main(int argc, char **argv)
 {
 	char *password = "";
 	fz_document *doc = NULL;
@@ -1174,13 +1173,3 @@ int main(int argc, char **argv)
 
 	return (errored != 0);
 }
-
-#ifdef _MSC_VER
-int wmain(int argc, wchar_t *wargv[])
-{
-	char **argv = fz_argv_from_wargv(argc, wargv);
-	int ret = main(argc, argv);
-	fz_free_argv(argc, argv);
-	return ret;
-}
-#endif
diff --git a/source/tools/mutool.c b/source/tools/mutool.c
index 1389b37..6b61dab 100644
--- a/source/tools/mutool.c
+++ b/source/tools/mutool.c
@@ -8,6 +8,7 @@
 #define main main_utf8
 #endif
 
+int mudraw_main(int argc, char *argv[]);
 int pdfclean_main(int argc, char *argv[]);
 int pdfextract_main(int argc, char *argv[]);
 int pdfinfo_main(int argc, char *argv[]);
@@ -20,6 +21,7 @@ static struct {
 	char *name;
 	char *desc;
 } tools[] = {
+	{ mudraw_main, "draw", "convert document" },
 	{ pdfclean_main, "clean", "rewrite pdf file" },
 	{ pdfextract_main, "extract", "extract font and image resources" },
 	{ pdfinfo_main, "info", "show information about pdf resources" },
@@ -62,6 +64,10 @@ int main(int argc, char **argv)
 			strcat(buf, tools[i].name);
 			if (namematch(end, start, buf) || namematch(end, start, buf+2))
 				return tools[i].func(argc, argv);
+			strcpy(buf, "mu");
+			strcat(buf, tools[i].name);
+			if (namematch(end, start, buf))
+				return tools[i].func(argc, argv);
 		}
 	}
 

http://git.ghostscript.com/?p=mupdf.git;a=commit;h=ecb7ed0e80be1af30df8c43ac78ee212fb4c1734

--
MuPDF: a lightweight PDF viewer
Artifex Software, Inc.


More information about the gs-commits mailing list