summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-06-11 00:05:30 +0800
committerSebastian Rasmussen <sebras@gmail.com>2017-06-15 22:17:23 +0800
commit17a231f53fb526b8bb8c82f7967facbfd19eecee (patch)
tree2b30b503773eff7df95d4076b8ec6f7cae8f547a /docs
parent272edebc330b2b26e4ce4a4e4fc2e3b62b2e467e (diff)
downloadmupdf-17a231f53fb526b8bb8c82f7967facbfd19eecee.tar.xz
Update how to build native examples.
Diffstat (limited to 'docs')
-rw-r--r--docs/examples/example.c27
-rw-r--r--docs/examples/multi-threaded.c62
2 files changed, 49 insertions, 40 deletions
diff --git a/docs/examples/example.c b/docs/examples/example.c
index 1bf67635..2cfe2b73 100644
--- a/docs/examples/example.c
+++ b/docs/examples/example.c
@@ -1,16 +1,19 @@
/*
- How to use MuPDF to render a single page and print the result as a PPM to stdout.
-
- Build the mupdf library using make, then either run 'make examples' or
- compile the example manually:
-
- gcc -Iinclude -o example.exe docs/example.c \
- build/debug/libmupdf.a \
- build/debug/libmupdfthird.a
- -lcrypto \
- -lm
-
- ./example.exe document.pdf 100 0 1
+How to use MuPDF to render a single page and print the result as
+a PPM to stdout.
+
+To build this example in a source tree and render first page at
+100% zoom with no rotation, run:
+make examples
+./build/debug/example document.pdf 1 100 0 > page1.ppm
+
+To build from installed sources, and render the same document, run:
+gcc -I/usr/local/include -o example \
+ /usr/local/share/doc/mupdf/examples/example.c \
+ /usr/local/lib/libmupdf.a \
+ /usr/local/lib/libmupdfthird.a \
+ -lm
+./example document.pdf 1 100 0 > page1.ppm
*/
#include <mupdf/fitz.h>
diff --git a/docs/examples/multi-threaded.c b/docs/examples/multi-threaded.c
index 15fdcba2..d8541983 100644
--- a/docs/examples/multi-threaded.c
+++ b/docs/examples/multi-threaded.c
@@ -1,31 +1,37 @@
-// Multi-threaded rendering of all pages in a document to PNG images.
-
-// First look at doc/example.c and make sure you understand it.
-// Then read the multi-threading section in doc/overview.txt,
-// before coming back here to see an example of multi-threading.
-
-// This example will create one main thread for reading pages from the
-// document, and one thread per page for rendering. After rendering
-// the main thread will wait for each rendering thread to complete before
-// writing that thread's rendered image to a PNG image. There is
-// nothing in MuPDF requiring a rendering thread to only render a
-// single page, this is just a design decision taken for this example.
-
-// Compile a debug build of mupdf, then compile and run this example:
-//
-// gcc -g -o build/debug/example-mt -Iinclude docs/multi-threaded.c \
-// build/debug/libmupdf.a \
-// build/debug/libmupdfthird.a \
-// -lpthread -lcrypto -lm
-//
-// build/debug/example-mt /path/to/document.pdf
-//
-// Caution! As all pages are rendered simultaneously, please choose a
-// file with just a few pages to avoid stressing your machine too
-// much. Also you may run in to a limitation on the number of threads
-// depending on your environment.
-
-// Include the MuPDF header file, and pthread's header file.
+/*
+Multi-threaded rendering of all pages in a document to PNG images.
+
+First look at doc/example.c and make sure you understand it.
+Then read the multi-threading section in doc/overview.txt,
+before coming back here to see an example of multi-threading.
+
+This example will create one main thread for reading pages from the
+document, and one thread per page for rendering. After rendering
+the main thread will wait for each rendering thread to complete before
+writing that thread's rendered image to a PNG image. There is
+nothing in MuPDF requiring a rendering thread to only render a
+single page, this is just a design decision taken for this example.
+
+To build this example in a source tree and render every page as a
+separate PNG, run:
+make examples
+./build/debug/multi-threaded document.pdf
+
+To build from installed sources, and render the same document, run:
+gcc -I/usr/local/include -o multi-threaded \
+ /usr/local/share/doc/mupdf/examples/multi-threaded.c \
+ /usr/local/lib/libmupdf.a \
+ /usr/local/lib/libmupdfthird.a \
+ -lpthread -lm
+./multi-threaded document.pdf
+
+Caution! As all pages are rendered simultaneously, please choose a
+file with just a few pages to avoid stressing your machine too
+much. Also you may run in to a limitation on the number of threads
+depending on your environment.
+*/
+
+//Include the MuPDF header file, and pthread's header file.
#include <mupdf/fitz.h>
#include <pthread.h>