Szablon:Pdf: Różnice pomiędzy wersjami
Przejdź do nawigacji
Przejdź do wyszukiwania
Linia 1: | Linia 1: | ||
<html> | |||
< | <script> | ||
'use strict'; | |||
// | |||
// Fetch the PDF document from the URL using promises | |||
// | |||
PDFJS.getDocument('/pdf/broszura-ulga-Internet-za-2013.pdf').then(function(pdf) { | |||
// Using promise to fetch the page | |||
pdf.getPage(1).then(function(page) { | |||
var scale = 1.5; | |||
var viewport = page.getViewport(scale); | |||
// | |||
// Prepare canvas using PDF page dimensions | |||
// | |||
var canvas = document.getElementById('the-canvas'); | |||
var context = canvas.getContext('2d'); | |||
canvas.height = viewport.height; | |||
canvas.width = viewport.width; | |||
// | |||
// Render PDF page into canvas context | |||
// | |||
var renderContext = { | |||
canvasContext: context, | |||
viewport: viewport | |||
}; | |||
page.render(renderContext); | |||
}); | |||
}); | |||
</script> | |||
<canvas id="the-canvas" style="border:1px solid black;"/> | |||
</html> | |||
{{{1}}} | {{{1}}} | ||
po canvasie | po canvasie |
Wersja z 11:12, 15 sie 2014
{{{1}}}
po canvasie