<script src="//mozilla.github.io/pdf.js/build/pdf.js"></script>
|
|
<div class = "container">
|
<form action="index.php?state=0&confirmGDPR=1" method="post" class="form-signin">
|
{if $logo}<div><img src="images/{$logo}" alt="logo" title="logo" class="logo"></div>{/if}
|
{if $flags_view}
|
<div>
|
<a href="index.php?lng=3" title="German" style="margin-left:5px;padding:0px;"><img src="images/flag_DEU.png" style="width:25px;" alt="German" /></a>
|
<a href="index.php?lng=2" title="English"><img src="images/flag_ENG.png" style="width:25px;" alt="English" /></a>
|
<a href="index.php?lng=1" title="Russian"><img src="images/flag_RUS.png" style="width:25px;" alt="Russian" /></a>
|
<a href="index.php?lng=4" title="French"><img src="images/flag_FRA.png" style="width:25px;" alt="French" /></a>
|
<!--a href="index.php?lng=5" title="Italian"><img src="images/flag_ITA.png" style="width:25px;" alt="Italian" /></a-->
|
<a href="index.php?lng=5" title="Poland"><img src="images/flag_POL.png" style="width:25px;" alt="Poland" /></a>
|
<!--a href="index.php?lng=6" title="Spanish"><img src="images/flag_SPA.png" style="width:25px;" alt="Spanish" /></a-->
|
<a href="index.php?lng=6" title="עברית"><img src="images/flag_ISR.png" style="width:25px;" alt="עברית" /></a>
|
</div>
|
{/if}
|
|
<hr class="colorgraph"><br>
|
<table>
|
<tr>
|
<td>
|
<div style="border: 1px solid black;direction: ltr; overflow: scroll; height: 350px; width: 350px" id='pdf-viewer'></div>
|
</td>
|
</tr>
|
<tr>
|
<td><input class="btn btn-lg btn-primary btn-block" type="submit" style="float: right;width:100px;" value="Schließen" /></td>
|
</tr>
|
</table>
|
</form>
|
</div>
|
|
|
{literal}
|
<script>
|
// If absolute URL from the remote server is provided, configure the CORS
|
// header on that server.
|
var url = 'getfile.php?ppolicy=1&id=9999';
|
|
// Loaded via <script> tag, create shortcut to access PDF.js exports.
|
var pdfjsLib = window['pdfjs-dist/build/pdf'];
|
|
// The workerSrc property shall be specified.
|
pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
|
|
var pdfDoc = null,
|
pageNum = 1,
|
pageRendering = false,
|
pageNumPending = null,
|
scale = 2,
|
//canvas = document.getElementById('the-canvas'),
|
canvas = document.getElementById('pdf-viewer')/*,
|
ctx = canvas.getContext('2d')*/;
|
|
//canvas.style.width = (getClientWidth()-10)+'px';
|
//canvas.style.height = (getClientHeight()-120)+'px';
|
|
/**
|
* Get page info from document, resize canvas accordingly, and render page.
|
* @param num Page number.
|
*/
|
function renderPage(num, canvas) {
|
pageRendering = true;
|
// Using promise to fetch the page
|
pdfDoc.getPage(num).then(function(page) {
|
var viewport = page.getViewport({scale: scale});
|
canvas.height = viewport.height;
|
canvas.width = viewport.width;
|
|
page.render({canvasContext: canvas.getContext('2d'), viewport: viewport});
|
|
// Render PDF page into canvas context
|
/*var renderContext = {
|
canvasContext: ctx,
|
viewport: viewport
|
};
|
var renderTask = page.render(renderContext);
|
|
// Wait for rendering to finish
|
renderTask.promise.then(function() {
|
pageRendering = false;
|
if (pageNumPending !== null) {
|
// New page rendering is pending
|
renderPage(pageNumPending);
|
pageNumPending = null;
|
}
|
});*/
|
});
|
|
// Update page counters
|
//document.getElementById('page_num').textContent = num;
|
}
|
|
/**
|
* If another page rendering in progress, waits until the rendering is
|
* finised. Otherwise, executes rendering immediately.
|
*/
|
function queueRenderPage(num) {
|
if (pageRendering) {
|
pageNumPending = num;
|
} else {
|
renderPage(num);
|
}
|
}
|
|
/**
|
* Displays previous page.
|
*/
|
function onPrevPage() {
|
if (pageNum <= 1) {
|
//return;
|
pageNum = pageNum;
|
} else
|
pageNum--;
|
queueRenderPage(pageNum);
|
}
|
//document.getElementById('prev').addEventListener('click', onPrevPage);
|
|
/**
|
* Displays next page.
|
*/
|
function onNextPage() {
|
if (pageNum >= pdfDoc.numPages) {
|
//return;
|
pageNum = pageNum;
|
} else
|
pageNum++;
|
queueRenderPage(pageNum);
|
}
|
//document.getElementById('next').addEventListener('click', onNextPage);
|
|
function onChangeOrientation() {
|
//debugger;
|
canvas.style.width = (getClientWidth()-10)+'px';
|
canvas.style.height = (getClientHeight()-120)+'px';
|
}
|
//window.addEventListener("orientationchange", onChangeOrientation, false);
|
|
/**
|
* Asynchronously downloads PDF.
|
*/
|
pdfjsLib.getDocument(url).promise.then(function(pdfDoc_) {
|
pdfDoc = pdfDoc_;
|
//document.getElementById('page_count').textContent = pdfDoc.numPages;
|
|
// Initial/first page rendering
|
//renderPage(pageNum);
|
|
viewer = document.getElementById('pdf-viewer');
|
|
for(page = 1; page <= pdfDoc.numPages; page++) {
|
canvas = document.createElement("canvas");
|
canvas.className = 'pdf-page-canvas';
|
viewer.appendChild(canvas);
|
renderPage(page, canvas);
|
}
|
|
/*for(page = 1; page <= pdfDoc.numPages; page++) {
|
canvas = document.createElement("canvas");
|
canvas.className = 'pdf-page-canvas';
|
canvas.appendChild(canvas);
|
renderPage(page, canvas);
|
}*/
|
});
|
</script>
|
{/literal}
|