Files
Hoops_Exchange/publish/publishhtml/htmlforserver/exportpdftohtml/root/viewer.html
2025-12-15 22:10:55 +08:00

122 lines
4.0 KiB
HTML

<!-- // Copyright (c) Tech Soft 3D, Inc.
//
// The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
// and considered a trade secret as defined under civil and criminal statutes.
// Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
// unauthorized use or misappropriation of its trade secrets. Use of this information
// by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
// a written non-disclosure agreement, expressly prescribing the scope and manner of such use. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Security-Policy" content="img-src * data:;" />
<meta name="viewport">
<title>TS3DPDF</title>
<!-- Required CSS files -->
<link rel="stylesheet" href="css/pdf.css">
<link rel="stylesheet" href="css/pdf_elements.css">
<link rel="stylesheet" href="css/pdf_bom_carousels.css">
<link rel="stylesheet" href="js/swipper/swiper.min.css">
<link rel="stylesheet" href="css/Navigation.css">
</head>
<body>
<!-- Loader animation -->
<div id="loader">
<div id="loaderCircle"></div>
<span id="loader-info"></span>
</div>
<!-- Required div : this div will encapsulates the PDF document. -->
<div id="main" class="pdfcontainer"></div>
<!-- Required javascript inclusion -->
<script src="js/Hoops.js"></script>
<script src="js/pdfReader/all.min-obf.js"></script>
<!-- This part checks if the browser is supported -->
<script>
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
var isAppleWebKit = /AppleWebKit/.test(navigator.userAgent);
var isFirefox = /firefox/i.test(navigator.userAgent);
var isEdgeOrInternetExplorer = /Edge/.test(navigator.userAgent) || /Trident/.test(navigator.userAgent) || /MSIE/.test(navigator.userAgent);
if(isEdgeOrInternetExplorer || (isChrome == false && isSafari == false && isFirefox == false && isAppleWebKit == false))
{
window.location = "BrowserNotSupported.html";
}
</script>
<!-- This part extracts the parameters from the URL-->
<script>
//['MONOLITHICHTML_BEGIN']
// The previous line is used to delimiter text replacement while converting a web export into a monolithic file.
Hoops.Window.extractUrlParameters();
let sample = Hoops.Window.getUrlParameter("sample");
if(sample == null)
{
Hoops.Window.setUrlParameter("sample", "sample_DemoDataModel"); // to read the demo file without any parameter
}
//['MONOLITHICHTML_END']
</script>
<!-- This part loads the XML file -->
<script>
//['BASE64XML_BEGIN']
let loaderDiv = document.getElementById("loader");
let loaderInfo = document.getElementById("loader-info");
loaderInfo.textContent = "Loading. Please wait...";
let xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function()
{
if (this.readyState == 4)
{
if(this.status == 200)
{
let xmlDocument = this.responseText;
if(xmlDocument != "")
{
// Once the XML document is ready, we parse it to create HTML elements.
Hoops.PdfWebViewer.OpenDocumentFromXml(xmlDocument);
}
else
{
loaderDiv.classList.add("fail");
loaderInfo.textContent = "Sorry, the sample was not found.";
}
}
else
{
loaderDiv.classList.add("fail");
loaderInfo.textContent = "Sorry, the sample was not found.";
}
}
};
try
{
//the path for XHR request
let xmlContentPath = "PdfContent/";
let encodedURI = encodeURIComponent(xmlContentPath + decodeURI(Hoops.Window.getUrlParameter("sample")) + ".xml");
xhttp.open("GET", encodedURI, true);
xhttp.send();
}
catch(err)
{
console.error(err);
}
//['BASE64XML_END']
</script>
</body>
</html>