pdf.js.mirror/web/pdf_internal_viewer.html
calixteman 2381ac6b16
Update the internal viewer to use a new debugger.
It has few cool features:
 - all the canvas used during the rendering can be viewed;
 - the different properties in the graphics state can be viewed;
 - the different paths can be viewed.
2026-03-12 22:38:08 +01:00

118 lines
5.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<!--
Copyright 2026 Mozilla Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>PDF.js — Debugging tools</title>
<link rel="stylesheet" href="pdf_internal_viewer.css" />
</head>
<body>
<div id="header">
<h1>PDF.js — Debugging tools</h1>
<span id="pdf-info" aria-live="polite"></span>
</div>
<div id="controls" role="toolbar" aria-label="PDF viewer controls">
<label for="file-input">PDF file:</label>
<input type="file" id="file-input" accept=".pdf" />
<label for="goto-input">Go to:</label>
<input type="text" id="goto-input" placeholder="num, numR, numRgen" size="18" disabled aria-describedby="goto-input-hint" aria-invalid="false" />
<span id="goto-input-hint" class="sr-only">
Enter a page number (e.g. 5), a reference as numR (e.g. 10R) or numRgen (e.g. 10R2). Press Enter to navigate.
</span>
<button id="debug-btn" hidden>Debug page</button>
<button id="debug-back-btn" hidden>← Back to tree</button>
<span id="status" role="status" aria-live="polite"> Select a PDF file to explore its internal structure. </span>
<a id="github-link" href="https://github.com/mozilla/pdf.js" target="_blank" rel="noopener noreferrer" aria-label="PDF.js on GitHub">
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
<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 0016 8c0-4.42-3.58-8-8-8z"
/>
</svg>
</a>
</div>
<div id="tree" role="tree" aria-label="PDF internal structure"></div>
<div id="debug-view" hidden>
<div id="render-panels">
<div id="op-left-col">
<div id="op-top-row">
<div id="op-list-panel">
<div id="op-list" role="listbox" aria-label="Operator list"></div>
</div>
<div id="op-gfx-state-resizer" role="separator" aria-orientation="vertical" tabindex="0" hidden></div>
<div id="gfx-state-panel" aria-label="Graphics state" hidden></div>
</div>
<div id="op-resizer" role="separator" aria-orientation="horizontal" tabindex="0"></div>
<div id="op-detail-panel"></div>
</div>
<div id="render-resizer" role="separator" aria-orientation="vertical" tabindex="0"></div>
<div id="canvas-panel">
<div id="canvas-toolbar" role="toolbar" aria-label="Zoom controls">
<button id="zoom-out-btn" aria-label="Zoom out"></button>
<span id="zoom-level" aria-live="polite"></span>
<button id="zoom-in-btn" aria-label="Zoom in">+</button>
<button id="redraw-btn" aria-label="Redraw page">Redraw</button>
<button id="step-btn" aria-label="Step one instruction" disabled><u>S</u>tep</button>
<button id="continue-btn" aria-label="Continue to next breakpoint" disabled><u>C</u>ontinue</button>
</div>
<div id="canvas-scroll">
<div id="canvas-wrapper">
<canvas id="render-canvas"></canvas>
<canvas id="highlight-canvas" aria-hidden="true"></canvas>
</div>
</div>
</div>
</div>
</div>
<dialog id="password-dialog" aria-labelledby="password-dialog-title">
<form method="dialog">
<p id="password-dialog-title"></p>
<label for="password-input">Password:</label>
<input type="password" id="password-input" autocomplete="current-password" />
<div class="password-dialog-buttons">
<button type="submit" id="password-submit">OK</button>
<button type="button" id="password-cancel">Cancel</button>
</div>
</form>
</dialog>
<!--#if GENERIC-->
<!--<script src="../build/pdf.mjs" type="module"></script>-->
<!--<script src="pdf_internal_viewer.mjs" type="module"></script>-->
<!--#else-->
<script type="importmap">
{
"imports": {
"pdfjs/": "../src/",
"pdfjs-lib": "../src/pdf.js",
"display-cmap_reader_factory": "../src/display/cmap_reader_factory.js",
"display-standard_fontdata_factory": "../src/display/standard_fontdata_factory.js",
"display-wasm_factory": "../src/display/wasm_factory.js",
"display-fetch_stream": "../src/display/fetch_stream.js",
"display-network": "../src/display/network.js",
"display-node_stream": "../src/display/stubs.js",
"display-node_utils": "../src/display/stubs.js"
}
}
</script>
<script src="pdf_internal_viewer.js" type="module"></script>
<!--#endif-->
</body>
</html>