Hello, I'm trying to write a Javascript function to print a div to a PDF.
However, I'm facing a strange error when I run the code.
"Uncaught SyntaxError: '' literal not terminated before end of script"
<script type="text/javascript">
    $(function () {
        $("#btnPrint").click(function () {
            var contents = $("#PrintPdf").html();
            var frame1 = $('<iframe/>');
            frame1[0].name = "frame1";
            frame1.css({ "position": "absolute", "top": "-1000000px" });
            $("body").append(frame1);
            var frameDoc = frame1[0].contentWindow ? frame1[0].contentWindow : frame1[0].contentDocument.document ? frame1[0].contentDocument.document : frame1[0].contentDocument;
            frameDoc.document.open();
            //Create a new HTML document.
            frameDoc.document.write('<html><head><title>PD Details</title>');
            frameDoc.document.write('<link href="../../Content/bootstrapGold.css" rel="stylesheet" type="text/css" />');
            //Append the external CSS file.
            frameDoc.document.write('</head><body>');
            //Append the DIV contents.
            frameDoc.document.write(contents);
            frameDoc.document.write('</body></html>');
            frameDoc.document.close();
            setTimeout(function () {
                window.frames["frame1"].focus();
                window.frames["frame1"].print();
                frame1.remove();
            }, 500);
        });
    });
</script>