ikinci temizlik tamamlandı

This commit is contained in:
Ümit Tunç
2026-04-28 21:15:09 +03:00
parent f80443aec0
commit 37e7296527
8313 changed files with 2400677 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,65 @@
// @link WebViewerInstance: https://www.pdftron.com/api/web/WebViewerInstance.html
// @link DocumentViewer: https://www.pdftron.com/api/web/Core.DocumentViewer.html
// @link AnnotationManager: https://www.pdftron.com/api/web/Core.AnnotationManager.html
// @link AnnotationManager.drawAnnotations: https://www.pdftron.com/api/web/Core.AnnotationManager.html#drawAnnotations__anchor
// @link Annotations: https://www.pdftron.com/api/web/Annotations.html
WebViewer(
{
path: '../../../lib',
initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/form1.pdf',
},
document.getElementById('viewer')
).then(instance => {
samplesSetup(instance);
const { documentViewer, annotationManager, Annotations } = instance.Core;
documentViewer.addEventListener('documentLoaded', () => {
const pageCount = documentViewer.getPageCount();
const defaultStyles = Annotations.WidgetAnnotation.getCustomStyles;
const defaultContainerStyles = Annotations.WidgetAnnotation.getContainerCustomStyles;
const customStyles = widget => {
if (widget instanceof Annotations.TextWidgetAnnotation) {
if (widget.fieldName === 'f1-1') {
return {
'background-color': 'lightgreen',
};
}
return {
'background-color': 'lightblue',
color: 'brown',
};
}
if (widget instanceof Annotations.PushButtonWidgetAnnotation) {
return {
'background-color': 'red',
color: 'white',
};
}
};
const customContainerStyles = widget => {
if (widget instanceof Annotations.WidgetAnnotation) {
return {
border: '2px solid green',
};
}
};
document.getElementById('form').onchange = e => {
if (e.target.id === 'custom') {
// Change styles for widget annotations
Annotations.WidgetAnnotation.getCustomStyles = customStyles;
Annotations.WidgetAnnotation.getContainerCustomStyles = customContainerStyles;
} else {
Annotations.WidgetAnnotation.getCustomStyles = defaultStyles;
Annotations.WidgetAnnotation.getContainerCustomStyles = defaultContainerStyles;
}
for (let i = 0; i < pageCount; i++) {
// Redraw canvas
annotationManager.drawAnnotations(i + 1, null, true);
}
};
});
});
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="../../style.css" />
<script src="../../../lib/webviewer.min.js"></script>
<script src="../../old-browser-checker.js"></script>
<script src="../../global.js"></script>
<title>JavaScript PDF Viewer Customize Forms Demo</title>
<script src="../../modernizr.custom.min.js"></script>
</head>
<body>
<header>
<div class="title sample">Customize Form Style Demo for PDF Viewer</div>
</header>
<aside>
<h1>Controls</h1>
<h2>Form field styles</h2>
<form id="form">
<input type="radio" name="form" id="default" checked />
<label for="default">Default</label>
<br />
<input type="radio" name="form" id="custom" />
<label for="custom">Custom</label>
</form>
<hr />
<h1>Instructions</h1>
<p>Use the buttons to change form field styles.</p>
</aside>
<div id="viewer"></div>
<script src="../../menu-button.js"></script>
<!--ga-tag-->
<script>
Modernizr.addTest('async', function() {
try {
var result;
eval('let a = () => {result = "success"}; let b = async () => {await a()}; b()');
return result === 'success';
} catch (e) {
return false;
}
});
// test for async and fall back to code compiled to ES5 if they are not supported
['form-fields.js'].forEach(function(js) {
var script = Modernizr.async ? js : js.replace('.js', '.ES5.js');
var scriptTag = document.createElement('script');
scriptTag.src = script;
scriptTag.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(scriptTag);
});
</script>
</body>
</html>
@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<script>
if (window.location.href.slice(-1) !== '/' && window.location.href.slice(-4) !== 'html') {
// hacky redirect for mac php server...
window.location = window.location.href + '/';
}
</script>
<link rel="stylesheet" href="../style.css" />
<title>Forms Demo & Samples for JavaScript PDF Viewer</title>
</head>
<body class="pdfjs">
<header>
<div class="container">
<div>
<a href="https://pdftron.com" target="_blank">
<div class="logo"></div>
</a>
<span class="title">PDFJS Express</span>
</div>
<div>
<a class="button" href="https://pdfjs.express/documentation/get-started/overview" target="_blank">Go to Guides</a>
<a class="button filled" href="https://pdfjs.express/purchase" target="_blank">Purchase</a>
</div>
</div>
</header>
<section>
<div class="sidebar">
<p><b>Samples</b></p>
<p><a class="" href="../">Viewing</a></p>
<p><a class="" href="../annotation">Annotation</a></p>
<p><a class="active" href=".">Forms</a></p>
<p><a class="" href="../customization">Customization</a></p>
<p><a class="" href="../advanced">Advanced</a></p>
<p><b>Showcase</b></p>
<p><a href="https://pdfjs.express/demo" target="_blank">Go to showcase</a></p>
</div>
<div class="content">
<div id="error-message" style="display: none; background-color: red; color: white">Samples are not runnable from the file system. Please run using "npm start" or use a local web server.</div>
<h1>Forms Demo for PDF Viewer</h1>
<div>
<h4>Customizing form fields</h4>
<p>
Shows how to change color and opacity of form fields.
<br />
</p>
<div class="inline">
<a href="./form-fields">Launch demo</a>
<a href="./form-fields/form-fields.js" target="_self">View Source</a>
</div>
</div>
</div>
</section>
<script>
if (window.location.href.indexOf('file://') === 0) {
alert('Samples are not runnable from the file system. Please run using "npm start" or use a local web server.');
document.getElementById('error-message').style.display = 'block';
}
</script>
</body>
</html>