comparison mupdf-source/scripts/mupdfwrap_test.cpp @ 3:2c135c81b16c

MERGE: upstream PyMuPDF 1.26.4 with MuPDF 1.26.7
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:44:09 +0200
parents b50eed0cc0ef
children
comparison
equal deleted inserted replaced
0:6015a75abc2d 3:2c135c81b16c
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 }