jQuery toggleClass example
Toggle class name on click in jQuery
by alan_omar
HTML
<head>
<meta charset="utf-8" />
<title></title>
<meta name="generator" content="BBEdit 13.5" />
<!-- Adapated from https://github.com/Hopding/pdf-lib/issues/457 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/pdf-lib.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@pdf-lib/fontkit/dist/fontkit.umd.min.js"></script>
<script src="https://unpkg.com//[email protected]/download.js"></script>
</head>
<body>
<h5>
Use Browser to Print or Download
</h5>
<button class="uibuttonsmallred pdf-lib" id="flatten">Flatten</button>
<button class="uibuttonsmallred pdf-lib" id="saveform">Save</button>
<iframe style="display:none;border:0;margin:5px;padding:5px;" src="" id="pdf"></iframe>
</body>
CSS
.modal-dialog {
max-width:100%;
}
#flatten {
position: absolute;
top: 0;
right: 0;
left: 0;
margin: auto;
}
#saveform {
position: absolute;
top: 20px;
right: 0;
left: 0;
margin: auto;
}
JavaScript
var pdfDoc;
var pdfBytes;
var formfields;
// $("[src='https://unpkg.com/[email protected]/dist/pdf-lib.min.js']").on("load", function(e) {
$(function() {
// e.preventDefault();
const {
PDFDocument,
PDFDocumentWriter,
rgb
} = PDFLib;
RenderData('https://sscotti.org/MRI_NOChecks1.pdf', {
"MRN": {
"value": "MRN: CM0000002\nOrder: CMACC00000001\nName: Last, First\nDOB: 2001-01-01\nTime: Jul 04, 2021 12:00 PM",
"type": "text",
"font": 8
},
"PatientName": {
"value": "Last, First",
"type": "text"
},
"StudyDescription": {
"value": "MRI BRAIN \/ BRAIN STEM - WITHOUT CONTRAST",
"type": "text",
"font": 8
},
"PatientHeight": {
"value": "",
"type": "text"
},
"PatientWeight": {
"value": "",
"type": "text"
},
"PatientAdditionalHistory": {
"value": "test",
"type": "text"
},
"PriorSurg": {
"value": "None In Record",
"type": "text",
"font": 8
},
"Priors": {
"value": "",
"type": "text"
},
"Pacer": {
"value": "1",
"type": "radio"
},
"CABG": {
"value": "0",
"type": "radio"
},
"CNSClips": {
"value": "0",
"type": "radio"
},
"EyeMetal": {
"value": "0",
"type": "radio"
},
"Hearing": {
"value": "0",
"type": "radio"
},
"BodyMetal": {
"value": "0",
"type": "radio"
},
"BodyDevice": {
"value": "0",
"type": "radio"
},
"Piercings": {
"value": "0",
"type": "radio"
},
"Transdermal": {
"value": "0",
"type": "radio"
},
"Panics": {
"value": "0",
"type": "radio"
},
"Sedative": {
"value": "0",
"type": "radio"
},
"NoDriving": {
"value": "0",
"type": "radio"
},
"Pregnant": {
"value": "0",
"type": "radio"
},
"BreastFeeding": {
"value":...