-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage.html
More file actions
56 lines (36 loc) · 1.06 KB
/
image.html
File metadata and controls
56 lines (36 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8' />
<script type="module" >
import { PDF, PDFPage, PDFImage, PDFStream } from "../source/index.mjs"
window.addEventListener('load', function() {
var img = new Image();
img.onload = function() {
var doc = PDF.Create();
var image = PDFImage.From( img );
var page = new PDFPage();
page.use( image );
var content = new PDF.Path2D();
content.drawImage( image, 50, 50, 50, 50, 0 );
content.save();
content.translate( 125, 100 );
content.drawImage( image, 0, 0, 50, 50, Math.PI/2 );
content.restore()
page.append( new PDFStream( content ) );
doc.attach( page );
doc.preview( document.body, innerWidth, innerHeight );
// doc.open();
// doc.download();
};
img.src = 'imageSample.jpg';
}, false);
</script>
<style>
* { padding:0; margin:0; }
iframe { position: absolute; margin:auto; left:0; top:0; bottom:0; right:0; }
</style>
</head>
<body>
</body>
</html>