Thanks!
Code: Select all
@{ViewBag.Title = "Index"; Layout = null;}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>DocuVieware - PDF Form Fieds Demo.</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="~/Scripts/docuvieware-min.js"></script>
<link href="~/Content/docuvieware-min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="application_container">
<div id="toolbar_container">
<!-- Toolbar -->
<button onclick="generatePDFA(); return false;">Generate PDF/A</button>
</div>
<div id="viewer_container">
@{
GdPicture14.WEB.DocuVieware docuVieware = new GdPicture14.WEB.DocuVieware
{
ID = "DocuVieware1",
Timeout = 60,
Height = new System.Web.UI.WebControls.Unit("100%"),
Width = new System.Web.UI.WebControls.Unit("100%"),
DisableAnnotationDrawingModePanel = true,
SinglePageView = false,
ForceScrollBars = false,
AllowedExportFormats = "*",
MaxUploadSize = 52428800,
CollapsedSnapIn = true,
EnableMouseModeButtons = false,
EnableFileUploadButton = true,
EnableLoadFromUriButton = true,
EnablePrintButton = true,
EnableSaveButton = true,
ShowThumbnailsSnapIn = true,
ShowBookmarksSnapIn = false,
ShowTextSearchSnapIn = false,
ShowAnnotationsSnapIn = true,
EnableTwainAcquisitionButton = true,
EnableThumbnailDragDrop = true
};
docuVieware.RenderControl(Output);
}
</div>
</div>
<script>
// This function will trigger the custom action handled in TwainAcquisitionDemo.cs
// a callback function will be called upon generatePDFA success with result that
// contains binary data in the form of a base64 encoded string
function generatePDFA() {
if (DocuViewareAPI.GetPageCount() !== 0) {
var params = { FileData: "" };
DocuViewareAPI.PostCustomServerAction("DocuVieware1", true, "generatePDFA", params, function (result) {
savePdfAFile("archive.pdf", base64ToPdfBlob(result));
});
}
}
// This function converts the base64 string to a PDF binary object
function base64ToPdfBlob(base64) {
var sliceSize = 1024;
var byteChars = window.atob(base64);
var byteArrays = [];
for (var offset = 0, len = byteChars.length; offset < len; offset += sliceSize) {
var slice = byteChars.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
return new Blob(byteArrays, { type: "application/pdf" });
}
// This function actually downloads the PDF binary object as a regular file
function savePdfAFile(name, data) {
if (data != null && navigator.msSaveBlob) {
return navigator.msSaveBlob(new Blob([data], { type: "data:attachment/pdf" }), name);
}
var url = window.URL.createObjectURL(new Blob([data], { type: "data:attachment/pdf" }));
var tempLink = $("<a download='" + name + "' href='" + url + "'></a>");
tempLink.appendTo('body');
tempLink[0].click();
tempLink.remove();
}
</script>
</body>
</html>
at HTMLButtonElement.onclick (IndexWebix:29)
IndexWebix:29 Uncaught TypeError: Cannot read property 'LoadFromUriDialog_Click' of undefined
at HTMLButtonElement.onclick (IndexWebix:29)
onclick @ IndexWebix:29
IndexWebix:29 Uncaught TypeError: Cannot read property 'LoadFromFile_Click' of undefined
at HTMLButtonElement.onclick (IndexWebix:29)
onclick @ IndexWebix:29
IndexWebix:29 Uncaught TypeError: Cannot read property 'Print_Click' of undefined
at HTMLButtonElement.onclick (IndexWebix:29)