[add] xqdoca
This commit is contained in:
parent
ff523efdb9
commit
6b78cbb15f
26 changed files with 4505 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -2,4 +2,4 @@ data/
|
|||
dist/
|
||||
jars/*
|
||||
!jars/.gitignore
|
||||
docs/xqdoc/
|
||||
docs/xqdoca/
|
||||
11
docs/xqdoc/annotations.html
Normal file
11
docs/xqdoc/annotations.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html><html xmlns="http:/www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/><meta http-equiv="Generator" content="xqdoca - https://github.com/quodatum/xqdoca"/><title>src - xqDocA - xqDocA</title><link rel="shortcut icon" type="image/x-icon" href="resources/xqdoc.png"/><link rel="stylesheet" type="text/css" href="resources/prism/1.29.0/prism.css"/><link rel="stylesheet" type="text/css" href="resources/page.css"/><link rel="stylesheet" type="text/css" href="resources/query.css"/><link rel="stylesheet" type="text/css" href="resources/base.css"/></head><body class="home" id="top"><div id="main" class="line-numbers"><div><h1>
|
||||
Project
|
||||
<span class="badge badge-info">src</span>
|
||||
Annotations
|
||||
</h1><nav id="toc"><h2><a href="index.html">src</a>
|
||||
/ Annotations
|
||||
</h2><span class="ml-2"><a href="imports.html" title="Summary of import usage " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports</a><a href="mermaid.html" title="Project wide module imports as html mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports-diag</a><a href="mermaid.mmd" title="Project wide module imports as a mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">imports-diag.mmd</a><a href="index.html" title="Index of sources " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">report</a><a href="restxq.html" title="Summary of REST interface " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">restxq</a><a href="validation-report.xml" title="validate generated xqdoc files " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoc-validate</a><a href="xqdoca.xml" title="xqDocA run configuration report (XML) " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoca.xml</a></span><h3>
|
||||
Contents
|
||||
</h3><ol class="toc"><li><a href="#summary"><span class="secno">1 </span><span class="content">Summary</span></a></li><li><a href="#annotations"><span class="secno">2 </span><span class="content">Annotations</span></a><ol><li><a href="#http://www.w3.org/2012/xquery"><span class="secno">2.1 </span><span class="content">http://www.w3.org/2012/xquery</span></a></li></ol></li></ol></nav><section id="summary"><h2>Summary</h2><p>This project uses 1 annotation namespaces.</p><details><summary>Related documents</summary><table class="data"><thead><th>View</th><th>Description</th><th>Format</th></thead><tbody><tr><td><a href="index.html" title="Index of sources " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">report</a></td><td>Index of sources</td><td>xhtml</td></tr><tr><td><a href="restxq.html" title="Summary of REST interface " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">restxq</a></td><td>Summary of REST interface</td><td>xhtml</td></tr><tr><td><a href="imports.html" title="Summary of import usage " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports</a></td><td>Summary of import usage</td><td>xhtml</td></tr><tr><td><a href="mermaid.html" title="Project wide module imports as html mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports-diag</a></td><td>Project wide module imports as html mermaid class diagram</td><td>html5</td></tr><tr><td><a href="mermaid.mmd" title="Project wide module imports as a mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">imports-diag.mmd</a></td><td>Project wide module imports as a mermaid class diagram</td><td>text</td></tr><tr><td><a href="xqdoca.xml" title="xqDocA run configuration report (XML) " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoca.xml</a></td><td>xqDocA run configuration report (XML)</td><td>xml</td></tr><tr><td><a href="validation-report.xml" title="validate generated xqdoc files " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoc-validate</a></td><td>validate generated xqdoc files</td><td>xml</td></tr></tbody></table></details></section><section id="annotations"><h2>Annotations</h2><section id="http://www.w3.org/2012/xquery"><h3>2.1 http://www.w3.org/2012/xquery</h3><span style="margin-left:1em"><a href="#{http://www.w3.org/2012/xquery}private">private</a></span><div class="div4"><h4><a id="{http://www.w3.org/2012/xquery}private"></a>{http://www.w3.org/2012/xquery}private<div style="float:right"><span class="badge badge-info">7</span></div></h4><table class="data"><thead><tr><th>Attached to</th><th>Values</th></tr></thead><tbody><tr><td><span><a href="modules/F000001/index.html#{org.expkg_zone58.Pdfbox3}$property-map" title="Pdfbox3.xqm">pdfbox:$property-map</a></span></td><td>()</td></tr><tr><td><span><a href="modules/F000001/index.html#{org.expkg_zone58.Pdfbox3}read-stream#2" title="Pdfbox3.xqm">pdfbox:read-stream#2</a></span></td><td>()</td></tr><tr><td><span><a href="modules/F000001/index.html#{org.expkg_zone58.Pdfbox3}outline_#2" title="Pdfbox3.xqm">pdfbox:outline_#2</a></span></td><td>()</td></tr><tr><td><span><a href="modules/F000001/index.html#{org.expkg_zone58.Pdfbox3}bookmark-xml#1" title="Pdfbox3.xqm">pdfbox:bookmark-xml#1</a></span></td><td>()</td></tr><tr><td><span><a href="modules/F000001/index.html#{org.expkg_zone58.Pdfbox3}bookmark#2" title="Pdfbox3.xqm">pdfbox:bookmark#2</a></span></td><td>()</td></tr><tr><td><span><a href="modules/F000001/index.html#{org.expkg_zone58.Pdfbox3}gregToISO#1" title="Pdfbox3.xqm">pdfbox:gregToISO#1</a></span></td><td>()</td></tr><tr><td><span><a href="modules/F000001/index.html#{org.expkg_zone58.Pdfbox3}do-until#3" title="Pdfbox3.xqm">pdfbox:do-until#3</a></span></td><td>()</td></tr></tbody></table></div></section></section></div></div><div class="footer"><p style="text-align:right">Generated by
|
||||
<a href="https://github.com/Quodatum/xqdoca" target="_blank">xqDocA <span>0.9.1</span></a>
|
||||
on <span title="2025-06-01T21:16:07.687+01:00">Sunday, 1st June 2025</span></p></div><script src="resources/prism/1.29.0/prism.js" type="text/javascript"></script><script src="resources/xqdoca.js" type="text/javascript"></script></body></html>
|
||||
9
docs/xqdoc/imports.html
Normal file
9
docs/xqdoc/imports.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html><html xmlns="http:/www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/><meta http-equiv="Generator" content="xqdoca - https://github.com/quodatum/xqdoca"/><title>src - xqDocA - xqDocA</title><link rel="shortcut icon" type="image/x-icon" href="resources/xqdoc.png"/><link rel="stylesheet" type="text/css" href="resources/prism/1.29.0/prism.css"/><link rel="stylesheet" type="text/css" href="resources/page.css"/><link rel="stylesheet" type="text/css" href="resources/query.css"/><link rel="stylesheet" type="text/css" href="resources/base.css"/></head><body class="home" id="top"><div id="main" class="line-numbers"><div><h1>Project <span class="badge badge-info">src</span>
|
||||
Imports
|
||||
</h1><nav id="toc"><h2><a href="index.html">src</a>
|
||||
/ Imports
|
||||
</h2><span class="ml-2"><a href="annotations.html" title="Summary of XQuery annotation use " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">annotations</a><a href="mermaid.html" title="Project wide module imports as html mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports-diag</a><a href="mermaid.mmd" title="Project wide module imports as a mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">imports-diag.mmd</a><a href="index.html" title="Index of sources " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">report</a><a href="restxq.html" title="Summary of REST interface " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">restxq</a><a href="validation-report.xml" title="validate generated xqdoc files " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoc-validate</a><a href="xqdoca.xml" title="xqDocA run configuration report (XML) " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoca.xml</a></span><h3>
|
||||
Contents
|
||||
</h3><ol class="toc"><li><a href="#summary"><span class="secno">1 </span><span class="content">Summary</span></a></li><li><a href="#imports"><span class="secno">2 </span><span class="content">Imports</span></a><ol></ol></li></ol></nav><section id="summary"><h2>Summary</h2><p>Lists all modules imported.</p><details><summary>Related documents</summary><table class="data"><thead><th>View</th><th>Description</th><th>Format</th></thead><tbody><tr><td><a href="index.html" title="Index of sources " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">report</a></td><td>Index of sources</td><td>xhtml</td></tr><tr><td><a href="restxq.html" title="Summary of REST interface " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">restxq</a></td><td>Summary of REST interface</td><td>xhtml</td></tr><tr><td><a href="mermaid.html" title="Project wide module imports as html mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports-diag</a></td><td>Project wide module imports as html mermaid class diagram</td><td>html5</td></tr><tr><td><a href="mermaid.mmd" title="Project wide module imports as a mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">imports-diag.mmd</a></td><td>Project wide module imports as a mermaid class diagram</td><td>text</td></tr><tr><td><a href="annotations.html" title="Summary of XQuery annotation use " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">annotations</a></td><td>Summary of XQuery annotation use</td><td>xhtml</td></tr><tr><td><a href="xqdoca.xml" title="xqDocA run configuration report (XML) " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoca.xml</a></td><td>xqDocA run configuration report (XML)</td><td>xml</td></tr><tr><td><a href="validation-report.xml" title="validate generated xqdoc files " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoc-validate</a></td><td>validate generated xqdoc files</td><td>xml</td></tr></tbody></table></details></section><section id="imports"><h2>Imports (0)</h2></section></div></div><div class="footer"><p style="text-align:right">Generated by
|
||||
<a href="https://github.com/Quodatum/xqdoca" target="_blank">xqDocA <span>0.9.1</span></a>
|
||||
on <span title="2025-06-01T21:16:07.687+01:00">Sunday, 1st June 2025</span></p></div><script src="resources/prism/1.29.0/prism.js" type="text/javascript"></script><script src="resources/xqdoca.js" type="text/javascript"></script></body></html>
|
||||
14
docs/xqdoc/index.html
Normal file
14
docs/xqdoc/index.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html><html xmlns="http:/www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/><meta http-equiv="Generator" content="xqdoca - https://github.com/quodatum/xqdoca"/><title>src - xqDocA - xqDocA</title><link rel="shortcut icon" type="image/x-icon" href="resources/xqdoc.png"/><link rel="stylesheet" type="text/css" href="resources/prism/1.29.0/prism.css"/><link rel="stylesheet" type="text/css" href="resources/page.css"/><link rel="stylesheet" type="text/css" href="resources/query.css"/><link rel="stylesheet" type="text/css" href="resources/base.css"/></head><body class="home" id="top"><div id="main" class="line-numbers"><div><h1>
|
||||
Project <span class="badge badge-info">src</span>
|
||||
XQuery source documentation
|
||||
</h1><nav id="toc"><h2 class="h3 d-inline-block"><a href="../index.html" class="mr-5 bg-info">↖</a><a id="contents"></a>src</h2><span class="ml-2"><a href="annotations.html" title="Summary of XQuery annotation use " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">annotations</a><a href="imports.html" title="Summary of import usage " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports</a><a href="mermaid.html" title="Project wide module imports as html mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports-diag</a><a href="mermaid.mmd" title="Project wide module imports as a mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">imports-diag.mmd</a><a href="restxq.html" title="Summary of REST interface " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">restxq</a><a href="validation-report.xml" title="validate generated xqdoc files " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoc-validate</a><a href="xqdoca.xml" title="xqDocA run configuration report (XML) " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoca.xml</a></span><ol class="toc"><li><a href="#summary"><span class="secno">1</span><span class="content">Summary</span></a></li><li><a href="#main_mods"><span class="secno">2</span><span class="content"> XQuery Main (0)</span></a></li><li><a href="#library_mods"><span class="secno">3</span><span class="content"> XQuery Library (1)</span></a></li><li><a href="#file"><span class="secno">4</span><span class="content">File view (1)</span></a></li><li><a href="#annotation"><span class="secno">5</span><span class="content">Annotation namespaces (1)</span></a><ol><li><a href="#http://www.w3.org/2012/xquery"><span class="secno">5.1</span><span class="content">http://www.w3.org/2012/xquery</span></a></li></ol></li></ol></nav></div><section id="summary"><h2>Summary</h2><p>The project
|
||||
<span class="badge badge-info">src</span> contains
|
||||
1 XQuery source files, and uses
|
||||
1 annotation namespaces.
|
||||
</p><p>This document was built from source folder <kbd>C:/Users/mrwhe/git/expkg-zone58/pdfbox/src/</kbd> on
|
||||
<span title="2025-06-01T21:16:07.687+01:00">Sunday, 1st June 2025</span>.</p><details><summary>Related documents</summary><table class="data"><thead><th>View</th><th>Description</th><th>Format</th></thead><tbody><tr><td><a href="index.html" title="Index of sources " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">report</a></td><td>Index of sources</td><td>xhtml</td></tr><tr><td><a href="restxq.html" title="Summary of REST interface " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">restxq</a></td><td>Summary of REST interface</td><td>xhtml</td></tr><tr><td><a href="imports.html" title="Summary of import usage " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports</a></td><td>Summary of import usage</td><td>xhtml</td></tr><tr><td><a href="mermaid.html" title="Project wide module imports as html mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports-diag</a></td><td>Project wide module imports as html mermaid class diagram</td><td>html5</td></tr><tr><td><a href="mermaid.mmd" title="Project wide module imports as a mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">imports-diag.mmd</a></td><td>Project wide module imports as a mermaid class diagram</td><td>text</td></tr><tr><td><a href="annotations.html" title="Summary of XQuery annotation use " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">annotations</a></td><td>Summary of XQuery annotation use</td><td>xhtml</td></tr><tr><td><a href="xqdoca.xml" title="xqDocA run configuration report (XML) " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoca.xml</a></td><td>xqDocA run configuration report (XML)</td><td>xml</td></tr><tr><td><a href="validation-report.xml" title="validate generated xqdoc files " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoc-validate</a></td><td>validate generated xqdoc files</td><td>xml</td></tr></tbody></table></details></section><section id="main_mods"><h2> XQuery Main (0)</h2><div><p>None</p></div></section><section id="library_mods"><h2> XQuery Library (1)</h2><div><table class="data"><colgroup><col style="width: 35%;"/><col style="width: 10%;"/><col style="width: 25%;"/><col style="width: 10%;"/><col style="width: 10%;"/><col style="width: 10%;"/></colgroup><thead><tr><th>Uri</th><th>Prefix</th><th>Description</th><th>Use</th><th title="Annotations">A</th><th>Metrics</th></tr></thead><tbody><tr><td style="word-break:break-all;"><span><a href="modules/F000001/index.html" title="A BaseX 10.7+ interface to pdfbox 3.0 https://pdfbox.apache.org/ , requires pdfbox jars on classpath, i.e. in custom or xar tested with pdfbox-app-3.0.5.jar ">org.expkg_zone58.Pdfbox3</a></span></td><td title="prefix">pdfbox</td><td title="A BaseX 10.7+ interface to pdfbox 3.0 https://pdfbox.apache.org/ , requires pdfbox jars on classpath, i.e. in custom or xar tested with pdfbox-app-3.0.5.jar ">
|
||||

|
||||
A BaseX 10.7+ interface to pdfbox 3.0 https...</td><td><div><div title="imported by">0<span>↖</span></div><div title="Library module" class="badge badge-info">Library</div><div title="imports" style="float:right">↖0</div></div></td><td title="http://www.w3.org/2012/xquery"><span class="badge badge-dark" title="Private">P</span></td><td style="text-align: right"><div>V#1</div><div>F#31</div></td></tr></tbody></table></div></section><section id="file"><h2>File view (1)</h2><ul class="tree"><li><a href="modules/F000001/index.html">Pdfbox3.xqm</a></li></ul></section><section id="annotation"><h2>Annotation namespaces (1)</h2><p> A total of 7 annotations are defined.
|
||||
</p><section id="http://www.w3.org/2012/xquery"><h3>http://www.w3.org/2012/xquery</h3><div><span style="margin-right:1em;"><a href="annotations.html#{http://www.w3.org/2012/xquery}private">private</a><span class="badge badge-info">7</span></span></div></section></section></div><div class="footer"><p style="text-align:right">Generated by
|
||||
<a href="https://github.com/Quodatum/xqdoca" target="_blank">xqDocA <span>0.9.1</span></a>
|
||||
on <span title="2025-06-01T21:16:07.687+01:00">Sunday, 1st June 2025</span></p></div><script src="resources/prism/1.29.0/prism.js" type="text/javascript"></script><script src="resources/xqdoca.js" type="text/javascript"></script></body></html>
|
||||
35
docs/xqdoc/mermaid.html
Normal file
35
docs/xqdoc/mermaid.html
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta http-equiv="Generator" content="xqdoca - https://github.com/quodatum/xqdoca"><title>Module imports diagram - xqDocA</title><link rel="shortcut icon" type="image/x-icon" href="resources/xqdoc.png"><link rel="stylesheet" type="text/css" href="resources/prism/1.29.0/prism.css"><link rel="stylesheet" type="text/css" href="resources/page.css"><!--
|
||||
<link rel="stylesheet" type="text/css" href="{ $resources }query.css" />
|
||||
<link rel="stylesheet" type="text/css" href="{ $resources }base.css" />
|
||||
--></head><body><nav id="toc" style="position:absolute;top:0"><span><span class="badge badge-info">src</span> - Module dependancy diagram</span><span class="ml-2"><a href="annotations.html" title="Summary of XQuery annotation use " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">annotations</a><a href="imports.html" title="Summary of import usage " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports</a><a href="mermaid.html" title="Project wide module imports as html mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports-diag</a><a href="mermaid.mmd" title="Project wide module imports as a mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">imports-diag.mmd</a><a href="index.html" title="Index of sources " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">report</a><a href="restxq.html" title="Summary of REST interface " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">restxq</a><a href="validation-report.xml" title="validate generated xqdoc files " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoc-validate</a><a href="xqdoca.xml" title="xqDocA run configuration report (XML) " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoca.xml</a></span></nav><div class="mermaid">---
|
||||
title: something here
|
||||
config:
|
||||
theme: base
|
||||
securityLevel: loose
|
||||
---
|
||||
classDiagram
|
||||
direction TB
|
||||
|
||||
class RESTXQ:::cssrest
|
||||
class INVOKE:::cssmain
|
||||
class TEST:::cssunit
|
||||
|
||||
class pdfbox { << Pdfbox3.xqm >>}
|
||||
|
||||
|
||||
|
||||
classDef cssrest fill:palegreen
|
||||
classDef cssmain fill:powderblue
|
||||
classDef cssunit fill:yellow
|
||||
|
||||
link pdfbox "modules/F000001/index.html" "This is a tooltip for org.expkg_zone58.Pdfbox3"
|
||||
|
||||
|
||||
</div><script type="module">
|
||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
|
||||
mermaid.initialize({
|
||||
startOnLoad:true,
|
||||
logLevel: "error",
|
||||
securityLevel: "loose",
|
||||
theme: (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) ? "dark" : "default"
|
||||
});</script></body></html>
|
||||
24
docs/xqdoc/mermaid.mmd
Normal file
24
docs/xqdoc/mermaid.mmd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
title: something here
|
||||
config:
|
||||
theme: base
|
||||
securityLevel: loose
|
||||
---
|
||||
classDiagram
|
||||
direction TB
|
||||
|
||||
class RESTXQ:::cssrest
|
||||
class INVOKE:::cssmain
|
||||
class TEST:::cssunit
|
||||
|
||||
class pdfbox { << Pdfbox3.xqm >>}
|
||||
|
||||
|
||||
|
||||
classDef cssrest fill:palegreen
|
||||
classDef cssmain fill:powderblue
|
||||
classDef cssunit fill:yellow
|
||||
|
||||
link pdfbox "modules/F000001/index.html" "This is a tooltip for org.expkg_zone58.Pdfbox3"
|
||||
|
||||
|
||||
842
docs/xqdoc/modules/F000001/index.html
Normal file
842
docs/xqdoc/modules/F000001/index.html
Normal file
File diff suppressed because one or more lines are too long
774
docs/xqdoc/modules/F000001/xqdoc.xml
Normal file
774
docs/xqdoc/modules/F000001/xqdoc.xml
Normal file
|
|
@ -0,0 +1,774 @@
|
|||
<xqdoc:xqdoc xmlns:xqdoc="http://www.xqdoc.org/1.0"><xqdoc:control><xqdoc:date>2025-06-01T21:16:07.687+01:00</xqdoc:date><xqdoc:version>1.1</xqdoc:version></xqdoc:control><xqdoc:module type="library"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>pdfbox</xqdoc:name><xqdoc:comment><xqdoc:description>
|
||||

|
||||
A BaseX 10.7+ interface to pdfbox 3.0 https://pdfbox.apache.org/ ,
|
||||
requires pdfbox jars on classpath, i.e. in custom or xar
|
||||
tested with pdfbox-app-3.0.5.jar
|
||||
</xqdoc:description><xqdoc:author>Andy Bunce 2025</xqdoc:author><xqdoc:see>https://pdfbox.apache.org/download.cgi</xqdoc:see><xqdoc:custom tag="javadoc">https://javadoc.io/static/org.apache.pdfbox/pdfbox/3.0.5/</xqdoc:custom></xqdoc:comment><xqdoc:body>xquery version '3.1';
|
||||
(:~ 
|
||||
A BaseX 10.7+ interface to pdfbox 3.0 https://pdfbox.apache.org/ , 
|
||||
requires pdfbox jars on classpath, i.e. in custom or xar
|
||||
tested with pdfbox-app-3.0.5.jar
|
||||
@see https://pdfbox.apache.org/download.cgi
|
||||
@javadoc https://javadoc.io/static/org.apache.pdfbox/pdfbox/3.0.5/
|
||||
@author Andy Bunce 2025
|
||||
:)
|
||||

|
||||
module namespace pdfbox="org.expkg_zone58.Pdfbox3";
|
||||

|
||||
declare namespace Loader ="java:org.apache.pdfbox.Loader"; 
|
||||
declare namespace PDFTextStripper = "java:org.apache.pdfbox.text.PDFTextStripper";
|
||||
declare namespace PDDocument ="java:org.apache.pdfbox.pdmodel.PDDocument";
|
||||
declare namespace PDDocumentCatalog ="java:org.apache.pdfbox.pdmodel.PDDocumentCatalog";
|
||||
declare namespace PDPageLabels ="java:org.apache.pdfbox.pdmodel.common.PDPageLabels";
|
||||
declare namespace PageExtractor ="java:org.apache.pdfbox.multipdf.PageExtractor";
|
||||
declare namespace PDPage ="java:org.apache.pdfbox.pdmodel.PDPage";
|
||||
declare namespace PDPageTree ="java:org.apache.pdfbox.pdmodel.PDPageTree";
|
||||
declare namespace PDDocumentOutline ="java:org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocumentOutline";
|
||||
declare namespace PDDocumentInformation ="java:org.apache.pdfbox.pdmodel.PDDocumentInformation";
|
||||
declare namespace PDOutlineItem="java:org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem";
|
||||
declare namespace PDFRenderer="java:org.apache.pdfbox.rendering.PDFRenderer";
|
||||
declare namespace PDMetadata="java:org.apache.pdfbox.pdmodel.common.PDMetadata";
|
||||
declare namespace COSInputStream="java:org.apache.pdfbox.cos.COSInputStream";
|
||||

|
||||
declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||

|
||||

|
||||
declare namespace RandomAccessReadBuffer="java:org.apache.pdfbox.io.RandomAccessReadBuffer";
|
||||
declare namespace RandomAccessReadBufferedFile = "java:org.apache.pdfbox.io.RandomAccessReadBufferedFile";
|
||||
declare namespace PDRectangle="org.apache.pdfbox.pdmodel.common.PDRectangle";
|
||||

|
||||
declare namespace File ="java:java.io.File";
|
||||

|
||||

|
||||

|
||||
(:~ with-document pattern: open pdf,apply function, close pdf
|
||||
creates a local pdfobject and ensures it is closed after use
|
||||
e.g pdfbox:with-pdf("path...",pdfbox:page-text(?,5))
|
||||
:)
|
||||
declare function pdfbox:with-pdf($src as xs:string,
|
||||
$fn as function(item())as item()*)
|
||||
as item()*{
|
||||
let $pdf:=pdfbox:open($src)
|
||||
return try{
|
||||
$fn($pdf),pdfbox:close($pdf)
|
||||
} catch *{
|
||||
pdfbox:close($pdf),fn:error($err:code,$src || " " || $err:description)
|
||||
}
|
||||

|
||||
};
|
||||

|
||||

|
||||
(:~ open pdf using fetch:binary, returns pdf object :)
|
||||
declare function pdfbox:open($pdfsrc as item())
|
||||
as item(){
|
||||
pdfbox:open($pdfsrc, map{})
|
||||
};
|
||||

|
||||
(:~ open pdf from file/url/binary, opts may have password , returns pdf object 
|
||||
@param $pdfsrc a fetchable url or filepath, or xs:base64Binary item
|
||||
@param $opts options otionally with map {"password":} 
|
||||
:)
|
||||
declare function pdfbox:open($pdfsrc as item(), $opts as map(*))
|
||||
as item(){
|
||||
try{
|
||||

|
||||
if($pdfsrc instance of xs:base64Binary)
|
||||
then Loader:loadPDF( $pdfsrc,string($opts?password))
|
||||
else if(starts-with($pdfsrc,"http"))
|
||||
then Loader:loadPDF( fetch:binary($pdfsrc),string($opts?password))
|
||||
else Loader:loadPDF(RandomAccessReadBufferedFile:new($pdfsrc),string($opts?password))
|
||||

|
||||
} catch *{
|
||||
let $loc:=if($pdfsrc instance of xs:base64Binary)
|
||||
then "xs:base64Binary"
|
||||
else $pdfsrc
|
||||
return error(xs:QName("pdfbox:open"),"Failed PDF load " || $loc || " " || $err:description)
|
||||
}
|
||||
};
|
||||

|
||||
(:~ The version of the PDF specification used by $pdf e.g "1.4"
|
||||
returned as string to avoid float rounding issues
|
||||
:)
|
||||
declare function pdfbox:specification($pdf as item())
|
||||
as xs:string{
|
||||
PDDocument:getVersion($pdf)=>xs:decimal()=>round(4)=>string()
|
||||
};
|
||||

|
||||
(:~ Save pdf $pdf to filesystem at $savepath , returns $savepath :)
|
||||
declare function pdfbox:save($pdf as item(),$savepath as xs:string)
|
||||
as xs:string{
|
||||
PDDocument:save($pdf, File:new($savepath)),$savepath
|
||||
};
|
||||

|
||||
(:~ Create binary representation of $pdf object as xs:base64Binary :)
|
||||
declare function pdfbox:binary($pdf as item())
|
||||
as xs:base64Binary{
|
||||
let $bytes:=Q{java:java.io.ByteArrayOutputStream}new()
|
||||
let $_:=PDDocument:save($pdf, $bytes)
|
||||
return Q{java:java.io.ByteArrayOutputStream}toByteArray($bytes)
|
||||
=>convert:integers-to-base64()
|
||||
};
|
||||

|
||||
(:~ Release any resources related to $pdf:)
|
||||
declare function pdfbox:close($pdf as item())
|
||||
as empty-sequence(){
|
||||
(# db:wrapjava void #) {
|
||||
PDDocument:close($pdf)
|
||||
}
|
||||
};
|
||||

|
||||
(:~ Number of pages in PDF:)
|
||||
declare function pdfbox:number-of-pages($pdf as item())
|
||||
as xs:integer{
|
||||
PDDocument:getNumberOfPages($pdf)
|
||||
};
|
||||

|
||||
(:~ Pdf page as image (zero is cover)
|
||||
options.format="bmp jpg png gif" etc, options.scale= 1 is 72 dpi?? :)
|
||||
declare function pdfbox:page-render($pdf as item(),$pageNo as xs:integer,$options as map(*))
|
||||
as xs:base64Binary{
|
||||
let $options:=map:merge(($options,map{"format":"jpg","scale":1}))
|
||||
let $bufferedImage:=PDFRenderer:new($pdf)=>PDFRenderer:renderImage($pageNo,$options?scale)
|
||||
let $bytes:=Q{java:java.io.ByteArrayOutputStream}new()
|
||||
let $_:=Q{java:javax.imageio.ImageIO}write($bufferedImage ,$options?format, $bytes)
|
||||
return Q{java:java.io.ByteArrayOutputStream}toByteArray($bytes)
|
||||
=>convert:integers-to-base64()
|
||||

|
||||
};
|
||||

|
||||

|
||||
(:~ property access map
|
||||
keys are property names, 
|
||||
values are sequences of functions to get property from $pdf object
|
||||
:)
|
||||
declare %private variable $pdfbox:property-map:=map{
|
||||
"pageCount": pdfbox:number-of-pages#1,
|
||||

|
||||
"hasOutline": pdfbox:hasOutline#1,
|
||||

|
||||
"hasLabels": pdfbox:hasLabels#1,
|
||||

|
||||
"specification":pdfbox:specification#1,
|
||||

|
||||
"title": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getTitle#1) ,
|
||||

|
||||
"author": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getAuthor#1 ),
|
||||

|
||||
"creator": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getCreator#1),
|
||||

|
||||
"producer": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getProducer#1),
|
||||

|
||||
"subject": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getSubject#1),
|
||||

|
||||
"keywords": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getKeywords#1),
|
||||

|
||||
"creationDate": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getCreationDate#1,
|
||||
pdfbox:gregToISO#1),
|
||||

|
||||
"modificationDate": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getModificationDate#1,
|
||||
pdfbox:gregToISO#1)
|
||||
};
|
||||

|
||||
(:~ known property names sorted :)
|
||||
declare function pdfbox:property-names() 
|
||||
as xs:string*{
|
||||
$pdfbox:property-map=>map:keys()=>sort()
|
||||
};
|
||||

|
||||
(:~ return value of $property for $pdf :)
|
||||
declare function pdfbox:property($pdf as item(),$property as xs:string)
|
||||
as item()*{
|
||||
let $fns:= $pdfbox:property-map($property)
|
||||
return if(exists($fns))
|
||||
then fold-left($fns, 
|
||||
$pdf, 
|
||||
function($result,$this as function(*)){$this($result)})
|
||||
else error(xs:QName('pdfbox:property'),concat("Property '",$property,"' not defined."))
|
||||
};
|
||||

|
||||
(:~ summary CSV style info for all properties for $pdfpaths 
|
||||
:)
|
||||
declare function pdfbox:report($pdfpaths as xs:string*)
|
||||
as map(*){
|
||||
pdfbox:report($pdfpaths,map:keys($pdfbox:property-map))
|
||||
};
|
||||

|
||||
(:~ summary CSV style info for named properties for $pdfpaths 
|
||||
@see https://docs.basex.org/main/CSV_Functions#xquery
|
||||
:)
|
||||
declare function pdfbox:report($pdfpaths as item()*, $properties as xs:string*)
|
||||
as map(*){
|
||||
map{"names": array{"path",$properties},
|
||||

|
||||
"records": for $path in $pdfpaths
|
||||
let $name:=if($path instance of xs:base64Binary) then "binary" else $path
|
||||
return try{
|
||||
let $pdf:=pdfbox:open($path)
|
||||
return (fold-left($properties,
|
||||
array{$name},
|
||||
function($result as array(*),$prop as xs:string){
|
||||
array:append($result, string(pdfbox:property($pdf, $prop)))}
|
||||
), pdfbox:close($pdf)
|
||||
)
|
||||
} catch *{
|
||||
fold-left($properties,
|
||||
array{$name},
|
||||
function($result as array(*),$prop as xs:string){
|
||||
array:append($result, "#ERROR")}
|
||||
)
|
||||
}
|
||||

|
||||
}
|
||||
};
|
||||

|
||||
(:~ true if $pdf has an outline :)
|
||||
declare function pdfbox:hasOutline($pdf as item())
|
||||
as xs:boolean{
|
||||
PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getDocumentOutline()
|
||||
=>exists()
|
||||
};
|
||||

|
||||
(:~ true if $pdf has Labels :)
|
||||
declare function pdfbox:hasLabels($pdf as item())
|
||||
as xs:boolean{
|
||||
PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getPageLabels()
|
||||
=>exists()
|
||||
};
|
||||

|
||||
(:~ XMP metadata as "RDF" document
|
||||
@note usually rdf:RDF root, but sometimes x:xmpmeta 
|
||||
:)
|
||||
declare function pdfbox:metadata($pdf as item())
|
||||
as document-node(element(*))?
|
||||
{
|
||||
let $m:=PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getMetadata()
|
||||
return if(exists($m))
|
||||
then 
|
||||
let $is:=PDMetadata:exportXMPMetadata($m)
|
||||
return pdfbox:do-until(
|
||||
map{"n":0,"data":""},
|
||||

|
||||
function($input,$pos ) { pdfbox:read-stream($is,$input?data)},
|
||||

|
||||
function($output,$pos) { $output?n eq -1 } 
|
||||
)?data=>parse-xml()
|
||||
else ()
|
||||
};
|
||||

|
||||
(:~ read next block from XMP stream :)
|
||||
declare %private function pdfbox:read-stream($is,$read as xs:string)
|
||||
as map(*){
|
||||
let $blen:=4096
|
||||
let $buff:=Q{java:java.util.Arrays}copyOf(array{xs:byte(0)},$blen)
|
||||
let $n:= COSInputStream:read($is,$buff,xs:int(0),xs:int($blen))
|
||||
let $data:=convert:integers-to-base64(subsequence($buff,1,$n))=>convert:binary-to-string()
|
||||
return map{"n":$n, "data": $read || $data}
|
||||
};
|
||||

|
||||
(:~ outline for $pdf as map()* :)
|
||||
declare function pdfbox:outline($pdf as item())
|
||||
as map(*)*{
|
||||
(# db:wrapjava some #) {
|
||||
let $outline:=
|
||||
PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getDocumentOutline()
|
||||

|
||||
return if(exists($outline))
|
||||
then pdfbox:outline($pdf,PDOutlineItem:getFirstChild($outline)) 
|
||||
}
|
||||
};
|
||||

|
||||
(:~ return bookmark info for children of $outlineItem as seq of maps :)
|
||||
declare function pdfbox:outline($pdf as item(),$outlineItem as item()?)
|
||||
as map(*)*{
|
||||
let $find as map(*):=pdfbox:outline_($pdf ,$outlineItem)
|
||||
return map:get($find,"list")
|
||||
};
|
||||

|
||||
(:~ BaseX bug 10.7? error if inlined in outline :)
|
||||
declare %private function pdfbox:outline_($pdf as item(),$outlineItem as item()?)
|
||||
as map(*){
|
||||
pdfbox:do-until(
|
||||

|
||||
map{"list":(),"this":$outlineItem},
|
||||

|
||||
function($input,$pos ) { 
|
||||
let $bk:= pdfbox:bookmark($input?this,$pdf)
|
||||
let $bk:= if($bk?hasChildren)
|
||||
then let $kids:=pdfbox:outline($pdf,PDOutlineItem:getFirstChild($input?this))
|
||||
return map:merge(($bk,map:entry("children",$kids)))
|
||||
else $bk 
|
||||
return map{
|
||||
"list": ($input?list, $bk),
|
||||
"this": PDOutlineItem:getNextSibling($input?this)}
|
||||
},
|
||||

|
||||
function($output,$pos) { empty($output?this) } 
|
||||
)
|
||||
};
|
||||

|
||||
(:~ PDF outline in xml format :)
|
||||
declare function pdfbox:outline-xml($pdf as item())
|
||||
as element(outline)?{
|
||||
let $outline:=pdfbox:outline($pdf)
|
||||
return if(exists($outline))
|
||||
then <outline>{$outline!pdfbox:bookmark-xml(.)}</outline>
|
||||
else ()
|
||||
};
|
||||

|
||||
(:~ recursive ouutline map to XML :)
|
||||
declare %private function pdfbox:bookmark-xml($outline as map(*)*)
|
||||
as element(bookmark)*
|
||||
{
|
||||
$outline!
|
||||
<bookmark title="{?title}" index="{?index}">
|
||||
{?children!pdfbox:bookmark-xml(.)}
|
||||
</bookmark>
|
||||
};
|
||||

|
||||
(:~ return bookmark info for $bookmark
|
||||
@return map{index:..,title:..,hasChildren:..}
|
||||
:)
|
||||
declare %private function pdfbox:bookmark($bookmark as item(),$pdf as item())
|
||||
as map(*)
|
||||
{
|
||||
map{ 
|
||||
"index": PDOutlineItem:findDestinationPage($bookmark,$pdf)=>pdfbox:find-page($pdf),
|
||||
"title": (# db:checkstrings #) {PDOutlineItem:getTitle($bookmark)}
|
||||
(:=>translate("<22>",""), :),
|
||||
"hasChildren": PDOutlineItem:hasChildren($bookmark)
|
||||
}
|
||||
};
|
||||

|
||||

|
||||
(:~ pageIndex of $page in $pdf :)
|
||||
declare function pdfbox:find-page(
|
||||
$page as item()? (: as java:org.apache.pdfbox.pdmodel.PDPage :),
|
||||
$pdf as item())
|
||||
as item()?
|
||||
{
|
||||
if(exists($page))
|
||||
then PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getPages()
|
||||
=>PDPageTree:indexOf($page)
|
||||
}; 
|
||||

|
||||
(:~ Return new PDF doc with pages from $start to $end as xs:base64Binary, (1 based) 
|
||||
@param $start first page to include
|
||||
@param $end last page to include
|
||||
:)
|
||||
declare function pdfbox:extract-range($pdf as item(), 
|
||||
$start as xs:integer,$end as xs:integer)
|
||||
as xs:base64Binary
|
||||
{
|
||||
let $a:=PageExtractor:new($pdf, $start, $end) =>PageExtractor:extract()
|
||||
return (pdfbox:binary($a),pdfbox:close($a)) 
|
||||
};
|
||||

|
||||

|
||||
(:~ pageLabel for every page or empty if none
|
||||
@see https://www.w3.org/TR/WCAG20-TECHS/PDF17.html#PDF17-examples
|
||||
@see https://codereview.stackexchange.com/questions/286078/java-code-showing-page-labels-from-pdf-files
|
||||
:)
|
||||
declare function pdfbox:labels($pdf as item())
|
||||
as xs:string*
|
||||
{
|
||||
let $pagelabels:=PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getPageLabels()
|
||||
return if(exists($pagelabels))
|
||||
then PDPageLabels:getLabelsByPageIndices($pagelabels)
|
||||
else ()
|
||||
};
|
||||

|
||||
(:~ return text on $pageNo :)
|
||||
declare function pdfbox:page-text($pdf as item(), $pageNo as xs:integer)
|
||||
as xs:string{
|
||||
let $tStripper := (# db:wrapjava instance #) {
|
||||
PDFTextStripper:new()
|
||||
=> PDFTextStripper:setStartPage($pageNo)
|
||||
=> PDFTextStripper:setEndPage($pageNo)
|
||||
}
|
||||
return (# db:checkstrings #) {PDFTextStripper:getText($tStripper,$pdf)}
|
||||
};
|
||||

|
||||
(:~ return size of $pageNo (zero based)
|
||||
@result e.g. [0.0,0.0,168.0,239.52]
|
||||
:)
|
||||
declare function pdfbox:page-media-box($pdf as item(), $pageNo as xs:integer)
|
||||
as xs:string{
|
||||
PDDocument:getPage($pdf, $pageNo)
|
||||
=>PDPage:getMediaBox()
|
||||
=>PDRectangle:toString()
|
||||
};
|
||||

|
||||
(:~ version of Apache Pdfbox in use e.g. "3.0.4" :)
|
||||
declare function pdfbox:version()
|
||||
as xs:string{
|
||||
Q{java:org.apache.pdfbox.util.Version}getVersion()
|
||||
};
|
||||

|
||||
(:~ convert date :)
|
||||
declare %private
|
||||
function pdfbox:gregToISO($item as item()?)
|
||||
as xs:string?{
|
||||
if(exists($item))
|
||||
then Q{java:java.util.GregorianCalendar}toZonedDateTime($item)=>string()
|
||||
else ()
|
||||
};
|
||||

|
||||
(:~ fn:do-until shim for BaseX 9+10 
|
||||
if fn:do-until not found use hof:until, note: $pos always zero
|
||||
:)
|
||||
declare %private function pdfbox:do-until(
|
||||
$input as item()*, 
|
||||
$action as function(item()*, xs:integer) as item()*, 
|
||||
$predicate as function(item()*, xs:integer) as xs:boolean? 
|
||||
) as item()*
|
||||
{
|
||||
let $fn:=function-lookup(QName('http://www.w3.org/2005/xpath-functions','do-until'), 3)
|
||||
return if(exists($fn))
|
||||
then $fn($input,$action,$predicate)
|
||||
else let $hof:=function-lookup(QName('http://basex.org/modules/hof','until'), 3)
|
||||
return if(exists($hof))
|
||||
then $hof($predicate(?,0),$action(?,0),$input)
|
||||
else error(xs:QName('pdfbox:do-until'),"No implementation do-until found")
|
||||

|
||||
};
|
||||
</xqdoc:body></xqdoc:module><xqdoc:namespaces><xqdoc:namespace prefix="pdfbox" uri="org.expkg_zone58.Pdfbox3"/><xqdoc:namespace prefix="Loader" uri="java:org.apache.pdfbox.Loader"/><xqdoc:namespace prefix="PDFTextStripper" uri="java:org.apache.pdfbox.text.PDFTextStripper"/><xqdoc:namespace prefix="PDDocument" uri="java:org.apache.pdfbox.pdmodel.PDDocument"/><xqdoc:namespace prefix="PDDocumentCatalog" uri="java:org.apache.pdfbox.pdmodel.PDDocumentCatalog"/><xqdoc:namespace prefix="PDPageLabels" uri="java:org.apache.pdfbox.pdmodel.common.PDPageLabels"/><xqdoc:namespace prefix="PageExtractor" uri="java:org.apache.pdfbox.multipdf.PageExtractor"/><xqdoc:namespace prefix="PDPage" uri="java:org.apache.pdfbox.pdmodel.PDPage"/><xqdoc:namespace prefix="PDPageTree" uri="java:org.apache.pdfbox.pdmodel.PDPageTree"/><xqdoc:namespace prefix="PDDocumentOutline" uri="java:org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocumentOutline"/><xqdoc:namespace prefix="PDDocumentInformation" uri="java:org.apache.pdfbox.pdmodel.PDDocumentInformation"/><xqdoc:namespace prefix="PDOutlineItem" uri="java:org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem"/><xqdoc:namespace prefix="PDFRenderer" uri="java:org.apache.pdfbox.rendering.PDFRenderer"/><xqdoc:namespace prefix="PDMetadata" uri="java:org.apache.pdfbox.pdmodel.common.PDMetadata"/><xqdoc:namespace prefix="COSInputStream" uri="java:org.apache.pdfbox.cos.COSInputStream"/><xqdoc:namespace prefix="rdf" uri="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/><xqdoc:namespace prefix="RandomAccessReadBuffer" uri="java:org.apache.pdfbox.io.RandomAccessReadBuffer"/><xqdoc:namespace prefix="RandomAccessReadBufferedFile" uri="java:org.apache.pdfbox.io.RandomAccessReadBufferedFile"/><xqdoc:namespace prefix="PDRectangle" uri="org.apache.pdfbox.pdmodel.common.PDRectangle"/><xqdoc:namespace prefix="File" uri="java:java.io.File"/><xqdoc:namespace prefix="xs" uri="http://www.w3.org/2001/XMLSchema"/><xqdoc:namespace prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/><xqdoc:namespace prefix="err" uri="http://www.w3.org/2005/xqt-errors"/><xqdoc:namespace prefix="fetch" uri="http://basex.org/modules/fetch"/><xqdoc:namespace prefix="convert" uri="http://basex.org/modules/convert"/><xqdoc:namespace prefix="db" uri="http://basex.org/modules/db"/><xqdoc:namespace prefix="map" uri="http://www.w3.org/2005/xpath-functions/map"/><xqdoc:namespace prefix="array" uri="http://www.w3.org/2005/xpath-functions/array"/></xqdoc:namespaces><xqdoc:variables><xqdoc:variable><xqdoc:name>pdfbox:property-map</xqdoc:name><xqdoc:comment><xqdoc:description>
|
||||
property access map
|
||||
keys are property names,
|
||||
values are sequences of functions to get property from $pdf object
|
||||
</xqdoc:description></xqdoc:comment><xqdoc:annotations><xqdoc:annotation name="private"/></xqdoc:annotations><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>number-of-pages</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>hasOutline</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>hasLabels</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>specification</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentInformation</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocumentInformation</xqdoc:uri><xqdoc:name>getTitle</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentInformation</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocumentInformation</xqdoc:uri><xqdoc:name>getAuthor</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentInformation</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocumentInformation</xqdoc:uri><xqdoc:name>getCreator</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentInformation</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocumentInformation</xqdoc:uri><xqdoc:name>getProducer</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentInformation</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocumentInformation</xqdoc:uri><xqdoc:name>getSubject</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentInformation</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocumentInformation</xqdoc:uri><xqdoc:name>getKeywords</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentInformation</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocumentInformation</xqdoc:uri><xqdoc:name>getCreationDate</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>gregToISO</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentInformation</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocumentInformation</xqdoc:uri><xqdoc:name>getModificationDate</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>gregToISO</xqdoc:name></xqdoc:invoked><xqdoc:body>variable $pdfbox:property-map:=map{
|
||||
"pageCount": pdfbox:number-of-pages#1,
|
||||

|
||||
"hasOutline": pdfbox:hasOutline#1,
|
||||

|
||||
"hasLabels": pdfbox:hasLabels#1,
|
||||

|
||||
"specification":pdfbox:specification#1,
|
||||

|
||||
"title": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getTitle#1) ,
|
||||

|
||||
"author": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getAuthor#1 ),
|
||||

|
||||
"creator": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getCreator#1),
|
||||

|
||||
"producer": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getProducer#1),
|
||||

|
||||
"subject": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getSubject#1),
|
||||

|
||||
"keywords": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getKeywords#1),
|
||||

|
||||
"creationDate": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getCreationDate#1,
|
||||
pdfbox:gregToISO#1),
|
||||

|
||||
"modificationDate": (PDDocument:getDocumentInformation#1,
|
||||
PDDocumentInformation:getModificationDate#1,
|
||||
pdfbox:gregToISO#1)
|
||||
}</xqdoc:body></xqdoc:variable></xqdoc:variables><xqdoc:functions><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
with-document pattern: open pdf,apply function, close pdf
|
||||
creates a local pdfobject and ensures it is closed after use
|
||||
e.g pdfbox:with-pdf("path...",pdfbox:page-text(?,5))
|
||||
</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:with-pdf</xqdoc:name><xqdoc:signature>function pdfbox:with-pdf ( $src as xs:string, $fn as function(item())as item()* ) as item()* { let $pdf:=pdfbox:open($src) return try{ $fn($pdf),pdfbox:close($pdf) } catch *{ pdfbox:close($pdf),fn:error($err:code,$src || " " || $err:description) } }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>src</xqdoc:name><xqdoc:type>xs:string</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>fn</xqdoc:name><xqdoc:type>function(item())as item()*</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="*">item()</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>open</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>close</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>close</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>error</xqdoc:name></xqdoc:invoked><xqdoc:ref-variable><xqdoc:uri>http://www.w3.org/2005/xqt-errors</xqdoc:uri><xqdoc:name>code</xqdoc:name></xqdoc:ref-variable><xqdoc:ref-variable><xqdoc:uri>http://www.w3.org/2005/xqt-errors</xqdoc:uri><xqdoc:name>description</xqdoc:name></xqdoc:ref-variable><xqdoc:body>function pdfbox:with-pdf($src as xs:string,
|
||||
$fn as function(item())as item()*)
|
||||
as item()*{
|
||||
let $pdf:=pdfbox:open($src)
|
||||
return try{
|
||||
$fn($pdf),pdfbox:close($pdf)
|
||||
} catch *{
|
||||
pdfbox:close($pdf),fn:error($err:code,$src || " " || $err:description)
|
||||
}
|
||||

|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
open pdf using fetch:binary, returns pdf object</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:open</xqdoc:name><xqdoc:signature>function pdfbox:open ( $pdfsrc as item() ) as item() { pdfbox:open($pdfsrc, map{}) }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdfsrc</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>item()</xqdoc:type></xqdoc:return><xqdoc:invoked arity="2"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>open</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:open($pdfsrc as item())
|
||||
as item(){
|
||||
pdfbox:open($pdfsrc, map{})
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
open pdf from file/url/binary, opts may have password , returns pdf object
|
||||
</xqdoc:description><xqdoc:param>$pdfsrc a fetchable url or filepath, or xs:base64Binary item</xqdoc:param><xqdoc:param>$opts options otionally with map {"password":}</xqdoc:param></xqdoc:comment><xqdoc:name>pdfbox:open</xqdoc:name><xqdoc:signature>function pdfbox:open ( $pdfsrc as item(), $opts as map(*) ) as item() { try{ if($pdfsrc instance of xs:base64Binary) then Loader:loadPDF( $pdfsrc,string($opts?password)) else if(starts-with($pdfsrc,"http")) then Loader:loadPDF( fetch:binary($pdfsrc),string($opts?password)) else Loader:loadPDF(RandomAccessReadBufferedFile:new($pdfsrc),string($opts?password)) } catch *{ let $loc:=if($pdfsrc instance of xs:base64Binary) then "xs:base64Binary" else $pdfsrc return error(xs:QName("pdfbox:open"),"Failed PDF load " || $loc || " " || $err:description) } }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdfsrc</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>opts</xqdoc:name><xqdoc:type>map(*)</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>item()</xqdoc:type></xqdoc:return><xqdoc:invoked arity="2"><xqdoc:uri>java:org.apache.pdfbox.Loader</xqdoc:uri><xqdoc:name>loadPDF</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>string</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>starts-with</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>java:org.apache.pdfbox.Loader</xqdoc:uri><xqdoc:name>loadPDF</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://basex.org/modules/fetch</xqdoc:uri><xqdoc:name>binary</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>string</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>java:org.apache.pdfbox.Loader</xqdoc:uri><xqdoc:name>loadPDF</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.io.RandomAccessReadBufferedFile</xqdoc:uri><xqdoc:name>new</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>string</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>error</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2001/XMLSchema</xqdoc:uri><xqdoc:name>QName</xqdoc:name></xqdoc:invoked><xqdoc:ref-variable><xqdoc:uri>http://www.w3.org/2005/xqt-errors</xqdoc:uri><xqdoc:name>description</xqdoc:name></xqdoc:ref-variable><xqdoc:body>function pdfbox:open($pdfsrc as item(), $opts as map(*))
|
||||
as item(){
|
||||
try{
|
||||

|
||||
if($pdfsrc instance of xs:base64Binary)
|
||||
then Loader:loadPDF( $pdfsrc,string($opts?password))
|
||||
else if(starts-with($pdfsrc,"http"))
|
||||
then Loader:loadPDF( fetch:binary($pdfsrc),string($opts?password))
|
||||
else Loader:loadPDF(RandomAccessReadBufferedFile:new($pdfsrc),string($opts?password))
|
||||

|
||||
} catch *{
|
||||
let $loc:=if($pdfsrc instance of xs:base64Binary)
|
||||
then "xs:base64Binary"
|
||||
else $pdfsrc
|
||||
return error(xs:QName("pdfbox:open"),"Failed PDF load " || $loc || " " || $err:description)
|
||||
}
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
The version of the PDF specification used by $pdf e.g "1.4"
|
||||
returned as string to avoid float rounding issues
|
||||
</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:specification</xqdoc:name><xqdoc:signature>function pdfbox:specification ( $pdf as item() ) as xs:string { PDDocument:getVersion($pdf)=>xs:decimal()=>round(4)=>string() }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>xs:string</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getVersion</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:specification($pdf as item())
|
||||
as xs:string{
|
||||
PDDocument:getVersion($pdf)=>xs:decimal()=>round(4)=>string()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
Save pdf $pdf to filesystem at $savepath , returns $savepath</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:save</xqdoc:name><xqdoc:signature>function pdfbox:save ( $pdf as item(),$savepath as xs:string ) as xs:string { PDDocument:save($pdf, File:new($savepath)),$savepath }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>savepath</xqdoc:name><xqdoc:type>xs:string</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>xs:string</xqdoc:type></xqdoc:return><xqdoc:invoked arity="2"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>save</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:java.io.File</xqdoc:uri><xqdoc:name>new</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:save($pdf as item(),$savepath as xs:string)
|
||||
as xs:string{
|
||||
PDDocument:save($pdf, File:new($savepath)),$savepath
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
Create binary representation of $pdf object as xs:base64Binary</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:binary</xqdoc:name><xqdoc:signature>function pdfbox:binary ( $pdf as item() ) as xs:base64Binary { let $bytes:=Q{java:java.io.ByteArrayOutputStream}new() let $_:=PDDocument:save($pdf, $bytes) return Q{java:java.io.ByteArrayOutputStream}toByteArray($bytes) =>convert:integers-to-base64() }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>xs:base64Binary</xqdoc:type></xqdoc:return><xqdoc:invoked arity="0"><xqdoc:uri>java:java.io.ByteArrayOutputStream</xqdoc:uri><xqdoc:name>new</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>save</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:java.io.ByteArrayOutputStream</xqdoc:uri><xqdoc:name>toByteArray</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:binary($pdf as item())
|
||||
as xs:base64Binary{
|
||||
let $bytes:=Q{java:java.io.ByteArrayOutputStream}new()
|
||||
let $_:=PDDocument:save($pdf, $bytes)
|
||||
return Q{java:java.io.ByteArrayOutputStream}toByteArray($bytes)
|
||||
=>convert:integers-to-base64()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
Release any resources related to $pdf</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:close</xqdoc:name><xqdoc:signature>function pdfbox:close ( $pdf as item() ) as empty-sequence() { (# db:wrapjava void #) { PDDocument:close($pdf) } }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>empty-sequence</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>close</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:close($pdf as item())
|
||||
as empty-sequence(){
|
||||
(# db:wrapjava void #) {
|
||||
PDDocument:close($pdf)
|
||||
}
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
Number of pages in PDF</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:number-of-pages</xqdoc:name><xqdoc:signature>function pdfbox:number-of-pages ( $pdf as item() ) as xs:integer { PDDocument:getNumberOfPages($pdf) }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>xs:integer</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getNumberOfPages</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:number-of-pages($pdf as item())
|
||||
as xs:integer{
|
||||
PDDocument:getNumberOfPages($pdf)
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="3"><xqdoc:comment><xqdoc:description>
|
||||
Pdf page as image (zero is cover)
|
||||
options.format="bmp jpg png gif" etc, options.scale= 1 is 72 dpi??</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:page-render</xqdoc:name><xqdoc:signature>function pdfbox:page-render ( $pdf as item(),$pageNo as xs:integer,$options as map(*) ) as xs:base64Binary { let $options:=map:merge(($options,map{"format":"jpg","scale":1})) let $bufferedImage:=PDFRenderer:new($pdf)=>PDFRenderer:renderImage($pageNo,$options?scale) let $bytes:=Q{java:java.io.ByteArrayOutputStream}new() let $_:=Q{java:javax.imageio.ImageIO}write($bufferedImage ,$options?format, $bytes) return Q{java:java.io.ByteArrayOutputStream}toByteArray($bytes) =>convert:integers-to-base64() }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>pageNo</xqdoc:name><xqdoc:type>xs:integer</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>options</xqdoc:name><xqdoc:type>map(*)</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>xs:base64Binary</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions/map</xqdoc:uri><xqdoc:name>merge</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.rendering.PDFRenderer</xqdoc:uri><xqdoc:name>new</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="0"><xqdoc:uri>java:java.io.ByteArrayOutputStream</xqdoc:uri><xqdoc:name>new</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="3"><xqdoc:uri>java:javax.imageio.ImageIO</xqdoc:uri><xqdoc:name>write</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:java.io.ByteArrayOutputStream</xqdoc:uri><xqdoc:name>toByteArray</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:page-render($pdf as item(),$pageNo as xs:integer,$options as map(*))
|
||||
as xs:base64Binary{
|
||||
let $options:=map:merge(($options,map{"format":"jpg","scale":1}))
|
||||
let $bufferedImage:=PDFRenderer:new($pdf)=>PDFRenderer:renderImage($pageNo,$options?scale)
|
||||
let $bytes:=Q{java:java.io.ByteArrayOutputStream}new()
|
||||
let $_:=Q{java:javax.imageio.ImageIO}write($bufferedImage ,$options?format, $bytes)
|
||||
return Q{java:java.io.ByteArrayOutputStream}toByteArray($bytes)
|
||||
=>convert:integers-to-base64()
|
||||

|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="0"><xqdoc:comment><xqdoc:description>
|
||||
known property names sorted</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:property-names</xqdoc:name><xqdoc:signature>function pdfbox:property-names ( ) as xs:string* { $pdfbox:property-map=>map:keys()=>sort() }</xqdoc:signature><xqdoc:return><xqdoc:type occurrence="*">xs:string</xqdoc:type></xqdoc:return><xqdoc:ref-variable><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>property-map</xqdoc:name></xqdoc:ref-variable><xqdoc:body>function pdfbox:property-names() 
|
||||
as xs:string*{
|
||||
$pdfbox:property-map=>map:keys()=>sort()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
return value of $property for $pdf</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:property</xqdoc:name><xqdoc:signature>function pdfbox:property ( $pdf as item(),$property as xs:string ) as item()* { let $fns:= $pdfbox:property-map($property) return if(exists($fns)) then fold-left($fns, $pdf, function($result,$this as function(*)){$this($result)}) else error(xs:QName('pdfbox:property'),concat("Property '",$property,"' not defined.")) }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>property</xqdoc:name><xqdoc:type>xs:string</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="*">item()</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>exists</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="3"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>fold-left</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>error</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2001/XMLSchema</xqdoc:uri><xqdoc:name>QName</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="3"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>concat</xqdoc:name></xqdoc:invoked><xqdoc:ref-variable><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>property-map</xqdoc:name></xqdoc:ref-variable><xqdoc:body>function pdfbox:property($pdf as item(),$property as xs:string)
|
||||
as item()*{
|
||||
let $fns:= $pdfbox:property-map($property)
|
||||
return if(exists($fns))
|
||||
then fold-left($fns, 
|
||||
$pdf, 
|
||||
function($result,$this as function(*)){$this($result)})
|
||||
else error(xs:QName('pdfbox:property'),concat("Property '",$property,"' not defined."))
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
summary CSV style info for all properties for $pdfpaths
|
||||
</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:report</xqdoc:name><xqdoc:signature>function pdfbox:report ( $pdfpaths as xs:string* ) as map(*) { pdfbox:report($pdfpaths,map:keys($pdfbox:property-map)) }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdfpaths</xqdoc:name><xqdoc:type occurrence="*">xs:string</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>map(*)</xqdoc:type></xqdoc:return><xqdoc:invoked arity="2"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>report</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions/map</xqdoc:uri><xqdoc:name>keys</xqdoc:name></xqdoc:invoked><xqdoc:ref-variable><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>property-map</xqdoc:name></xqdoc:ref-variable><xqdoc:body>function pdfbox:report($pdfpaths as xs:string*)
|
||||
as map(*){
|
||||
pdfbox:report($pdfpaths,map:keys($pdfbox:property-map))
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
summary CSV style info for named properties for $pdfpaths
|
||||
</xqdoc:description><xqdoc:see>https://docs.basex.org/main/CSV_Functions#xquery</xqdoc:see></xqdoc:comment><xqdoc:name>pdfbox:report</xqdoc:name><xqdoc:signature>function pdfbox:report ( $pdfpaths as item()*, $properties as xs:string* ) as map(*) { map{"names": array{"path",$properties}, "records": for $path in $pdfpaths let $name:=if($path instance of xs:base64Binary) then "binary" else $path return try{ let $pdf:=pdfbox:open($path) return (fold-left($properties, array{$name}, function($result as array(*),$prop as xs:string){ array:append($result, string(pdfbox:property($pdf, $prop)))} ), pdfbox:close($pdf) ) } catch *{ fold-left($properties, array{$name}, function($result as array(*),$prop as xs:string){ array:append($result, "#ERROR")} ) } } }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdfpaths</xqdoc:name><xqdoc:type occurrence="*">item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>properties</xqdoc:name><xqdoc:type occurrence="*">xs:string</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>map(*)</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>open</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="3"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>fold-left</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions/array</xqdoc:uri><xqdoc:name>append</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>string</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>property</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>close</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="3"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>fold-left</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions/array</xqdoc:uri><xqdoc:name>append</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:report($pdfpaths as item()*, $properties as xs:string*)
|
||||
as map(*){
|
||||
map{"names": array{"path",$properties},
|
||||

|
||||
"records": for $path in $pdfpaths
|
||||
let $name:=if($path instance of xs:base64Binary) then "binary" else $path
|
||||
return try{
|
||||
let $pdf:=pdfbox:open($path)
|
||||
return (fold-left($properties,
|
||||
array{$name},
|
||||
function($result as array(*),$prop as xs:string){
|
||||
array:append($result, string(pdfbox:property($pdf, $prop)))}
|
||||
), pdfbox:close($pdf)
|
||||
)
|
||||
} catch *{
|
||||
fold-left($properties,
|
||||
array{$name},
|
||||
function($result as array(*),$prop as xs:string){
|
||||
array:append($result, "#ERROR")}
|
||||
)
|
||||
}
|
||||

|
||||
}
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
true if $pdf has an outline</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:hasOutline</xqdoc:name><xqdoc:signature>function pdfbox:hasOutline ( $pdf as item() ) as xs:boolean { PDDocument:getDocumentCatalog($pdf) =>PDDocumentCatalog:getDocumentOutline() =>exists() }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>xs:boolean</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentCatalog</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:hasOutline($pdf as item())
|
||||
as xs:boolean{
|
||||
PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getDocumentOutline()
|
||||
=>exists()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
true if $pdf has Labels</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:hasLabels</xqdoc:name><xqdoc:signature>function pdfbox:hasLabels ( $pdf as item() ) as xs:boolean { PDDocument:getDocumentCatalog($pdf) =>PDDocumentCatalog:getPageLabels() =>exists() }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>xs:boolean</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentCatalog</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:hasLabels($pdf as item())
|
||||
as xs:boolean{
|
||||
PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getPageLabels()
|
||||
=>exists()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
XMP metadata as "RDF" document
|
||||
</xqdoc:description><xqdoc:custom tag="note">usually rdf:RDF root, but sometimes x:xmpmeta</xqdoc:custom></xqdoc:comment><xqdoc:name>pdfbox:metadata</xqdoc:name><xqdoc:signature>function pdfbox:metadata ( $pdf as item() ) as document-node(element(*))? { let $m:=PDDocument:getDocumentCatalog($pdf) =>PDDocumentCatalog:getMetadata() return if(exists($m)) then let $is:=PDMetadata:exportXMPMetadata($m) return pdfbox:do-until( map{"n":0,"data":""}, function($input,$pos ) { pdfbox:read-stream($is,$input?data)}, function($output,$pos) { $output?n eq -1 } )?data=>parse-xml() else () }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="?">document-node(element(*))</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentCatalog</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>exists</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.common.PDMetadata</xqdoc:uri><xqdoc:name>exportXMPMetadata</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="3"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>do-until</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>read-stream</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:metadata($pdf as item())
|
||||
as document-node(element(*))?
|
||||
{
|
||||
let $m:=PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getMetadata()
|
||||
return if(exists($m))
|
||||
then 
|
||||
let $is:=PDMetadata:exportXMPMetadata($m)
|
||||
return pdfbox:do-until(
|
||||
map{"n":0,"data":""},
|
||||

|
||||
function($input,$pos ) { pdfbox:read-stream($is,$input?data)},
|
||||

|
||||
function($output,$pos) { $output?n eq -1 } 
|
||||
)?data=>parse-xml()
|
||||
else ()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
read next block from XMP stream</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:read-stream</xqdoc:name><xqdoc:annotations><xqdoc:annotation name="private"/></xqdoc:annotations><xqdoc:signature>function pdfbox:read-stream ( $is,$read as xs:string ) as map(*) { let $blen:=4096 let $buff:=Q{java:java.util.Arrays}copyOf(array{xs:byte(0)},$blen) let $n:= COSInputStream:read($is,$buff,xs:int(0),xs:int($blen)) let $data:=convert:integers-to-base64(subsequence($buff,1,$n))=>convert:binary-to-string() return map{"n":$n, "data": $read || $data} }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>is</xqdoc:name></xqdoc:parameter><xqdoc:parameter><xqdoc:name>read</xqdoc:name><xqdoc:type>xs:string</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>map(*)</xqdoc:type></xqdoc:return><xqdoc:invoked arity="2"><xqdoc:uri>java:java.util.Arrays</xqdoc:uri><xqdoc:name>copyOf</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2001/XMLSchema</xqdoc:uri><xqdoc:name>byte</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="4"><xqdoc:uri>java:org.apache.pdfbox.cos.COSInputStream</xqdoc:uri><xqdoc:name>read</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2001/XMLSchema</xqdoc:uri><xqdoc:name>int</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2001/XMLSchema</xqdoc:uri><xqdoc:name>int</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://basex.org/modules/convert</xqdoc:uri><xqdoc:name>integers-to-base64</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="3"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>subsequence</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:read-stream($is,$read as xs:string)
|
||||
as map(*){
|
||||
let $blen:=4096
|
||||
let $buff:=Q{java:java.util.Arrays}copyOf(array{xs:byte(0)},$blen)
|
||||
let $n:= COSInputStream:read($is,$buff,xs:int(0),xs:int($blen))
|
||||
let $data:=convert:integers-to-base64(subsequence($buff,1,$n))=>convert:binary-to-string()
|
||||
return map{"n":$n, "data": $read || $data}
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
outline for $pdf as map()*</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:outline</xqdoc:name><xqdoc:signature>function pdfbox:outline ( $pdf as item() ) as map(*)* { (# db:wrapjava some #) { let $outline:= PDDocument:getDocumentCatalog($pdf) =>PDDocumentCatalog:getDocumentOutline() return if(exists($outline)) then pdfbox:outline($pdf,PDOutlineItem:getFirstChild($outline)) } }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="*">map(*)</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentCatalog</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>exists</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>outline</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem</xqdoc:uri><xqdoc:name>getFirstChild</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:outline($pdf as item())
|
||||
as map(*)*{
|
||||
(# db:wrapjava some #) {
|
||||
let $outline:=
|
||||
PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getDocumentOutline()
|
||||

|
||||
return if(exists($outline))
|
||||
then pdfbox:outline($pdf,PDOutlineItem:getFirstChild($outline)) 
|
||||
}
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
return bookmark info for children of $outlineItem as seq of maps</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:outline</xqdoc:name><xqdoc:signature>function pdfbox:outline ( $pdf as item(),$outlineItem as item()? ) as map(*)* { let $find as map(*):=pdfbox:outline_($pdf ,$outlineItem) return map:get($find,"list") }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>outlineItem</xqdoc:name><xqdoc:type occurrence="?">item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="*">map(*)</xqdoc:type></xqdoc:return><xqdoc:invoked arity="2"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>outline_</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions/map</xqdoc:uri><xqdoc:name>get</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:outline($pdf as item(),$outlineItem as item()?)
|
||||
as map(*)*{
|
||||
let $find as map(*):=pdfbox:outline_($pdf ,$outlineItem)
|
||||
return map:get($find,"list")
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
BaseX bug 10.7? error if inlined in outline</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:outline_</xqdoc:name><xqdoc:annotations><xqdoc:annotation name="private"/></xqdoc:annotations><xqdoc:signature>function pdfbox:outline_ ( $pdf as item(),$outlineItem as item()? ) as map(*) { pdfbox:do-until( map{"list":(),"this":$outlineItem}, function($input,$pos ) { let $bk:= pdfbox:bookmark($input?this,$pdf) let $bk:= if($bk?hasChildren) then let $kids:=pdfbox:outline($pdf,PDOutlineItem:getFirstChild($input?this)) return map:merge(($bk,map:entry("children",$kids))) else $bk return map{ "list": ($input?list, $bk), "this": PDOutlineItem:getNextSibling($input?this)} }, function($output,$pos) { empty($output?this) } ) }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>outlineItem</xqdoc:name><xqdoc:type occurrence="?">item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>map(*)</xqdoc:type></xqdoc:return><xqdoc:invoked arity="3"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>do-until</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>bookmark</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>outline</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem</xqdoc:uri><xqdoc:name>getFirstChild</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions/map</xqdoc:uri><xqdoc:name>merge</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions/map</xqdoc:uri><xqdoc:name>entry</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem</xqdoc:uri><xqdoc:name>getNextSibling</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>empty</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:outline_($pdf as item(),$outlineItem as item()?)
|
||||
as map(*){
|
||||
pdfbox:do-until(
|
||||

|
||||
map{"list":(),"this":$outlineItem},
|
||||

|
||||
function($input,$pos ) { 
|
||||
let $bk:= pdfbox:bookmark($input?this,$pdf)
|
||||
let $bk:= if($bk?hasChildren)
|
||||
then let $kids:=pdfbox:outline($pdf,PDOutlineItem:getFirstChild($input?this))
|
||||
return map:merge(($bk,map:entry("children",$kids)))
|
||||
else $bk 
|
||||
return map{
|
||||
"list": ($input?list, $bk),
|
||||
"this": PDOutlineItem:getNextSibling($input?this)}
|
||||
},
|
||||

|
||||
function($output,$pos) { empty($output?this) } 
|
||||
)
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
PDF outline in xml format</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:outline-xml</xqdoc:name><xqdoc:signature>function pdfbox:outline-xml ( $pdf as item() ) as element(outline)? { let $outline:=pdfbox:outline($pdf) return if(exists($outline)) then <outline>{$outline!pdfbox:bookmark-xml(.)}</outline> else () }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="?">element(outline)</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>outline</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>exists</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>bookmark-xml</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:outline-xml($pdf as item())
|
||||
as element(outline)?{
|
||||
let $outline:=pdfbox:outline($pdf)
|
||||
return if(exists($outline))
|
||||
then <outline>{$outline!pdfbox:bookmark-xml(.)}</outline>
|
||||
else ()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
recursive ouutline map to XML</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:bookmark-xml</xqdoc:name><xqdoc:annotations><xqdoc:annotation name="private"/></xqdoc:annotations><xqdoc:signature>function pdfbox:bookmark-xml ( $outline as map(*)* ) as element(bookmark)* { $outline! <bookmark title="{?title}" index="{?index}"> {?children!pdfbox:bookmark-xml(.)} </bookmark> }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>outline</xqdoc:name><xqdoc:type occurrence="*">map(*)</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="*">element(bookmark)</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>bookmark-xml</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:bookmark-xml($outline as map(*)*)
|
||||
as element(bookmark)*
|
||||
{
|
||||
$outline!
|
||||
<bookmark title="{?title}" index="{?index}">
|
||||
{?children!pdfbox:bookmark-xml(.)}
|
||||
</bookmark>
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
return bookmark info for $bookmark
|
||||
</xqdoc:description><xqdoc:return>map{index:..,title:..,hasChildren:..}</xqdoc:return></xqdoc:comment><xqdoc:name>pdfbox:bookmark</xqdoc:name><xqdoc:annotations><xqdoc:annotation name="private"/></xqdoc:annotations><xqdoc:signature>function pdfbox:bookmark ( $bookmark as item(),$pdf as item() ) as map(*) { map{ "index": PDOutlineItem:findDestinationPage($bookmark,$pdf)=>pdfbox:find-page($pdf), "title": (# db:checkstrings #) {PDOutlineItem:getTitle($bookmark)} (:=>translate("<22>",""), :), "hasChildren": PDOutlineItem:hasChildren($bookmark) } }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>bookmark</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>map(*)</xqdoc:type></xqdoc:return><xqdoc:invoked arity="2"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem</xqdoc:uri><xqdoc:name>findDestinationPage</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem</xqdoc:uri><xqdoc:name>getTitle</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem</xqdoc:uri><xqdoc:name>hasChildren</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:bookmark($bookmark as item(),$pdf as item())
|
||||
as map(*)
|
||||
{
|
||||
map{ 
|
||||
"index": PDOutlineItem:findDestinationPage($bookmark,$pdf)=>pdfbox:find-page($pdf),
|
||||
"title": (# db:checkstrings #) {PDOutlineItem:getTitle($bookmark)}
|
||||
(:=>translate("<22>",""), :),
|
||||
"hasChildren": PDOutlineItem:hasChildren($bookmark)
|
||||
}
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
pageIndex of $page in $pdf</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:find-page</xqdoc:name><xqdoc:signature>function pdfbox:find-page ( $page as item()? (: as java:org.apache.pdfbox.pdmodel.PDPage :), $pdf as item() ) as item()? { if(exists($page)) then PDDocument:getDocumentCatalog($pdf) =>PDDocumentCatalog:getPages() =>PDPageTree:indexOf($page) }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>page</xqdoc:name><xqdoc:type occurrence="?">item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="?">item()</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>exists</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentCatalog</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:find-page(
|
||||
$page as item()? (: as java:org.apache.pdfbox.pdmodel.PDPage :),
|
||||
$pdf as item())
|
||||
as item()?
|
||||
{
|
||||
if(exists($page))
|
||||
then PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getPages()
|
||||
=>PDPageTree:indexOf($page)
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="3"><xqdoc:comment><xqdoc:description>
|
||||
Return new PDF doc with pages from $start to $end as xs:base64Binary, (1 based)
|
||||
</xqdoc:description><xqdoc:param>$start first page to include</xqdoc:param><xqdoc:param>$end last page to include</xqdoc:param></xqdoc:comment><xqdoc:name>pdfbox:extract-range</xqdoc:name><xqdoc:signature>function pdfbox:extract-range ( $pdf as item(), $start as xs:integer,$end as xs:integer ) as xs:base64Binary { let $a:=PageExtractor:new($pdf, $start, $end) =>PageExtractor:extract() return (pdfbox:binary($a),pdfbox:close($a)) }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>start</xqdoc:name><xqdoc:type>xs:integer</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>end</xqdoc:name><xqdoc:type>xs:integer</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>xs:base64Binary</xqdoc:type></xqdoc:return><xqdoc:invoked arity="3"><xqdoc:uri>java:org.apache.pdfbox.multipdf.PageExtractor</xqdoc:uri><xqdoc:name>new</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>binary</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>org.expkg_zone58.Pdfbox3</xqdoc:uri><xqdoc:name>close</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:extract-range($pdf as item(), 
|
||||
$start as xs:integer,$end as xs:integer)
|
||||
as xs:base64Binary
|
||||
{
|
||||
let $a:=PageExtractor:new($pdf, $start, $end) =>PageExtractor:extract()
|
||||
return (pdfbox:binary($a),pdfbox:close($a)) 
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
pageLabel for every page or empty if none
|
||||
</xqdoc:description><xqdoc:see>https://www.w3.org/TR/WCAG20-TECHS/PDF17.html#PDF17-examples</xqdoc:see><xqdoc:see>https://codereview.stackexchange.com/questions/286078/java-code-showing-page-labels-from-pdf-files</xqdoc:see></xqdoc:comment><xqdoc:name>pdfbox:labels</xqdoc:name><xqdoc:signature>function pdfbox:labels ( $pdf as item() ) as xs:string* { let $pagelabels:=PDDocument:getDocumentCatalog($pdf) =>PDDocumentCatalog:getPageLabels() return if(exists($pagelabels)) then PDPageLabels:getLabelsByPageIndices($pagelabels) else () }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="*">xs:string</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getDocumentCatalog</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>exists</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.common.PDPageLabels</xqdoc:uri><xqdoc:name>getLabelsByPageIndices</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:labels($pdf as item())
|
||||
as xs:string*
|
||||
{
|
||||
let $pagelabels:=PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getPageLabels()
|
||||
return if(exists($pagelabels))
|
||||
then PDPageLabels:getLabelsByPageIndices($pagelabels)
|
||||
else ()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
return text on $pageNo</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:page-text</xqdoc:name><xqdoc:signature>function pdfbox:page-text ( $pdf as item(), $pageNo as xs:integer ) as xs:string { let $tStripper := (# db:wrapjava instance #) { PDFTextStripper:new() => PDFTextStripper:setStartPage($pageNo) => PDFTextStripper:setEndPage($pageNo) } return (# db:checkstrings #) {PDFTextStripper:getText($tStripper,$pdf)} }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>pageNo</xqdoc:name><xqdoc:type>xs:integer</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>xs:string</xqdoc:type></xqdoc:return><xqdoc:invoked arity="0"><xqdoc:uri>java:org.apache.pdfbox.text.PDFTextStripper</xqdoc:uri><xqdoc:name>new</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>java:org.apache.pdfbox.text.PDFTextStripper</xqdoc:uri><xqdoc:name>getText</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:page-text($pdf as item(), $pageNo as xs:integer)
|
||||
as xs:string{
|
||||
let $tStripper := (# db:wrapjava instance #) {
|
||||
PDFTextStripper:new()
|
||||
=> PDFTextStripper:setStartPage($pageNo)
|
||||
=> PDFTextStripper:setEndPage($pageNo)
|
||||
}
|
||||
return (# db:checkstrings #) {PDFTextStripper:getText($tStripper,$pdf)}
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="2"><xqdoc:comment><xqdoc:description>
|
||||
return size of $pageNo (zero based)
|
||||
</xqdoc:description><xqdoc:custom tag="result">e.g. [0.0,0.0,168.0,239.52]</xqdoc:custom></xqdoc:comment><xqdoc:name>pdfbox:page-media-box</xqdoc:name><xqdoc:signature>function pdfbox:page-media-box ( $pdf as item(), $pageNo as xs:integer ) as xs:string { PDDocument:getPage($pdf, $pageNo) =>PDPage:getMediaBox() =>PDRectangle:toString() }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>pdf</xqdoc:name><xqdoc:type>item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>pageNo</xqdoc:name><xqdoc:type>xs:integer</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type>xs:string</xqdoc:type></xqdoc:return><xqdoc:invoked arity="2"><xqdoc:uri>java:org.apache.pdfbox.pdmodel.PDDocument</xqdoc:uri><xqdoc:name>getPage</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:page-media-box($pdf as item(), $pageNo as xs:integer)
|
||||
as xs:string{
|
||||
PDDocument:getPage($pdf, $pageNo)
|
||||
=>PDPage:getMediaBox()
|
||||
=>PDRectangle:toString()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="0"><xqdoc:comment><xqdoc:description>
|
||||
version of Apache Pdfbox in use e.g. "3.0.4"</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:version</xqdoc:name><xqdoc:signature>function pdfbox:version ( ) as xs:string { Q{java:org.apache.pdfbox.util.Version}getVersion() }</xqdoc:signature><xqdoc:return><xqdoc:type>xs:string</xqdoc:type></xqdoc:return><xqdoc:invoked arity="0"><xqdoc:uri>java:org.apache.pdfbox.util.Version</xqdoc:uri><xqdoc:name>getVersion</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:version()
|
||||
as xs:string{
|
||||
Q{java:org.apache.pdfbox.util.Version}getVersion()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="1"><xqdoc:comment><xqdoc:description>
|
||||
convert date</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:gregToISO</xqdoc:name><xqdoc:annotations><xqdoc:annotation name="private"/></xqdoc:annotations><xqdoc:signature>function pdfbox:gregToISO ( $item as item()? ) as xs:string? { if(exists($item)) then Q{java:java.util.GregorianCalendar}toZonedDateTime($item)=>string() else () }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>item</xqdoc:name><xqdoc:type occurrence="?">item()</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="?">xs:string</xqdoc:type></xqdoc:return><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>exists</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>java:java.util.GregorianCalendar</xqdoc:uri><xqdoc:name>toZonedDateTime</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:gregToISO($item as item()?)
|
||||
as xs:string?{
|
||||
if(exists($item))
|
||||
then Q{java:java.util.GregorianCalendar}toZonedDateTime($item)=>string()
|
||||
else ()
|
||||
}</xqdoc:body></xqdoc:function><xqdoc:function arity="3"><xqdoc:comment><xqdoc:description>
|
||||
fn:do-until shim for BaseX 9+10
|
||||
if fn:do-until not found use hof:until, note: $pos always zero
|
||||
</xqdoc:description></xqdoc:comment><xqdoc:name>pdfbox:do-until</xqdoc:name><xqdoc:annotations><xqdoc:annotation name="private"/></xqdoc:annotations><xqdoc:signature>function pdfbox:do-until ( $input as item()*, $action as function(item()*, xs:integer) as item()*, $predicate as function(item()*, xs:integer) as xs:boolean? ) as item()* { let $fn:=function-lookup(QName('http://www.w3.org/2005/xpath-functions','do-until'), 3) return if(exists($fn)) then $fn($input,$action,$predicate) else let $hof:=function-lookup(QName('http://basex.org/modules/hof','until'), 3) return if(exists($hof)) then $hof($predicate(?,0),$action(?,0),$input) else error(xs:QName('pdfbox:do-until'),"No implementation do-until found") }</xqdoc:signature><xqdoc:parameters><xqdoc:parameter><xqdoc:name>input</xqdoc:name><xqdoc:type occurrence="*">item()</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>action</xqdoc:name><xqdoc:type>function(item()*, xs:integer) as item()*</xqdoc:type></xqdoc:parameter><xqdoc:parameter><xqdoc:name>predicate</xqdoc:name><xqdoc:type>function(item()*, xs:integer) as xs:boolean?</xqdoc:type></xqdoc:parameter></xqdoc:parameters><xqdoc:return><xqdoc:type occurrence="*">item()</xqdoc:type></xqdoc:return><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>function-lookup</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>QName</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>exists</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>function-lookup</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>QName</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>exists</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="2"><xqdoc:uri>http://www.w3.org/2005/xpath-functions</xqdoc:uri><xqdoc:name>error</xqdoc:name></xqdoc:invoked><xqdoc:invoked arity="1"><xqdoc:uri>http://www.w3.org/2001/XMLSchema</xqdoc:uri><xqdoc:name>QName</xqdoc:name></xqdoc:invoked><xqdoc:body>function pdfbox:do-until(
|
||||
$input as item()*, 
|
||||
$action as function(item()*, xs:integer) as item()*, 
|
||||
$predicate as function(item()*, xs:integer) as xs:boolean? 
|
||||
) as item()*
|
||||
{
|
||||
let $fn:=function-lookup(QName('http://www.w3.org/2005/xpath-functions','do-until'), 3)
|
||||
return if(exists($fn))
|
||||
then $fn($input,$action,$predicate)
|
||||
else let $hof:=function-lookup(QName('http://basex.org/modules/hof','until'), 3)
|
||||
return if(exists($hof))
|
||||
then $hof($predicate(?,0),$action(?,0),$input)
|
||||
else error(xs:QName('pdfbox:do-until'),"No implementation do-until found")
|
||||

|
||||
}</xqdoc:body></xqdoc:function></xqdoc:functions></xqdoc:xqdoc>
|
||||
443
docs/xqdoc/modules/F000001/xqparse.xml
Normal file
443
docs/xqdoc/modules/F000001/xqparse.xml
Normal file
File diff suppressed because one or more lines are too long
1153
docs/xqdoc/resources/base.css
Normal file
1153
docs/xqdoc/resources/base.css
Normal file
File diff suppressed because it is too large
Load diff
295
docs/xqdoc/resources/page.css
Normal file
295
docs/xqdoc/resources/page.css
Normal file
|
|
@ -0,0 +1,295 @@
|
|||
body {
|
||||
font-family: Helvetica;
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
|
||||
|
||||
|
||||
pre {
|
||||
font-family: Inconsolata, Consolas, monospace;
|
||||
}
|
||||
|
||||
ol.results {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: right;
|
||||
border-top: solid 4px;
|
||||
padding: 0.25em 0.5em;
|
||||
font-size: 85%;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
li.result {
|
||||
list-style-position: inside;
|
||||
list-style: none;
|
||||
height: 140px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h2 a, .result h3 a {
|
||||
text-decoration: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 140%;
|
||||
background-color: #aaa;
|
||||
border-bottom: 1px solid #000;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 100%;
|
||||
background-color: #ddd;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
td {
|
||||
vertical-align: text-top;
|
||||
}
|
||||
/* from bootstrap 4.3.1 */
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 0.25em 0.4em;
|
||||
font-size: 75%;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
border-radius: 0.25rem;
|
||||
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
a.badge:hover, a.badge:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.badge:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.btn .badge {
|
||||
position: relative;
|
||||
top: -1px;
|
||||
}
|
||||
|
||||
.badge-pill {
|
||||
padding-right: 0.6em;
|
||||
padding-left: 0.6em;
|
||||
border-radius: 10rem;
|
||||
}
|
||||
|
||||
.badge-primary {
|
||||
color: #fff;
|
||||
background-color: #007bff;
|
||||
}
|
||||
|
||||
a.badge-primary:hover, a.badge-primary:focus {
|
||||
color: #fff;
|
||||
background-color: #0062cc;
|
||||
}
|
||||
|
||||
a.badge-primary:focus, a.badge-primary.focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5);
|
||||
}
|
||||
|
||||
.badge-secondary {
|
||||
color: #fff;
|
||||
background-color: #6c757d;
|
||||
}
|
||||
|
||||
a.badge-secondary:hover, a.badge-secondary:focus {
|
||||
color: #fff;
|
||||
background-color: #545b62;
|
||||
}
|
||||
|
||||
a.badge-secondary:focus, a.badge-secondary.focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5);
|
||||
}
|
||||
|
||||
.badge-success {
|
||||
color: #fff;
|
||||
background-color: #28a745;
|
||||
}
|
||||
|
||||
a.badge-success:hover, a.badge-success:focus {
|
||||
color: #fff;
|
||||
background-color: #1e7e34;
|
||||
}
|
||||
|
||||
a.badge-success:focus, a.badge-success.focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5);
|
||||
}
|
||||
|
||||
.badge-info {
|
||||
color: #fff;
|
||||
background-color: #17a2b8;
|
||||
}
|
||||
|
||||
a.badge-info:hover, a.badge-info:focus {
|
||||
color: #fff;
|
||||
background-color: #117a8b;
|
||||
}
|
||||
|
||||
a.badge-info:focus, a.badge-info.focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5);
|
||||
}
|
||||
|
||||
.badge-warning {
|
||||
color: #212529;
|
||||
background-color: #ffc107;
|
||||
}
|
||||
|
||||
a.badge-warning:hover, a.badge-warning:focus {
|
||||
color: #212529;
|
||||
background-color: #d39e00;
|
||||
}
|
||||
|
||||
a.badge-warning:focus, a.badge-warning.focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5);
|
||||
}
|
||||
|
||||
.badge-danger {
|
||||
color: #fff;
|
||||
background-color: #dc3545;
|
||||
}
|
||||
|
||||
a.badge-danger:hover, a.badge-danger:focus {
|
||||
color: #fff;
|
||||
background-color: #bd2130;
|
||||
}
|
||||
|
||||
a.badge-danger:focus, a.badge-danger.focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5);
|
||||
}
|
||||
|
||||
.badge-light {
|
||||
color: #212529;
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
a.badge-light:hover, a.badge-light:focus {
|
||||
color: #212529;
|
||||
background-color: #dae0e5;
|
||||
}
|
||||
|
||||
a.badge-light:focus, a.badge-light.focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5);
|
||||
}
|
||||
|
||||
.badge-dark {
|
||||
color: #fff;
|
||||
background-color: #343a40;
|
||||
}
|
||||
|
||||
a.badge-dark:hover, a.badge-dark:focus {
|
||||
color: #fff;
|
||||
background-color: #1d2124;
|
||||
}
|
||||
|
||||
a.badge-dark:focus, a.badge-dark.focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5);
|
||||
}
|
||||
.op-get {
|
||||
color: #fff;
|
||||
background-color: #61affe;
|
||||
}
|
||||
|
||||
.op-post {
|
||||
color: #fff;
|
||||
background-color: #49cc90;
|
||||
}
|
||||
|
||||
.op-put{
|
||||
color: #fff;
|
||||
background-color: #fca130;
|
||||
}
|
||||
|
||||
.op-delete {
|
||||
color: #fff;
|
||||
background-color: #f93e3e;
|
||||
}
|
||||
.op-patch{
|
||||
color: #fff;
|
||||
background-color: #17a2b8;
|
||||
}
|
||||
.op-all{
|
||||
color: #fff;
|
||||
background-color: #17a2b8;
|
||||
}
|
||||
|
||||
|
||||
/* https://www.w3schools.com/howto/howto_js_treeview.asp */
|
||||
/* Remove default bullets */
|
||||
ul.tree,
|
||||
ul.nested
|
||||
{
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Style the caret/arrow */
|
||||
.caret {
|
||||
cursor: pointer;
|
||||
user-select: none; /* Prevent text selection */
|
||||
}
|
||||
|
||||
/* Create the caret/arrow with a unicode, and style it */
|
||||
.caret::before {
|
||||
content: "\25B6";
|
||||
color: black;
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
/* Rotate the caret/arrow icon when clicked on (using JavaScript) */
|
||||
.caret-down::before {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
/* Hide the nested list */
|
||||
.nested {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Show the nested list when the user clicks on the caret/arrow (with JavaScript) */
|
||||
.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* https://css-tricks.com/on-target/ */
|
||||
:target {
|
||||
animation: highlight 1s ease;
|
||||
transform: translateX(20px);
|
||||
}
|
||||
@keyframes highlight {
|
||||
0% { border-left-color: red; }
|
||||
100% { border-left-color: white; }
|
||||
}
|
||||
section > div {
|
||||
border-left: 40px solid white;
|
||||
padding: 10px;
|
||||
transition: all 0.5s ease;
|
||||
padding-right: 50px;
|
||||
margin-left: -20px;
|
||||
}
|
||||
5
docs/xqdoc/resources/prism/1.29.0/prism.css
Normal file
5
docs/xqdoc/resources/prism/1.29.0/prism.css
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* PrismJS 1.29.0
|
||||
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+xquery&plugins=line-numbers+toolbar+copy-to-clipboard */
|
||||
code[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#999}.token.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#690}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{color:#9a6e3a;background:hsla(0,0%,100%,.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.class-name,.token.function{color:#dd4a68}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}
|
||||
pre[class*=language-].line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}
|
||||
div.code-toolbar{position:relative}div.code-toolbar>.toolbar{position:absolute;z-index:10;top:.3em;right:.2em;transition:opacity .3s ease-in-out;opacity:0}div.code-toolbar:hover>.toolbar{opacity:1}div.code-toolbar:focus-within>.toolbar{opacity:1}div.code-toolbar>.toolbar>.toolbar-item{display:inline-block}div.code-toolbar>.toolbar>.toolbar-item>a{cursor:pointer}div.code-toolbar>.toolbar>.toolbar-item>button{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}div.code-toolbar>.toolbar>.toolbar-item>a,div.code-toolbar>.toolbar>.toolbar-item>button,div.code-toolbar>.toolbar>.toolbar-item>span{color:#bbb;font-size:.8em;padding:0 .5em;background:#f5f2f0;background:rgba(224,224,224,.2);box-shadow:0 2px 0 0 rgba(0,0,0,.2);border-radius:.5em}div.code-toolbar>.toolbar>.toolbar-item>a:focus,div.code-toolbar>.toolbar>.toolbar-item>a:hover,div.code-toolbar>.toolbar>.toolbar-item>button:focus,div.code-toolbar>.toolbar>.toolbar-item>button:hover,div.code-toolbar>.toolbar>.toolbar-item>span:focus,div.code-toolbar>.toolbar>.toolbar-item>span:hover{color:inherit;text-decoration:none}
|
||||
11
docs/xqdoc/resources/prism/1.29.0/prism.js
Normal file
11
docs/xqdoc/resources/prism/1.29.0/prism.js
Normal file
File diff suppressed because one or more lines are too long
255
docs/xqdoc/resources/query.css
Normal file
255
docs/xqdoc/resources/query.css
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
/* from xsl:query.xsl (D) from
|
||||
https://www.w3.org/TR/xpath-functions-31*/
|
||||
div.exampleInner pre {
|
||||
margin-left: 1em;
|
||||
margin-top: 0em;
|
||||
margin-bottom: 0em
|
||||
}
|
||||
|
||||
pre.small {
|
||||
font-size: small
|
||||
}
|
||||
|
||||
div.exampleOuter {
|
||||
border: 4px double gray;
|
||||
margin: 0em;
|
||||
padding: 0em
|
||||
}
|
||||
|
||||
div.exampleInner {
|
||||
background-color: #d5dee3;
|
||||
padding: 4px;
|
||||
margin: 0em
|
||||
}
|
||||
|
||||
div.exampleInner table {
|
||||
border: 0;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
div.exampleInner td {
|
||||
vertical-align: baseline;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.exampleWrapper {
|
||||
margin: 4px
|
||||
}
|
||||
|
||||
div.exampleHeader {
|
||||
font-weight: bold;
|
||||
margin: 4px
|
||||
}
|
||||
|
||||
div.proto {
|
||||
border: 0;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
div.issue {
|
||||
border-bottom-color: black;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1pt;
|
||||
margin-bottom: 20pt;
|
||||
}
|
||||
|
||||
th.issue-toc-head {
|
||||
border-bottom-color: black;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1pt;
|
||||
}
|
||||
|
||||
div.schemaComp {
|
||||
border: 4px double gray;
|
||||
margin: 0em 1em;
|
||||
padding: 0em;
|
||||
}
|
||||
|
||||
div.compHeader {
|
||||
margin: 4px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
span.schemaComp {
|
||||
background-color: white;
|
||||
color: #A52A2A;
|
||||
}
|
||||
|
||||
div.compBody {
|
||||
border-top-width: 4px;
|
||||
border-top-style: double;
|
||||
border-top-color: #d3d3d3;
|
||||
padding: 4px;
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
div.exampleInner {
|
||||
background-color: #d5dee3;
|
||||
color: black;
|
||||
border-top-width: 4px;
|
||||
border-top-style: double;
|
||||
border-top-color: #d3d3d3;
|
||||
border-bottom-width: 4px;
|
||||
border-bottom-style: double;
|
||||
border-bottom-color: #d3d3d3;
|
||||
padding: 4px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
div.issueBody {
|
||||
margin-left: 0.25in;
|
||||
}
|
||||
|
||||
code.function {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
code.return-type {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
code.return-varies {
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
code.type {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
code.as {
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
code.arg {
|
||||
|
||||
}
|
||||
|
||||
code.strikeout {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
code.small {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
p.table.footnote {
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
table.casting {
|
||||
font-size: x-small;
|
||||
}
|
||||
|
||||
table.hierarchy {
|
||||
font-size: x-small;
|
||||
}
|
||||
|
||||
table.proto {
|
||||
|
||||
}
|
||||
|
||||
td.castY {
|
||||
background-color: #7FFF7F;
|
||||
color: black;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
td.castN {
|
||||
background-color: #FF7F7F;
|
||||
color: black;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
td.castM {
|
||||
background-color: white;
|
||||
color: black;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
td.castOther {
|
||||
background-color: yellow;
|
||||
color: black;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
span.cancast:hover {
|
||||
background-color: #ffa;
|
||||
color: black;
|
||||
}
|
||||
|
||||
div.protoref {
|
||||
margin-left: 0.5in;
|
||||
text-indent: -0.5in;
|
||||
}
|
||||
|
||||
dd.indent {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
p.element-syntax {
|
||||
border: solid thin;
|
||||
background-color: #ffccff
|
||||
}
|
||||
|
||||
p.element-syntax-chg {
|
||||
border: solid thick yellow;
|
||||
background-color: #ffccff
|
||||
}
|
||||
|
||||
div.proto {
|
||||
padding: .5em;
|
||||
border: .5em;
|
||||
border-left-style: solid;
|
||||
page-break-inside: avoid;
|
||||
margin: 1em auto;
|
||||
border-color: #ff99ff;
|
||||
background: #ffe6ff;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.example-chg {
|
||||
border: solid thick yellow;
|
||||
background-color: #40e0d0;
|
||||
padding: 1em
|
||||
}
|
||||
|
||||
div.ffheader {
|
||||
margin-top: .8rem;
|
||||
font-size: 140%;
|
||||
font-variant: all-small-caps;
|
||||
text-transform: lowercase;
|
||||
font-weight: bold;
|
||||
color: hsla(203, 20%, 40%, .7);
|
||||
}
|
||||
|
||||
span.verb {
|
||||
font: small-caps 100% sans-serif
|
||||
}
|
||||
|
||||
span.error {
|
||||
font-size: small
|
||||
}
|
||||
|
||||
span.definition {
|
||||
font: small-caps 100% sans-serif
|
||||
}
|
||||
|
||||
span.grayed {
|
||||
color: gray
|
||||
}
|
||||
|
||||
table.scrap td {
|
||||
vertical-align: baseline;
|
||||
text-align: left;
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
table.data
|
||||
table.index {
|
||||
border-bottom: 2px !important;
|
||||
}
|
||||
1
docs/xqdoc/resources/readme.md
Normal file
1
docs/xqdoc/resources/readme.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
Support files for xqdoca
|
||||
21
docs/xqdoc/resources/svgdotjs/LICENSE
Normal file
21
docs/xqdoc/resources/svgdotjs/LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 Ulrich-Matthias Schäfer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
136
docs/xqdoc/resources/svgdotjs/README.md
Normal file
136
docs/xqdoc/resources/svgdotjs/README.md
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
# svg.panzoom.js
|
||||
|
||||
> A plugin for [svg.js](https://github.com/svgdotjs/svg.js) that enables panzoom for svg elements
|
||||
|
||||
## Getting started
|
||||
|
||||
```
|
||||
npm install @svgdotjs/svg.js @svgdotjs/svg.panzoom.js
|
||||
```
|
||||
|
||||
Include this plugin after including the svg.js library in your html document.
|
||||
|
||||
```
|
||||
<script src="node_modules/@svgdotjs/svg.js/dist/svg.js"></script>
|
||||
<script src="node_modules/@svgdotjs/svg.panzoom.js/dist/svg.panzoom.js"></script>
|
||||
```
|
||||
|
||||
Or for esm just import it:
|
||||
|
||||
```
|
||||
import { SVG } from '@svgdotjs/svg.js'
|
||||
import '@svgdotjs/svg.panzoom.js'
|
||||
```
|
||||
|
||||
To enable pan/zoom on an svg:
|
||||
|
||||
```js
|
||||
// enables panZoom
|
||||
var canvas = SVG()
|
||||
.addTo('#id')
|
||||
.size(1000, 1000)
|
||||
.panZoom()
|
||||
|
||||
// zoom programatically
|
||||
canvas.zoom(lvl, point)
|
||||
```
|
||||
|
||||
You can configure `panZoom` by passing options to it.
|
||||
|
||||
- zoomMin: Minimal zoom level
|
||||
- zoomMax: Maximal zoom level
|
||||
- zoomFactor: How much is zoomed by one mouse wheel step
|
||||
|
||||
This could look like this:
|
||||
|
||||
```js
|
||||
var canvas = SVG()
|
||||
.addTo('#id')
|
||||
.size(1000, 1000)
|
||||
.panZoom({ zoomMin: 0.5, zoomMax: 20 })
|
||||
```
|
||||
|
||||
Setting the min and max value will automatically restrict the zoom to the provided level.
|
||||
However you are still able to change the zoom out of that bonds by calling `zoom(lvl)` programatically.
|
||||
|
||||
On touchable devices a pinchZoom gesture is supported. Min and max values also apply here.
|
||||
|
||||
Zooming is animatable, too:
|
||||
|
||||
```js
|
||||
canvas
|
||||
.zoom(1) // uses center of viewport by default
|
||||
.animate()
|
||||
.zoom(2, { x: 100, y: 100 }) // zoom into specified point
|
||||
```
|
||||
|
||||
To disable `panZoom` or change its options just call it again with `false` or the new options.
|
||||
|
||||
## Options
|
||||
|
||||
You can override the default options by passing an object in to the `.panZoom({options})` call.
|
||||
|
||||
| Option | Default | Description |
|
||||
| ------------ | ---------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||
| panning | true | Enable panning |
|
||||
| pinchZoom | true | Enable pinch to zoom |
|
||||
| wheelZoom | true | Enable mouse wheel zoom |
|
||||
| panButton | 0 | Which mouse button to use for pan ([info](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button)) |
|
||||
| oneFingerPan | false | Enables the ability to pan with only one finger instead of two for touchdevices |
|
||||
| margins | false | An object {top, left, right, bottom} to restrict the pan area towards this side so that at least x user units of the opposite side are still visible |
|
||||
| zoomFactor | 2 | How quickly to zoom when using `wheelZoom` |
|
||||
| zoomMin | Number.MIN_VALUE | The minimum zoom level |
|
||||
| zoomMax | Number.MAX_VALUE | The maximum zoom level |
|
||||
| wheelZoomDeltaModeLinePixels | 17 | The multiplier to convert wheel zoom deltaY values from deltaMode=1 (lines) to deltaMode=0 (pixels) |
|
||||
| wheelZoomDeltaModeScreenPixels | 53 | The multiplier to convert wheel zoom deltaY values from deltaMode=2 (screen) to deltaMode=0 (pixels) |
|
||||
|
||||
### Example:
|
||||
|
||||
```js
|
||||
draw.panZoom({
|
||||
wheelZoom: false,
|
||||
zoomMin: 0.5,
|
||||
zoomMax: 2
|
||||
})
|
||||
```
|
||||
|
||||
This will disable wheel zooming and set the maximum zoom to 2 or 200% and the minimum zoom to 0.5 or 50%.
|
||||
|
||||
## Events
|
||||
|
||||
Multiple events are fired doing different actions. This allow you to respond
|
||||
to actions and in some cases stop an action via `preventDefault()`.
|
||||
|
||||
`zoom` is fired when a mouse wheel event or programmable `zoom()` triggers
|
||||
a zoom. This usually doesn't happen on mobile devices, in which case
|
||||
`pinchZoomStart` is fired when a zoom happens.
|
||||
|
||||
Events fired from SVG.js are [`CustomEvent`s](http://devdocs.io/dom/customevent),
|
||||
so the arguments passed from svg.panzoom.js are in in the `.detail` property.
|
||||
|
||||
| Event Name | Argument Value | preventDefault support |
|
||||
| -------------- | ---------------- | ---------------------- |
|
||||
| zoom | `{ lvl, focus }` | YES |
|
||||
| panStart | `{ event }` | NO |
|
||||
| panEnd | `{ event }` | NO |
|
||||
| panning | `{ box }` | YES |
|
||||
| pinchZoomStart | `{ event }` | YES |
|
||||
| pinchZoomEnd | `{ event }` | NO |
|
||||
|
||||
Where `lvl` is the new zoom level,
|
||||
[`focus`](https://svgjs.com/docs/3.0/classes/#svg-point) is th point of zoom, [`box`](https://svgjs.com/docs/3.0/classes/#svg-box) is the new calculated viewbox
|
||||
and event is the event that triggered the action.
|
||||
|
||||
An example of stopping a pinch-zoom action:
|
||||
|
||||
```js
|
||||
var canvas = SVG()
|
||||
.addTo('#id')
|
||||
.size(1000, 1000)
|
||||
.panZoom()
|
||||
|
||||
canvas.on('pinchZoomStart', function (ev) {
|
||||
ev.preventDefault()
|
||||
// ...
|
||||
})
|
||||
```
|
||||
372
docs/xqdoc/resources/svgdotjs/svg.panzoom.js
Normal file
372
docs/xqdoc/resources/svgdotjs/svg.panzoom.js
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
/*!
|
||||
* @svgdotjs/svg.panzoom.js - A plugin for svg.js that enables panzoom for viewport elements
|
||||
* @version 2.1.2
|
||||
* https://github.com/svgdotjs/svg.panzoom.js#readme
|
||||
*
|
||||
* @copyright undefined
|
||||
* @license MIT
|
||||
*
|
||||
* BUILT: Thu Jul 22 2021 14:51:35 GMT+0200 (Mitteleuropäische Sommerzeit)
|
||||
*/;
|
||||
(function (svg_js) {
|
||||
'use strict';
|
||||
|
||||
var normalizeEvent = function normalizeEvent(ev) {
|
||||
return ev.touches || [{
|
||||
clientX: ev.clientX,
|
||||
clientY: ev.clientY
|
||||
}];
|
||||
};
|
||||
|
||||
svg_js.extend(svg_js.Svg, {
|
||||
panZoom: function panZoom(options) {
|
||||
var _options,
|
||||
_options$zoomFactor,
|
||||
_options$zoomMin,
|
||||
_options$zoomMax,
|
||||
_options$wheelZoom,
|
||||
_options$pinchZoom,
|
||||
_options$panning,
|
||||
_options$panButton,
|
||||
_options$oneFingerPan,
|
||||
_options$margins,
|
||||
_options$wheelZoomDel,
|
||||
_options$wheelZoomDel2,
|
||||
_this = this;
|
||||
|
||||
this.off('.panZoom'); // when called with false, disable panZoom
|
||||
|
||||
if (options === false) return this;
|
||||
options = (_options = options) != null ? _options : {};
|
||||
var zoomFactor = (_options$zoomFactor = options.zoomFactor) != null ? _options$zoomFactor : 2;
|
||||
var zoomMin = (_options$zoomMin = options.zoomMin) != null ? _options$zoomMin : Number.MIN_VALUE;
|
||||
var zoomMax = (_options$zoomMax = options.zoomMax) != null ? _options$zoomMax : Number.MAX_VALUE;
|
||||
var doWheelZoom = (_options$wheelZoom = options.wheelZoom) != null ? _options$wheelZoom : true;
|
||||
var doPinchZoom = (_options$pinchZoom = options.pinchZoom) != null ? _options$pinchZoom : true;
|
||||
var doPanning = (_options$panning = options.panning) != null ? _options$panning : true;
|
||||
var panButton = (_options$panButton = options.panButton) != null ? _options$panButton : 0;
|
||||
var oneFingerPan = (_options$oneFingerPan = options.oneFingerPan) != null ? _options$oneFingerPan : false;
|
||||
var margins = (_options$margins = options.margins) != null ? _options$margins : false;
|
||||
var wheelZoomDeltaModeLinePixels = (_options$wheelZoomDel = options.wheelZoomDeltaModeLinePixels) != null ? _options$wheelZoomDel : 17;
|
||||
var wheelZoomDeltaModeScreenPixels = (_options$wheelZoomDel2 = options.wheelZoomDeltaModeScreenPixels) != null ? _options$wheelZoomDel2 : 53;
|
||||
var lastP;
|
||||
var lastTouches;
|
||||
var zoomInProgress = false;
|
||||
var viewbox = this.viewbox();
|
||||
|
||||
var restrictToMargins = function restrictToMargins(box) {
|
||||
if (!margins) return box;
|
||||
var top = margins.top,
|
||||
left = margins.left,
|
||||
bottom = margins.bottom,
|
||||
right = margins.right;
|
||||
|
||||
var _this$attr = _this.attr(['width', 'height']),
|
||||
width = _this$attr.width,
|
||||
height = _this$attr.height;
|
||||
|
||||
var preserveAspectRatio = _this.node.preserveAspectRatio.baseVal; // The current viewport (exactly what is shown on the screen, what we ultimately want to restrict)
|
||||
// is not always exactly the same as current viewbox. They are different when the viewbox aspectRatio and the svg aspectRatio
|
||||
// are different and preserveAspectRatio is not "none". These offsets represent the difference in user coordinates
|
||||
// between the side of the viewbox and the side of the viewport.
|
||||
|
||||
var viewportLeftOffset = 0;
|
||||
var viewportRightOffset = 0;
|
||||
var viewportTopOffset = 0;
|
||||
var viewportBottomOffset = 0; // preserveAspectRatio none has no offsets
|
||||
|
||||
if (preserveAspectRatio.align !== preserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE) {
|
||||
var svgAspectRatio = width / height;
|
||||
var viewboxAspectRatio = viewbox.width / viewbox.height; // when aspectRatios are the same, there are no offsets
|
||||
|
||||
if (viewboxAspectRatio !== svgAspectRatio) {
|
||||
// aspectRatio unknown is like meet because that's the default
|
||||
var isMeet = preserveAspectRatio.meetOrSlice !== preserveAspectRatio.SVG_MEETORSLICE_SLICE;
|
||||
var changedAxis = svgAspectRatio > viewboxAspectRatio ? 'width' : 'height';
|
||||
var isWidth = changedAxis === 'width';
|
||||
var changeHorizontal = isMeet && isWidth || !isMeet && !isWidth;
|
||||
var ratio = changeHorizontal ? svgAspectRatio / viewboxAspectRatio : viewboxAspectRatio / svgAspectRatio;
|
||||
var offset = box[changedAxis] - box[changedAxis] * ratio;
|
||||
|
||||
if (changeHorizontal) {
|
||||
if (preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX) {
|
||||
viewportLeftOffset = offset / 2;
|
||||
viewportRightOffset = -offset / 2;
|
||||
} else if (preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX) {
|
||||
viewportRightOffset = -offset;
|
||||
} else if (preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX) {
|
||||
viewportLeftOffset = offset;
|
||||
}
|
||||
} else {
|
||||
if (preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID) {
|
||||
viewportTopOffset = offset / 2;
|
||||
viewportBottomOffset = -offset / 2;
|
||||
} else if (preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN) {
|
||||
viewportBottomOffset = -offset;
|
||||
} else if (preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX || preserveAspectRatio.align === preserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX) {
|
||||
viewportTopOffset = offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // when box.x == leftLimit, the image is panned to the left,
|
||||
// i.e the current box is to the right of the initial viewbox,
|
||||
// and only the right part of the initial image is visible, i.e.
|
||||
// the right side of the initial viewbox minus left margin (viewbox.x+viewbox.width-left)
|
||||
// is aligned with the left side of the viewport (box.x + viewportLeftOffset):
|
||||
// viewbox.width + viewbox.x - left = box.x + viewportLeftOffset
|
||||
// viewbox.width + viewbox.x - left - viewportLeftOffset = box.x (= leftLimit)
|
||||
|
||||
|
||||
var leftLimit = viewbox.width + viewbox.x - left - viewportLeftOffset; // when box.x == rightLimit, the image is panned to the right,
|
||||
// i.e the current box is to the left of the initial viewbox
|
||||
// and only the left part of the initial image is visible, i.e
|
||||
// the left side of the initial viewbox plus right margin (viewbox.x + right)
|
||||
// is aligned with the right side of the viewport (box.x + box.width + viewportRightOffset)
|
||||
// viewbox.x + right = box.x + box.width + viewportRightOffset
|
||||
// viewbox.x + right - box.width - viewportRightOffset = box.x (= rightLimit)
|
||||
|
||||
var rightLimit = viewbox.x + right - box.width - viewportRightOffset; // same with top and bottom
|
||||
|
||||
var topLimit = viewbox.height + viewbox.y - top - viewportTopOffset;
|
||||
var bottomLimit = viewbox.y + bottom - box.height - viewportBottomOffset;
|
||||
box.x = Math.min(leftLimit, Math.max(rightLimit, box.x)); // enforce rightLimit <= box.x <= leftLimit
|
||||
|
||||
box.y = Math.min(topLimit, Math.max(bottomLimit, box.y)); // enforce bottomLimit <= box.y <= topLimit
|
||||
|
||||
return box;
|
||||
};
|
||||
|
||||
var wheelZoom = function wheelZoom(ev) {
|
||||
ev.preventDefault(); // When wheeling on a mouse,
|
||||
// - chrome by default uses deltaY = 53, deltaMode = 0 (pixel)
|
||||
// - firefox by default uses deltaY = 3, deltaMode = 1 (line)
|
||||
// - chrome and firefox on windows after configuring "One screen at a time"
|
||||
// use deltaY = 1, deltaMode = 2 (screen)
|
||||
//
|
||||
// Note that when when wheeling on a touchpad, deltaY depends on how fast
|
||||
// you swipe, but the deltaMode is still different between the browsers.
|
||||
//
|
||||
// Normalize everything so that zooming speed is approximately the same in all cases
|
||||
|
||||
var normalizedPixelDeltaY;
|
||||
|
||||
switch (ev.deltaMode) {
|
||||
case 1:
|
||||
normalizedPixelDeltaY = ev.deltaY * wheelZoomDeltaModeLinePixels;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
normalizedPixelDeltaY = ev.deltaY * wheelZoomDeltaModeScreenPixels;
|
||||
break;
|
||||
|
||||
default:
|
||||
// 0 (already pixels) or new mode (avoid crashing)
|
||||
normalizedPixelDeltaY = ev.deltaY;
|
||||
break;
|
||||
}
|
||||
|
||||
var lvl = Math.pow(1 + zoomFactor, -1 * normalizedPixelDeltaY / 100) * this.zoom();
|
||||
var p = this.point(ev.clientX, ev.clientY);
|
||||
|
||||
if (lvl > zoomMax) {
|
||||
lvl = zoomMax;
|
||||
}
|
||||
|
||||
if (lvl < zoomMin) {
|
||||
lvl = zoomMin;
|
||||
}
|
||||
|
||||
if (this.dispatch('zoom', {
|
||||
level: lvl,
|
||||
focus: p
|
||||
}).defaultPrevented) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this.zoom(lvl, p);
|
||||
|
||||
if (margins) {
|
||||
var box = restrictToMargins(this.viewbox());
|
||||
this.viewbox(box);
|
||||
}
|
||||
};
|
||||
|
||||
var pinchZoomStart = function pinchZoomStart(ev) {
|
||||
lastTouches = normalizeEvent(ev); // Start panning in case only one touch is found
|
||||
|
||||
if (lastTouches.length < 2) {
|
||||
if (doPanning && oneFingerPan) {
|
||||
panStart.call(this, ev);
|
||||
}
|
||||
|
||||
return;
|
||||
} // Stop panning for more than one touch
|
||||
|
||||
|
||||
if (doPanning && oneFingerPan) {
|
||||
panStop.call(this, ev);
|
||||
} // We call it so late, so the user is still able to scroll / reload the page via gesture
|
||||
// In case oneFingerPan is not active
|
||||
|
||||
|
||||
ev.preventDefault();
|
||||
|
||||
if (this.dispatch('pinchZoomStart', {
|
||||
event: ev
|
||||
}).defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.off('touchstart.panZoom', pinchZoomStart);
|
||||
zoomInProgress = true;
|
||||
svg_js.on(document, 'touchmove.panZoom', pinchZoom, this, {
|
||||
passive: false
|
||||
});
|
||||
svg_js.on(document, 'touchend.panZoom', pinchZoomStop, this, {
|
||||
passive: false
|
||||
});
|
||||
};
|
||||
|
||||
var pinchZoomStop = function pinchZoomStop(ev) {
|
||||
ev.preventDefault();
|
||||
var currentTouches = normalizeEvent(ev);
|
||||
|
||||
if (currentTouches.length > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
zoomInProgress = false;
|
||||
this.dispatch('pinchZoomEnd', {
|
||||
event: ev
|
||||
});
|
||||
svg_js.off(document, 'touchmove.panZoom', pinchZoom);
|
||||
svg_js.off(document, 'touchend.panZoom', pinchZoomStop);
|
||||
this.on('touchstart.panZoom', pinchZoomStart);
|
||||
|
||||
if (currentTouches.length && doPanning && oneFingerPan) {
|
||||
panStart.call(this, ev);
|
||||
}
|
||||
};
|
||||
|
||||
var pinchZoom = function pinchZoom(ev) {
|
||||
ev.preventDefault();
|
||||
var currentTouches = normalizeEvent(ev);
|
||||
var zoom = this.zoom(); // Distance Formula
|
||||
|
||||
var lastDelta = Math.sqrt(Math.pow(lastTouches[0].clientX - lastTouches[1].clientX, 2) + Math.pow(lastTouches[0].clientY - lastTouches[1].clientY, 2));
|
||||
var currentDelta = Math.sqrt(Math.pow(currentTouches[0].clientX - currentTouches[1].clientX, 2) + Math.pow(currentTouches[0].clientY - currentTouches[1].clientY, 2));
|
||||
var zoomAmount = lastDelta / currentDelta;
|
||||
|
||||
if (zoom < zoomMin && zoomAmount > 1 || zoom > zoomMax && zoomAmount < 1) {
|
||||
zoomAmount = 1;
|
||||
}
|
||||
|
||||
var currentFocus = {
|
||||
x: currentTouches[0].clientX + 0.5 * (currentTouches[1].clientX - currentTouches[0].clientX),
|
||||
y: currentTouches[0].clientY + 0.5 * (currentTouches[1].clientY - currentTouches[0].clientY)
|
||||
};
|
||||
var lastFocus = {
|
||||
x: lastTouches[0].clientX + 0.5 * (lastTouches[1].clientX - lastTouches[0].clientX),
|
||||
y: lastTouches[0].clientY + 0.5 * (lastTouches[1].clientY - lastTouches[0].clientY)
|
||||
};
|
||||
var p = this.point(currentFocus.x, currentFocus.y);
|
||||
var focusP = this.point(2 * currentFocus.x - lastFocus.x, 2 * currentFocus.y - lastFocus.y);
|
||||
var box = new svg_js.Box(this.viewbox()).transform(new svg_js.Matrix().translate(-focusP.x, -focusP.y).scale(zoomAmount, 0, 0).translate(p.x, p.y));
|
||||
restrictToMargins(box);
|
||||
this.viewbox(box);
|
||||
lastTouches = currentTouches;
|
||||
this.dispatch('zoom', {
|
||||
box: box,
|
||||
focus: focusP
|
||||
});
|
||||
};
|
||||
|
||||
var panStart = function panStart(ev) {
|
||||
var isMouse = ev.type.indexOf('mouse') > -1; // In case panStart is called with touch, ev.button is undefined
|
||||
|
||||
if (isMouse && ev.button !== panButton && ev.which !== panButton + 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
ev.preventDefault();
|
||||
this.off('mousedown.panZoom', panStart);
|
||||
lastTouches = normalizeEvent(ev);
|
||||
if (zoomInProgress) return;
|
||||
this.dispatch('panStart', {
|
||||
event: ev
|
||||
});
|
||||
lastP = {
|
||||
x: lastTouches[0].clientX,
|
||||
y: lastTouches[0].clientY
|
||||
};
|
||||
svg_js.on(document, 'touchmove.panZoom mousemove.panZoom', panning, this, {
|
||||
passive: false
|
||||
});
|
||||
svg_js.on(document, 'touchend.panZoom mouseup.panZoom', panStop, this, {
|
||||
passive: false
|
||||
});
|
||||
};
|
||||
|
||||
var panStop = function panStop(ev) {
|
||||
ev.preventDefault();
|
||||
svg_js.off(document, 'touchmove.panZoom mousemove.panZoom', panning);
|
||||
svg_js.off(document, 'touchend.panZoom mouseup.panZoom', panStop);
|
||||
this.on('mousedown.panZoom', panStart);
|
||||
this.dispatch('panEnd', {
|
||||
event: ev
|
||||
});
|
||||
};
|
||||
|
||||
var panning = function panning(ev) {
|
||||
ev.preventDefault();
|
||||
var currentTouches = normalizeEvent(ev);
|
||||
var currentP = {
|
||||
x: currentTouches[0].clientX,
|
||||
y: currentTouches[0].clientY
|
||||
};
|
||||
var p1 = this.point(currentP.x, currentP.y);
|
||||
var p2 = this.point(lastP.x, lastP.y);
|
||||
var deltaP = [p2.x - p1.x, p2.y - p1.y];
|
||||
|
||||
if (!deltaP[0] && !deltaP[1]) {
|
||||
return;
|
||||
}
|
||||
|
||||
var box = new svg_js.Box(this.viewbox()).transform(new svg_js.Matrix().translate(deltaP[0], deltaP[1]));
|
||||
lastP = currentP;
|
||||
restrictToMargins(box);
|
||||
|
||||
if (this.dispatch('panning', {
|
||||
box: box,
|
||||
event: ev
|
||||
}).defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.viewbox(box);
|
||||
};
|
||||
|
||||
if (doWheelZoom) {
|
||||
this.on('wheel.panZoom', wheelZoom, this, {
|
||||
passive: false
|
||||
});
|
||||
}
|
||||
|
||||
if (doPinchZoom) {
|
||||
this.on('touchstart.panZoom', pinchZoomStart, this, {
|
||||
passive: false
|
||||
});
|
||||
}
|
||||
|
||||
if (doPanning) {
|
||||
this.on('mousedown.panZoom', panStart, this, {
|
||||
passive: false
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
}(SVG));
|
||||
//# sourceMappingURL=svg.panzoom.js.map
|
||||
1
docs/xqdoc/resources/svgdotjs/svg.panzoom.js.map
Normal file
1
docs/xqdoc/resources/svgdotjs/svg.panzoom.js.map
Normal file
File diff suppressed because one or more lines are too long
3
docs/xqdoc/resources/svgdotjs/svg.panzoom.min.js
vendored
Normal file
3
docs/xqdoc/resources/svgdotjs/svg.panzoom.min.js
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
/*! @svgdotjs/svg.panzoom.js v2.1.2 MIT*/;
|
||||
!function(D){"use strict";function G(t){return t.touches||[{clientX:t.clientX,clientY:t.clientY}]}D.extend(D.Svg,{panZoom:function(t){var n,e,i,o,a,l,h,s,c,E,u,V=this;if(this.off(".panZoom"),!1===t)return this;function m(t){if(!_)return t;var n=_.top,e=_.left,i=_.bottom,o=_.right,a=V.attr(["width","height"]),l=a.width,h=a.height,s=V.node.preserveAspectRatio.baseVal,c=0,E=0,u=0,m=0;if(s.align!==s.SVG_PRESERVEASPECTRATIO_NONE){var p=l/h,r=x.width/x.height;if(r!=p){var S=s.meetOrSlice!==s.SVG_MEETORSLICE_SLICE,R=r<p?"width":"height",M="width"==R,A=S&&M||!S&&!M,v=A?p/r:r/p,f=t[R]-t[R]*v;A?s.align===s.SVG_PRESERVEASPECTRATIO_XMIDYMIN||s.align===s.SVG_PRESERVEASPECTRATIO_XMIDYMID||s.align===s.SVG_PRESERVEASPECTRATIO_XMIDYMAX?(c=f/2,E=-f/2):s.align===s.SVG_PRESERVEASPECTRATIO_XMINYMIN||s.align===s.SVG_PRESERVEASPECTRATIO_XMINYMID||s.align===s.SVG_PRESERVEASPECTRATIO_XMINYMAX?E=-f:s.align!==s.SVG_PRESERVEASPECTRATIO_XMAXYMIN&&s.align!==s.SVG_PRESERVEASPECTRATIO_XMAXYMID&&s.align!==s.SVG_PRESERVEASPECTRATIO_XMAXYMAX||(c=f):s.align===s.SVG_PRESERVEASPECTRATIO_XMINYMID||s.align===s.SVG_PRESERVEASPECTRATIO_XMIDYMID||s.align===s.SVG_PRESERVEASPECTRATIO_XMAXYMID?(u=f/2,m=-f/2):s.align===s.SVG_PRESERVEASPECTRATIO_XMINYMIN||s.align===s.SVG_PRESERVEASPECTRATIO_XMIDYMIN||s.align===s.SVG_PRESERVEASPECTRATIO_XMAXYMIN?m=-f:s.align!==s.SVG_PRESERVEASPECTRATIO_XMINYMAX&&s.align!==s.SVG_PRESERVEASPECTRATIO_XMIDYMAX&&s.align!==s.SVG_PRESERVEASPECTRATIO_XMAXYMAX||(u=f)}}var d=x.width+x.x-e-c,I=x.x+o-t.width-E,X=x.height+x.y-n-u,P=x.y+i-t.height-m;return t.x=Math.min(d,Math.max(I,t.x)),t.y=Math.min(X,Math.max(P,t.y)),t}function p(t){(S=G(t)).length<2?d&&X&&Z.call(this,t):(d&&X&&O.call(this,t),t.preventDefault(),this.dispatch("pinchZoomStart",{event:t}).defaultPrevented||(this.off("touchstart.panZoom",p),Y=!0,D.on(document,"touchmove.panZoom",w,this,{passive:!1}),D.on(document,"touchend.panZoom",g,this,{passive:!1})))}var r,S,R=null!=(n=(t=null!=t?t:{}).zoomFactor)?n:2,M=null!=(e=t.zoomMin)?e:Number.MIN_VALUE,A=null!=(i=t.zoomMax)?i:Number.MAX_VALUE,v=null==(o=t.wheelZoom)||o,f=null==(a=t.pinchZoom)||a,d=null==(l=t.panning)||l,I=null!=(h=t.panButton)?h:0,X=null!=(s=t.oneFingerPan)&&s,_=null!=(c=t.margins)&&c,P=null!=(E=t.wheelZoomDeltaModeLinePixels)?E:17,T=null!=(u=t.wheelZoomDeltaModeScreenPixels)?u:53,Y=!1,x=this.viewbox(),g=function t(n){n.preventDefault();var e=G(n);1<e.length||(Y=!1,this.dispatch("pinchZoomEnd",{event:n}),D.off(document,"touchmove.panZoom",w),D.off(document,"touchend.panZoom",t),this.on("touchstart.panZoom",p),e.length&&d&&X&&Z.call(this,n))},w=function(t){t.preventDefault();var n=G(t),e=this.zoom(),i=Math.sqrt(Math.pow(S[0].clientX-S[1].clientX,2)+Math.pow(S[0].clientY-S[1].clientY,2))/Math.sqrt(Math.pow(n[0].clientX-n[1].clientX,2)+Math.pow(n[0].clientY-n[1].clientY,2));(e<M&&1<i||A<e&&i<1)&&(i=1);var o={x:n[0].clientX+.5*(n[1].clientX-n[0].clientX),y:n[0].clientY+.5*(n[1].clientY-n[0].clientY)},a=S[0].clientX+.5*(S[1].clientX-S[0].clientX),l=S[0].clientY+.5*(S[1].clientY-S[0].clientY),h=this.point(o.x,o.y),s=this.point(2*o.x-a,2*o.y-l),c=new D.Box(this.viewbox()).transform((new D.Matrix).translate(-s.x,-s.y).scale(i,0,0).translate(h.x,h.y));m(c),this.viewbox(c),S=n,this.dispatch("zoom",{box:c,focus:s})},Z=function t(n){-1<n.type.indexOf("mouse")&&n.button!==I&&n.which!==I+1||(n.preventDefault(),this.off("mousedown.panZoom",t),S=G(n),Y||(this.dispatch("panStart",{event:n}),r={x:S[0].clientX,y:S[0].clientY},D.on(document,"touchmove.panZoom mousemove.panZoom",C,this,{passive:!1}),D.on(document,"touchend.panZoom mouseup.panZoom",O,this,{passive:!1})))},O=function t(n){n.preventDefault(),D.off(document,"touchmove.panZoom mousemove.panZoom",C),D.off(document,"touchend.panZoom mouseup.panZoom",t),this.on("mousedown.panZoom",Z),this.dispatch("panEnd",{event:n})},C=function(t){t.preventDefault();var n=G(t),e={x:n[0].clientX,y:n[0].clientY},i=this.point(e.x,e.y),o=this.point(r.x,r.y),a=[o.x-i.x,o.y-i.y];if(a[0]||a[1]){var l=new D.Box(this.viewbox()).transform((new D.Matrix).translate(a[0],a[1]));r=e,m(l),this.dispatch("panning",{box:l,event:t}).defaultPrevented||this.viewbox(l)}};return v&&this.on("wheel.panZoom",function(t){var n;switch(t.preventDefault(),t.deltaMode){case 1:n=t.deltaY*P;break;case 2:n=t.deltaY*T;break;default:n=t.deltaY}var e=Math.pow(1+R,-1*n/100)*this.zoom(),i=this.point(t.clientX,t.clientY);if(A<e&&(e=A),e<M&&(e=M),this.dispatch("zoom",{level:e,focus:i}).defaultPrevented)return this;if(this.zoom(e,i),_){var o=m(this.viewbox());this.viewbox(o)}},this,{passive:!1}),f&&this.on("touchstart.panZoom",p,this,{passive:!1}),d&&this.on("mousedown.panZoom",Z,this,{passive:!1}),this}})}(SVG);
|
||||
//# sourceMappingURL=svg.panzoom.min.js.map
|
||||
1
docs/xqdoc/resources/svgdotjs/svg.panzoom.min.js.map
Normal file
1
docs/xqdoc/resources/svgdotjs/svg.panzoom.min.js.map
Normal file
File diff suppressed because one or more lines are too long
BIN
docs/xqdoc/resources/xqdoc.png
Normal file
BIN
docs/xqdoc/resources/xqdoc.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
74
docs/xqdoc/resources/xqdoca.js
Normal file
74
docs/xqdoc/resources/xqdoca.js
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
// simple javascript support
|
||||
|
||||
//https://www.w3schools.com/howto/howto_js_treeview.asp
|
||||
var toggler = document.getElementsByClassName("caret");
|
||||
var i;
|
||||
|
||||
for (i = 0; i < toggler.length; i++) {
|
||||
toggler[i].addEventListener("click", function () {
|
||||
this.parentElement.querySelector(".nested").classList.toggle("active");
|
||||
this.classList.toggle("caret-down");
|
||||
});
|
||||
}
|
||||
// table sort https://stackoverflow.com/questions/10683712/html-table-sort#10683805
|
||||
document.querySelectorAll('th').forEach((element) => { // Table headers
|
||||
element.addEventListener('click', function () {
|
||||
let table = this.closest('table');
|
||||
|
||||
// If the column is sortable
|
||||
if (this.querySelector('span')) {
|
||||
let order_icon = this.querySelector('span');
|
||||
let order = encodeURI(order_icon.innerHTML).includes('%E2%86%91') ? 'desc' : 'asc';
|
||||
let separator = '-----'; // Separate the value of it's index, so data keeps intact
|
||||
|
||||
let value_list = {}; // <tr> Object
|
||||
let obj_key = []; // Values of selected column
|
||||
|
||||
let string_count = 0;
|
||||
let number_count = 0;
|
||||
|
||||
// <tbody> rows
|
||||
table.querySelectorAll('tbody tr').forEach((line, index_line) => {
|
||||
// Value of each field
|
||||
let key = line.children[element.cellIndex].textContent.toUpperCase();
|
||||
|
||||
// Check if value is date, numeric or string
|
||||
if (line.children[element.cellIndex].hasAttribute('data-timestamp')) {
|
||||
// if value is date, we store it's timestamp, so we can sort like a number
|
||||
key = line.children[element.cellIndex].getAttribute('data-timestamp');
|
||||
}
|
||||
else if (key.replace('-', '').match(/^[0-9,.]*$/g)) {
|
||||
number_count++;
|
||||
}
|
||||
else {
|
||||
string_count++;
|
||||
}
|
||||
|
||||
value_list[key + separator + index_line] = line.outerHTML.replace(/(\t)|(\n)/g, ''); // Adding <tr> to object
|
||||
obj_key.push(key + separator + index_line);
|
||||
});
|
||||
if (string_count === 0) { // If all values are numeric
|
||||
obj_key.sort(function (a, b) {
|
||||
return a.split(separator)[0] - b.split(separator)[0];
|
||||
});
|
||||
}
|
||||
else {
|
||||
obj_key.sort();
|
||||
}
|
||||
|
||||
if (order === 'desc') {
|
||||
obj_key.reverse();
|
||||
order_icon.innerHTML = '↓';
|
||||
}
|
||||
else {
|
||||
order_icon.innerHTML = '↑';
|
||||
}
|
||||
|
||||
let html = '';
|
||||
obj_key.forEach(function (chave) {
|
||||
html += value_list[chave];
|
||||
});
|
||||
table.getElementsByTagName('tbody')[0].innerHTML = html;
|
||||
}
|
||||
});
|
||||
});
|
||||
10
docs/xqdoc/restxq.html
Normal file
10
docs/xqdoc/restxq.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html><html xmlns="http:/www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/><meta http-equiv="Generator" content="xqdoca - https://github.com/quodatum/xqdoca"/><title>src - xqDocA - xqDocA</title><link rel="shortcut icon" type="image/x-icon" href="resources/xqdoc.png"/><link rel="stylesheet" type="text/css" href="resources/prism/1.29.0/prism.css"/><link rel="stylesheet" type="text/css" href="resources/page.css"/><link rel="stylesheet" type="text/css" href="resources/query.css"/><link rel="stylesheet" type="text/css" href="resources/base.css"/></head><body class="home" id="top"><div id="main" class="line-numbers"><div><h1>
|
||||
Project <span class="badge badge-info">src</span>
|
||||
RestXQ documentation
|
||||
</h1><nav id="toc"><h2><a href="index.html">src</a>
|
||||
/ RestXQ
|
||||
</h2><span class="ml-2"><a href="annotations.html" title="Summary of XQuery annotation use " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">annotations</a><a href="imports.html" title="Summary of import usage " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports</a><a href="mermaid.html" title="Project wide module imports as html mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports-diag</a><a href="mermaid.mmd" title="Project wide module imports as a mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">imports-diag.mmd</a><a href="index.html" title="Index of sources " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">report</a><a href="validation-report.xml" title="validate generated xqdoc files " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoc-validate</a><a href="xqdoca.xml" title="xqDocA run configuration report (XML) " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoca.xml</a></span><h3>
|
||||
Contents
|
||||
</h3><ol class="toc"><li><a href="#summary"><span class="secno">1 </span><span class="content">Summary</span></a></li><li><a href="#rest"><span class="secno">2 </span><span class="content">Rest Paths</span></a></li></ol></nav><section id="summary"><h2>Summary</h2><p>No RESTXQ usage</p><details><summary>Related documents</summary><table class="data"><thead><th>View</th><th>Description</th><th>Format</th></thead><tbody><tr><td><a href="index.html" title="Index of sources " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">report</a></td><td>Index of sources</td><td>xhtml</td></tr><tr><td><a href="imports.html" title="Summary of import usage " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports</a></td><td>Summary of import usage</td><td>xhtml</td></tr><tr><td><a href="mermaid.html" title="Project wide module imports as html mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">imports-diag</a></td><td>Project wide module imports as html mermaid class diagram</td><td>html5</td></tr><tr><td><a href="mermaid.mmd" title="Project wide module imports as a mermaid class diagram " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">imports-diag.mmd</a></td><td>Project wide module imports as a mermaid class diagram</td><td>text</td></tr><tr><td><a href="annotations.html" title="Summary of XQuery annotation use " class="badge badge-pill badge-light" style="margin-left:1em" target="_self">annotations</a></td><td>Summary of XQuery annotation use</td><td>xhtml</td></tr><tr><td><a href="xqdoca.xml" title="xqDocA run configuration report (XML) " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoca.xml</a></td><td>xqDocA run configuration report (XML)</td><td>xml</td></tr><tr><td><a href="validation-report.xml" title="validate generated xqdoc files " class="badge badge-pill badge-light" style="margin-left:1em" target="_blank">xqdoc-validate</a></td><td>validate generated xqdoc files</td><td>xml</td></tr></tbody></table></details></section><section id="rest"><h2>Rest interface paths</h2></section></div></div><div class="footer"><p style="text-align:right">Generated by
|
||||
<a href="https://github.com/Quodatum/xqdoca" target="_blank">xqDocA <span>0.9.1</span></a>
|
||||
on <span title="2025-06-01T21:16:07.687+01:00">Sunday, 1st June 2025</span></p></div><script src="resources/prism/1.29.0/prism.js" type="text/javascript"></script><script src="resources/xqdoca.js" type="text/javascript"></script></body></html>
|
||||
1
docs/xqdoc/validation-report.xml
Normal file
1
docs/xqdoc/validation-report.xml
Normal file
|
|
@ -0,0 +1 @@
|
|||
<errors created="2025-06-01T21:16:07.687+01:00" schema="file:///C:/Users/mrwhe/git/quodatum/xqdoca/src/main/etc/models/xqdoc-1.1.xsd" errors="0"><report source="Pdfbox3.xqm" xqdoc="modules/F000001/"><status>valid</status></report></errors>
|
||||
13
docs/xqdoc/xqdoca.xml
Normal file
13
docs/xqdoc/xqdoca.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<xqdoca created="2025-06-01T21:16:07.687+01:00"><xqdoca>0.9.1</xqdoca><target>docs/xqdoc/</target><outputs><global>
|
||||
report
|
||||
restxq
|
||||
imports
|
||||
imports-diag imports-diag.mmd
|
||||
annotations
|
||||
xqdoca.xml
|
||||
xqdoc-validate
|
||||
</global><module>
|
||||
module
|
||||
xqdoc
|
||||
xqparse
|
||||
</module></outputs><platform>basex</platform><extensions>*.xqm,*.xq,*.xquery</extensions><project>src</project><source>src/</source><xqdoc><refs>true</refs><body-items>true</body-items><version>1.1</version><body-full>true</body-full></xqdoc></xqdoca>
|
||||
Loading…
Add table
Reference in a new issue