PMA.UI Examples 2.43.3by Pathomation

Static image

basicviewport
Console
PMA.UI version: 2.43.3
2
Success! Viewport initialized successfully.
Static image loading on viewport example.
static_image.html
1<!doctype html>
2<html lang="en">
3
4<head>
5    <meta charset="utf-8">
6    <meta http-equiv="X-UA-Compatible" content="IE=10">
7    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
8
9    <!-- Include PMA.UI required libraries downloaded or from CDN -->
10    <script src="./pma.ui/jquery-3.1.0.js"></script>
11    <link href="./pma.ui/font-awesome.min.css" type="text/css" rel="stylesheet">
12
13    <!-- Include PMA.UI script & css -->
14    <script src="./pma.ui/pma.ui.js"></script>
15    <link href="./pma.ui/pma.ui.css" type="text/css" rel="stylesheet">
16
17    <!-- Include custom script & css -->
18    <script src="./js/static_image.js"></script>
19    <link href="./css/static_image.css" type="text/css" rel="stylesheet">
20
21    <title>Static Image</title>
22</head>
23
24<body>
25    <!-- The element that will host the viewport -->
26    <div id="viewer"></div>
27</body>
28
29</html>
static_image.css
1html,
2body
3{
4    height: 100%;
5    padding: 0px;
6    margin: 0px;
7}
8
9#viewer
10{
11    height: 100vh;
12}
static_image.js
1// Initial declarations
2var viewerElementSelector = "#viewer";
3
4jQuery(function () {
5    console.log(`PMA.UI version: ${PMA.UI.getVersion()}`);
6
7    // Initialize the viewport
8    new PMA.UI.View.Viewport(
9        // Viewport parameters
10        {
11            element: viewerElementSelector,
12            referenceImage: {
13                src: "https://host.pathomation.com/logo.png",
14                width: 383,
15                height: 183,
16                backgroundColor: "#ffffff",
17            }
18        },
19        // Success callback function
20        function () {
21            console.log("Success! Viewport initialized successfully.");
22        },
23        // Failure callback function
24        function () {
25            console.log("Error! Viewport failed to initialize properly.");
26        }
27    );
28});