comparison mupdf-source/scripts/mupdfwrap_test.cpp @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 #include "mupdf/fitz.h"
2 #include "mupdf/classes.h"
3 #include "mupdf/classes2.h"
4
5 #include <assert.h>
6
7
8 int main(int argc, char** argv)
9 {
10 assert(argc == 2);
11 const char* path = argv[1];
12 mupdf::FzDocument document(path);
13 std::string v;
14 v = mupdf::fz_lookup_metadata2(document, "format");
15 printf("v=%s\n", v.c_str());
16 bool raised = false;
17 try
18 {
19 v = mupdf::fz_lookup_metadata2(document, "format___");
20 }
21 catch (std::exception& e)
22 {
23 raised = true;
24 printf("Received expected exception: %s\n", e.what());
25 }
26 if (!raised) exit(1);
27 printf("v=%s\n", v.c_str());
28 fz_rect r = fz_unit_rect;
29 printf("r.x0=%f\n", r.x0);
30
31 mupdf::FzStextOptions options;
32 mupdf::FzStextPage stp( document, 0, options);
33 std::vector<fz_quad> quads = mupdf::fz_highlight_selection2(
34 stp,
35 mupdf::FzPoint(20, 20),
36 mupdf::FzPoint(120, 220),
37 100
38 );
39 printf("quads.size()=%zi\n", quads.size());
40 assert(quads.size() == 13);
41 return 0;
42 }