-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathharness.html
More file actions
218 lines (212 loc) · 7.8 KB
/
Copy pathharness.html
File metadata and controls
218 lines (212 loc) · 7.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!doctype html>
<!-- SPDX-License-Identifier: MIT Copyright (c) 2026 Mozilla Foundation -->
<html lang="en">
<head>
<meta charset="utf-8" />
<title>pdf.js.comparator harness</title>
<!-- Inter is the body face; Zilla Slab Highlight is reserved for the
"moz://a" wordmark in the top-left corner. preconnect cuts the
font-fetch latency on first paint. -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Zilla+Slab+Highlight:wght@700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="harness.css" />
</head>
<body>
<a
class="moz-corner"
href="https://www.mozilla.org"
target="_blank"
rel="noopener noreferrer"
aria-label="Mozilla"
title="mozilla.org"
>moz://a</a
>
<a
class="github-corner"
href="https://github.com/mozilla/pdf.js.comparator"
target="_blank"
rel="noopener noreferrer"
aria-label="View source on GitHub"
title="View source on GitHub"
>
<!-- Octicons mark-github, MIT-licensed. -->
<svg
viewBox="0 0 16 16"
width="28"
height="28"
fill="currentColor"
aria-hidden="true"
>
<path
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"
></path>
</svg>
</a>
<header class="hero">
<h1>pdf.js<span class="accent">.comparator</span></h1>
<p class="lede">
Render the same PDF page through pdf.js and reference engines
side-by-side, then diff the bitmaps with six image-similarity algorithms
— all in your browser.
</p>
<p class="privacy-note">
<svg
viewBox="0 0 16 16"
width="14"
height="14"
fill="currentColor"
aria-hidden="true"
>
<path
d="M8 1a3 3 0 0 0-3 3v2H4a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1h-1V4a3 3 0 0 0-3-3Zm-1.5 5V4a1.5 1.5 0 1 1 3 0v2h-3Z"
></path>
</svg>
Your PDF stays on this device — nothing is uploaded or stored.
</p>
</header>
<main class="controls">
<section class="card card-drop" aria-labelledby="card-doc">
<h2 id="card-doc" class="card-title">Document</h2>
<label class="dropzone">
<span class="dropzone-icon" aria-hidden="true">⬆</span>
<span class="dropzone-text"
>Drop a PDF here or <strong>click to browse</strong></span
>
<span class="dropzone-hint">accepts application/pdf</span>
<input type="file" id="file" accept="application/pdf,.pdf" disabled />
</label>
</section>
<section class="card" aria-labelledby="card-page">
<h2 id="card-page" class="card-title">Page & options</h2>
<div class="field-grid">
<label class="field">
<span class="field-label">Page</span>
<span class="field-input-row">
<input type="number" id="page" value="1" min="1" step="1" />
<span id="pages" class="field-hint"></span>
</span>
</label>
<label class="field">
<span class="field-label">DPI</span>
<input type="number" id="dpi" value="96" min="1" step="1" />
</label>
<label class="toggle">
<input type="checkbox" id="antialias" checked />
<span>antialias</span>
</label>
<label class="toggle">
<input type="checkbox" id="transparent" />
<span>transparent bg</span>
</label>
</div>
</section>
<section class="card" aria-labelledby="card-cmp">
<h2 id="card-cmp" class="card-title">Comparison pair</h2>
<div class="field-grid">
<label class="field">
<span class="field-label">From</span>
<select id="compare-a">
<option value="pdfjs" selected>pdf.js</option>
<option value="cairo">cairo</option>
<option value="splash">splash</option>
<option value="pdfium">pdfium</option>
<option value="mupdf">mupdf</option>
<option value="pdfbox">pdfbox</option>
<option value="gs">gs</option>
<option value="xpdf">xpdf</option>
</select>
</label>
<label class="field">
<span class="field-label">To</span>
<select id="compare-b">
<option value="cairo">cairo</option>
<option value="splash">splash</option>
<option value="pdfium" selected>pdfium</option>
<option value="mupdf">mupdf</option>
<option value="pdfjs">pdf.js</option>
<option value="pdfbox">pdfbox</option>
<option value="gs">gs</option>
<option value="xpdf">xpdf</option>
</select>
</label>
</div>
</section>
<section class="card card-wide" aria-labelledby="card-rend">
<h2 id="card-rend" class="card-title">Renderers</h2>
<div class="chip-row">
<label class="chip" data-engine="cairo"
><input
type="checkbox"
class="renderer"
value="cairo"
checked
/><span>cairo</span></label
>
<label class="chip" data-engine="splash"
><input
type="checkbox"
class="renderer"
value="splash"
checked
/><span>splash</span></label
>
<label class="chip" data-engine="pdfium"
><input
type="checkbox"
class="renderer"
value="pdfium"
checked
/><span>pdfium</span></label
>
<label class="chip" data-engine="mupdf"
><input
type="checkbox"
class="renderer"
value="mupdf"
checked
/><span>mupdf</span></label
>
<label class="chip" data-engine="pdfjs"
><input
type="checkbox"
class="renderer"
value="pdfjs"
checked
/><span>pdf.js</span></label
>
<label class="chip" data-engine="pdfbox"
><input
type="checkbox"
class="renderer"
value="pdfbox"
checked
/><span>pdfbox</span></label
>
<label class="chip" data-engine="gs"
><input type="checkbox" class="renderer" value="gs" checked /><span
>ghostscript</span
></label
>
<label class="chip" data-engine="xpdf"
><input
type="checkbox"
class="renderer"
value="xpdf"
checked
/><span>xpdf</span></label
>
</div>
</section>
</main>
<div class="status-wrap">
<div id="status" role="status" aria-live="polite">loading wasm…</div>
</div>
<div id="renders"></div>
<div id="diffs"></div>
<script type="module" src="harness.js"></script>
</body>
</html>