From 248433c920f935ffcaee52b240f0c162decc1564 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 09 五月 2022 15:16:45 +0800
Subject: [PATCH] NFMUtilUpdate

---
 force-app/main/default/pages/QuotePDF.page |  493 ++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 343 insertions(+), 150 deletions(-)

diff --git a/force-app/main/default/pages/QuotePDF.page b/force-app/main/default/pages/QuotePDF.page
index 0248eda..103cf6e 100644
--- a/force-app/main/default/pages/QuotePDF.page
+++ b/force-app/main/default/pages/QuotePDF.page
@@ -1,4 +1,5 @@
-<apex:page Controller="QuotePDFController" showHeader="false" sidebar="false" id="allPage" action="{!init}" renderAs="pdf">
+<apex:page Controller="QuotePDFController" showHeader="false" sidebar="false" id="allPage" action="{!init}" >
+    <!-- <apex:page Controller="QuotePDFController" showHeader="false" sidebar="false" id="allPage" action="{!init}" renderAs="pdf"> -->
 <head>
     <style>
         @page {
@@ -8,156 +9,348 @@
     </style>
 </head>
 <body style="font-family: Arial Unicode MS; page-break-inside: auto">
-    <table border="0" width="100%" style="border-collapse: collapse;">
-        <tr>
-            <td style="text-align:right;">{!quoteInfo.quoteDate}</td>
-        </tr>
-        <tr>
-            <td style="text-align:right;">{!$ObjectType.Quote.label}#{!quoteInfo.quoteNo}</td>
-        </tr>
-        <tr>
-            <td style="text-align:right;">{!$Label.Label_Total_pages}锛歿!pageCnt}</td>
-        </tr>
-        <tr>
-            <td style="text-align:left;">{!$Label.Label_From}锛歿!quoteInfo.dealerName}</td>
-        </tr>
-        <tr>
-            <td style="text-align:left;">{!$ObjectType.Contact.label}锛歿!quoteInfo.dealerContactName}&nbsp;&nbsp;&nbsp;&nbsp;{!$ObjectType.Contact.fields.MobilePhone.label}锛歿!quoteInfo.dealerContactPhone}</td>
-        </tr>
-        <tr>
-            <td style="text-align:left;">{!$ObjectType.Account.fields.Address1__c.label}锛歿!quoteInfo.dealerAddress}</td>
-        </tr>
-        <tr>
-            <td style="text-align:left;">{!$ObjectType.Contact.fields.Phone.label}锛歿!quoteInfo.dealerPhone}&nbsp;&nbsp;&nbsp;&nbsp;{!$ObjectType.Contact.fields.Fax.label}锛歿!quoteInfo.dealerFax}</td>
-        </tr>
-        <tr>
-            <td style="text-align:left;">{!$ObjectType.Contact.fields.Email.label}锛歿!quoteInfo.dealerEmail}</td>
-        </tr>
-        <tr>
-            <td style="text-align:left;">&nbsp;</td>
-        </tr>
-        <tr>
-            <td style="text-align:left;">{!$Label.Label_To}锛歿!quoteInfo.accountName}</td>
-        </tr>
-        <tr>
-            <td style="text-align:left;">{!quoteInfo.accountContactName}</td>
-        </tr>
-        <tr>
-            <td style="text-align:left;">{!$ObjectType.Contact.fields.Phone.label}锛歿!quoteInfo.accountContactPhone}&nbsp;&nbsp;&nbsp;&nbsp;{!$ObjectType.Contact.fields.Email.label}锛歿!quoteInfo.accountContactEmail}</td>
-        </tr>
-    </table>
-
-    <br/>
-    Quotation Sheet(Quotation #{!quoteInfo.quoteNo})<br/>
-
-    <table border="1" width="100%" style="border-collapse: collapse;table-layout: fixed;">
-        <colgroup>
-            <col width="10%" />
-            <col width="60%" />
-            <col width="10%" />
-            <col width="20%" />
-        </colgroup>
-        <tr style="text-align: center;">
-            <th>{!$Label.Label_Units}</th>
-            <th>{!$Label.Label_Description}</th>
-            <th>{!$ObjectType.QuoteLineItem.fields.Quantity.label}</th>
-            <th>{!$ObjectType.QuoteLineItem.fields.TotalPrice.label}{!currencyIsoCode}</th>
-        </tr>
+    <div id="pdf-wrapper">
+        <div class="pdf-page">
+            <table border="0" width="100%" style="border-collapse: collapse;">
+                <tr>
+                    <td style="text-align:right;">{!quoteInfo.quoteDate}</td>
+                </tr>
+                <tr>
+                    <td style="text-align:right;">{!$ObjectType.Quote.label}#{!quoteInfo.quoteNo}</td>
+                </tr>
+                <tr>
+                    <td style="text-align:right;">{!$Label.Label_Total_pages}锛歿!pageCnt}</td>
+                </tr>
+                <tr>
+                    <td style="text-align:left;">{!$Label.Label_From}锛歿!quoteInfo.dealerName}</td>
+                </tr>
+                <tr>
+                    <td style="text-align:left;">{!$ObjectType.Contact.label}锛�<span id="dealerContactName">{!quoteInfo.dealerContactName}</span>&nbsp;&nbsp;&nbsp;&nbsp;{!$ObjectType.Contact.fields.MobilePhone.label}锛�<span>{!quoteInfo.dealerContactPhone}</span></td>
+                </tr>
+                <tr>
+                    <td style="text-align:left;">{!$ObjectType.Account.fields.Address1__c.label}锛歿!quoteInfo.dealerAddress}</td>
+                </tr>
+                <tr>
+                    <td style="text-align:left;">{!$ObjectType.Contact.fields.Phone.label}锛歿!quoteInfo.dealerPhone}&nbsp;&nbsp;&nbsp;&nbsp;{!$ObjectType.Contact.fields.Fax.label}锛歿!quoteInfo.dealerFax}</td>
+                </tr>
+                <tr>
+                    <td style="text-align:left;">{!$ObjectType.Contact.fields.Email.label}锛歿!quoteInfo.dealerEmail}</td>
+                </tr>
+                <tr>
+                    <td style="text-align:left;">&nbsp;</td>
+                </tr>
+                <tr>
+                    <td style="text-align:left;">{!$Label.Label_To}锛歿!quoteInfo.accountName}</td>
+                </tr>
+                <tr>
+                    <td style="text-align:left;" id="accountContactName">{!quoteInfo.accountContactName}</td>
+                </tr>
+                <tr>
+                    <td style="text-align:left;">{!$ObjectType.Contact.fields.Phone.label}锛�<span id="accountContactPhone">{!quoteInfo.accountContactPhone}</span>&nbsp;&nbsp;&nbsp;&nbsp;{!$ObjectType.Contact.fields.Email.label}锛�<span id="accountContactEmail">{!quoteInfo.accountContactEmail}</span></td>
+                </tr>
+            </table>
+        
+            <br/>
+            Quotation Sheet(Quotation #{!quoteInfo.quoteNo})<br/>
+        
+            <table border="1" width="100%" style="border-collapse: collapse;table-layout: fixed;">
+                <colgroup>
+                    <col width="10%" />
+                    <col width="60%" />
+                    <col width="10%" />
+                    <col width="20%" />
+                </colgroup>
+                <tr style="text-align: center;">
+                    <th>{!$Label.Label_Units}</th>
+                    <th>{!$Label.Label_Description}</th>
+                    <th>{!$ObjectType.QuoteLineItem.fields.Quantity.label}</th>
+                    <th>{!$ObjectType.QuoteLineItem.fields.TotalPrice.label}{!currencyIsoCode}</th>
+                </tr>
+                <apex:repeat value="{!printRecords}" var="set">
+                <tr>
+                    <td style="text-align: center;"><apex:outputText value="{!set.units}" /></td>
+                    <td><apex:outputText value="{!set.description}" /></td>
+                    <td style="text-align: right;"><apex:outputText value="{!set.qty}" /></td>
+                    <td style="text-align: right;"><apex:outputText value="{!set.total}" /></td>
+                </tr>
+                </apex:repeat>
+            </table>
+        
+            <br/>
+        
+            Note:<br/>
+        <!--     1)  The payment terms are {!quoteInfo.note1} .<br/>
+            浠樻鏂瑰紡 {!quoteInfo.note2} 銆�<br/>
+            2)  Quoation valid until {!quoteInfo.note3} .<br/>
+            鎶ヤ环鏈夋晥鏈熷埌 {!quoteInfo.note3} 銆�<br/>
+            3)  All the commodoties come with {!quoteInfo.note4} year's manufacturer warranty.<br/>
+            鎵�鏈夊晢鍝佸惈 {!quoteInfo.note4} 骞村巶瀹朵繚淇��<br/>
+            4)  The above quotations are {!quoteInfo.note5} prices, Commodoties shipped to the clien's requirements.<br/>
+            涓婅堪鎶ヤ环涓� {!quoteInfo.note5} 浠凤紝鍟嗗搧閫佽嚦瀹㈡埛鎸囧畾鍦扮偣銆�<br/>
+            5)  The above quotations are all {!quoteInfo.note6}.<br/>
+            涓婅堪鎶ヤ环鍧囦负 {!quoteInfo.note7} 浠枫��<br/>
+            6)  Configuration as per attached.<br/>
+            閰嶇疆娓呭崟璇﹁闄勪欢銆�<br/> -->
+            <apex:outputText value="{!quoteInfo.comment}" escape="false"/>
+        <!--     1)  The above quotations are CIP prices, Commodities shipped to the client鈥檚 requirements.<br/>
+            2)  The above quotations are all tax {!quoteInfo.note2}.<br/>
+            3)  The payment terms are {!quoteInfo.note3}.<br/>
+            4)  Quotation valid until {!quoteInfo.note4}.<br/>
+            5)  All the commodities come with {!quoteInfo.note5} year鈥檚 manufacturer warranty.<br/>
+            6)  Configuration as per attached.<br/>
+            7)  Delivery lead time is {!quoteInfo.note7} days after receipt of payment.<br/> -->
+            
+        </div>
+        <apex:outputPanel rendered="{!pageCnt > 1}" layout="none">
+            <div style="page-break-after: always;"/>
+        </apex:outputPanel>
+        
+        <apex:variable value="{!1}" var="cnt1" />
         <apex:repeat value="{!printRecords}" var="set">
-        <tr>
-            <td style="text-align: center;"><apex:outputText value="{!set.units}" /></td>
-            <td><apex:outputText value="{!set.description}" /></td>
-            <td style="text-align: right;"><apex:outputText value="{!set.qty}" /></td>
-            <td style="text-align: right;"><apex:outputText value="{!set.total}" /></td>
-        </tr>
+            <!-- <apex:variable value="{!1}" var="cnt2" /> -->
+            <apex:repeat value="{!set.setPage}" var="sp">
+                <div class="pdf-page">
+                    <table border="1" width="100%" style="border-collapse: collapse;table-layout: fixed; font-size: 12px;">
+                        <colgroup>
+                            <col width="3%" />
+                            <col width="10%" />
+                            <col width="15%" />
+                            <col width="{!IF(isPrintPrice=='true', 23, 33)}%" />
+                            <col width="{!IF(isPrintPrice=='true', 20, 33)}%" />
+                            <col width="5%" />
+                            <apex:outputPanel rendered="{!isPrintPrice=='true'}" layout="none">
+                            <col width="12%" />
+                            <col width="12%" />
+                            </apex:outputPanel>
+                        </colgroup>
+                        <!-- <apex:outputPanel rendered="{!cnt2 == 1}" layout="none"> -->
+                        <tr style="text-align: center;">
+                            <td colspan="{!IF(isPrintPrice=='true', 8, 6)}">{!set.description}{!$Label.Label_Set_detail}</td>
+                        </tr>
+                        <!-- </apex:outputPanel> -->
+                        <tr style="text-align: center;">
+                            <td>{!$Label.Label_No}</td>
+                            <td>{!$ObjectType.Product2.fields.ProductCode.label}</td>
+                            <td>{!$ObjectType.Product2.fields.Product_ECCode__c.label}</td>
+                            <td>{!$ObjectType.Product2.fields.Description.label}</td>
+                            <td>{!$ObjectType.QuoteLineItem.fields.Description.label}</td>
+                            <td>{!$ObjectType.QuoteLineItem.fields.Quantity.label}</td>
+                            <apex:outputPanel rendered="{!isPrintPrice=='true'}" layout="none">
+                            <td>{!$ObjectType.QuoteLineItem.fields.UnitPrice.label}{!currencyIsoCode}</td>
+                            <td>{!$ObjectType.QuoteLineItem.fields.TotalPrice.label}{!currencyIsoCode}</td>
+                            </apex:outputPanel>
+                        </tr>
+                        <apex:repeat value="{!sp}" var="line">
+                        <tr>
+                            <td style="text-align: center;"><apex:outputText value="{!line.lineNo}" /></td>
+                            <td><apex:outputText escape="false" value="{!line.productCode}" /></td>
+                            <td><apex:outputText escape="false" value="{!line.productEC}" /></td>
+                            <td><apex:outputText escape="false" value="{!line.description}" /></td>
+                            <td><apex:outputText escape="false" value="{!line.comment}" /></td>
+                            <td style="text-align: right;"><apex:outputText value="{!line.quantity}" /></td>
+                            <apex:outputPanel rendered="{!isPrintPrice=='true'}" layout="none">
+                            <td style="text-align: right;"><apex:outputText value="{!line.price}" /></td>
+                            <td style="text-align: right;"><apex:outputText value="{!line.totalPrice}" /></td>
+                            </apex:outputPanel>
+                        </tr>
+                        </apex:repeat>
+                    </table>
+                </div>
+            
+    
+            <apex:outputPanel rendered="{!cnt1 < pageCnt - 1}" layout="none">
+                <div style="page-break-after: always;"/>
+            </apex:outputPanel>
+    
+            <!-- <apex:variable value="{!cnt2 + 1}" var="cnt2" /> -->
+            <apex:variable value="{!cnt1 + 1}" var="cnt1" />
+            </apex:repeat>
         </apex:repeat>
-    </table>
-
-    <br/>
-
-    Note:<br/>
-<!--     1)  The payment terms are {!quoteInfo.note1} .<br/>
-    浠樻鏂瑰紡 {!quoteInfo.note2} 銆�<br/>
-    2)  Quoation valid until {!quoteInfo.note3} .<br/>
-    鎶ヤ环鏈夋晥鏈熷埌 {!quoteInfo.note3} 銆�<br/>
-    3)  All the commodoties come with {!quoteInfo.note4} year's manufacturer warranty.<br/>
-    鎵�鏈夊晢鍝佸惈 {!quoteInfo.note4} 骞村巶瀹朵繚淇��<br/>
-    4)  The above quotations are {!quoteInfo.note5} prices, Commodoties shipped to the clien's requirements.<br/>
-    涓婅堪鎶ヤ环涓� {!quoteInfo.note5} 浠凤紝鍟嗗搧閫佽嚦瀹㈡埛鎸囧畾鍦扮偣銆�<br/>
-    5)  The above quotations are all {!quoteInfo.note6}.<br/>
-    涓婅堪鎶ヤ环鍧囦负 {!quoteInfo.note7} 浠枫��<br/>
-    6)  Configuration as per attached.<br/>
-    閰嶇疆娓呭崟璇﹁闄勪欢銆�<br/> -->
-    <apex:outputText value="{!quoteInfo.comment}" escape="false"/>
-<!--     1)  The above quotations are CIP prices, Commodities shipped to the client鈥檚 requirements.<br/>
-    2)  The above quotations are all tax {!quoteInfo.note2}.<br/>
-    3)  The payment terms are {!quoteInfo.note3}.<br/>
-    4)  Quotation valid until {!quoteInfo.note4}.<br/>
-    5)  All the commodities come with {!quoteInfo.note5} year鈥檚 manufacturer warranty.<br/>
-    6)  Configuration as per attached.<br/>
-    7)  Delivery lead time is {!quoteInfo.note7} days after receipt of payment.<br/> -->
-
-    <apex:outputPanel rendered="{!pageCnt > 1}" layout="none">
-        <div style="page-break-after: always;"/>
-    </apex:outputPanel>
-
-<apex:variable value="{!1}" var="cnt1" />
-<apex:repeat value="{!printRecords}" var="set">
-    <!-- <apex:variable value="{!1}" var="cnt2" /> -->
-    <apex:repeat value="{!set.setPage}" var="sp">
-    <table border="1" width="100%" style="border-collapse: collapse;table-layout: fixed; font-size: 12px;">
-        <colgroup>
-            <col width="3%" />
-            <col width="10%" />
-            <col width="15%" />
-            <col width="{!IF(isPrintPrice=='true', 23, 33)}%" />
-            <col width="{!IF(isPrintPrice=='true', 20, 33)}%" />
-            <col width="5%" />
-            <apex:outputPanel rendered="{!isPrintPrice=='true'}" layout="none">
-            <col width="12%" />
-            <col width="12%" />
-            </apex:outputPanel>
-        </colgroup>
-        <!-- <apex:outputPanel rendered="{!cnt2 == 1}" layout="none"> -->
-        <tr style="text-align: center;">
-            <td colspan="{!IF(isPrintPrice=='true', 8, 6)}">{!set.description}{!$Label.Label_Set_detail}</td>
-        </tr>
-        <!-- </apex:outputPanel> -->
-        <tr style="text-align: center;">
-            <td>{!$Label.Label_No}</td>
-            <td>{!$ObjectType.Product2.fields.ProductCode.label}</td>
-            <td>{!$ObjectType.Product2.fields.Product_ECCode__c.label}</td>
-            <td>{!$ObjectType.Product2.fields.Description.label}</td>
-            <td>{!$ObjectType.QuoteLineItem.fields.Description.label}</td>
-            <td>{!$ObjectType.QuoteLineItem.fields.Quantity.label}</td>
-            <apex:outputPanel rendered="{!isPrintPrice=='true'}" layout="none">
-            <td>{!$ObjectType.QuoteLineItem.fields.UnitPrice.label}{!currencyIsoCode}</td>
-            <td>{!$ObjectType.QuoteLineItem.fields.TotalPrice.label}{!currencyIsoCode}</td>
-            </apex:outputPanel>
-        </tr>
-        <apex:repeat value="{!sp}" var="line">
-        <tr>
-            <td style="text-align: center;"><apex:outputText value="{!line.lineNo}" /></td>
-            <td><apex:outputText escape="false" value="{!line.productCode}" /></td>
-            <td><apex:outputText escape="false" value="{!line.productEC}" /></td>
-            <td><apex:outputText escape="false" value="{!line.description}" /></td>
-            <td><apex:outputText escape="false" value="{!line.comment}" /></td>
-            <td style="text-align: right;"><apex:outputText value="{!line.quantity}" /></td>
-            <apex:outputPanel rendered="{!isPrintPrice=='true'}" layout="none">
-            <td style="text-align: right;"><apex:outputText value="{!line.price}" /></td>
-            <td style="text-align: right;"><apex:outputText value="{!line.totalPrice}" /></td>
-            </apex:outputPanel>
-        </tr>
-        </apex:repeat>
-    </table>
-
-    <apex:outputPanel rendered="{!cnt1 < pageCnt - 1}" layout="none">
-        <div style="page-break-after: always;"/>
-    </apex:outputPanel>
-
-    <!-- <apex:variable value="{!cnt2 + 1}" var="cnt2" /> -->
-    <apex:variable value="{!cnt1 + 1}" var="cnt1" />
-    </apex:repeat>
-</apex:repeat>
+    </div>
 </body>
+<style>
+    /* 20220221 PI鏀归�� by 寰愪寒 start */
+    body{margin: 0 auto;width: 780px;}
+    .title1{height: 30px;}
+    .title2{height: 110px;}
+    /* 20220221 PI鏀归�� by 寰愪寒 end */
+</style>
+<!-- 20220221 PI鏀归�� by 寰愪寒 start  -->
+<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
+<script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
+<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
+<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
+<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+<apex:includeScript value="{!URLFOR($Resource.jspdf)}"/>
+<apex:includeScript value="{!URLFOR($Resource.html2canvas)}"/>
+
+<!-- 20220221 PI鏀归�� by 寰愪寒 end  -->
+<!-- 20220221 PI鏀归�� by 寰愪寒 start  -->
+<script>
+    AWSService.sfSessionId = '{!GETSESSIONID()}';
+    sforce.connection.serverUrl = '{!$Site.Prefix}/services/Soap/u/53.0';
+    var staticResourceContact = JSON.parse('{!staticResourceContact}');
+    var staticResourceOpportunity = JSON.parse('{!staticResourceOpportunity}');
+    var staticResourceFile = JSON.parse('{!staticResourceFile}');
+    function Fun(pdf) {
+
+        var form = jQuery("<form method='post'></form>");
+        jQuery(document.body).append(form);
+        let href = window.location.href
+        let arr = href.split('/')
+        form.attr({ "action": staticResourceFile.hostUrl + staticResourceFile.extraInfo + "?from=" + encodeURIComponent(href) + "&fileName=" + encodeURIComponent(arr[arr.length - 1].split('?')[0]) });
+        // form.attr({"action":"http://127.0.0.1:8080/a/d?from="+encodeURIComponent(window.location.href)});
+        let input = jQuery("<input type='hidden'/>");
+        input.attr({ "name": "base64Str" });
+        input.val(pdf.output('datauristring').substr(28));
+        form.append(input);
+        form.submit();
+
+        // jQuery("body > *").each(function(){
+        // 	jQuery(this).css('display','none');
+        // })
+        // jQuery("body").append('<embed style="position:absolute; left: 0; top: 0;" width="100%" height="100%" src="'+pdf.output('datauristring')+'" type="application/pdf"/>')
+
+    }
+
+    let id = "pdf-wrapper";
+    var target = document.getElementById(id);
+    // 鎶奿mageDta杞崲鎴恥rl
+        // page_height锛氫竴椤电殑楂樺害
+        function ImageDataToUrl(img_data,page_height){
+            let cvs = document.createElement("CANVAS");
+            cvs.width = img_data.width;
+            cvs.height = page_height;
+            var ctx= cvs.getContext("2d");
+            ctx.fillStyle="white";
+            ctx.fillRect(0,0,cvs.width,cvs.height);// 濉厖canvas鎵�鏈夊尯鍩熶负鐧借壊
+            ctx.putImageData(img_data,0,0);
+            return cvs.toDataURL('image/jpeg', 1.0);
+        }
+        function jsPdfDownload() {
+    
+            let jtargets = jQuery("#pdf-wrapper .pdf-page");
+            let j_arr = new Array(jtargets.length + 1).join(0).split('').map(function () { return false });
+            let landscape = false;
+            let pw = 595.28;
+            let ph = 841.89;
+            const marginw = 40;
+            const marginh = 40;
+    
+            let orientation = '';
+            if (landscape) {
+                pw += ph; ph = pw - ph; pw = pw - ph;
+                orientation = 'l';
+            }
+            var pdf = new jsPDF(orientation, 'pt', 'a4');// 绗竴涓弬鏁板~瀛楁瘝l锛屾敞鎰忎笉鏄暟瀛�1锛屼负妯悜pdf
+            jtargets.each(function (i, e) {
+                e.style.background = "#FFFFFF";
+            })
+    
+            let rei = 0;
+            let recursion = null;
+            recursion = function (i) {
+                if (i >= jtargets.length) {
+                    Fun(pdf);
+                    return;
+                }
+                e = jtargets[i];
+                html2canvas(e, {
+                    scale: 2,
+                    onrendered: function (canvas) {
+                        /**
+                        鏈柟娉曢渶瑕佸仛鍑犱釜浜嬫儏
+                        1.闇�瑕佹妸canvas鐨勫唴瀹瑰垎椤垫樉绀哄埌pdf鐨勯〉涓�
+                        2.canvas鐨勫楂橀渶瑕佸拰pdf鐨勫楂樿繘琛屾槧灏�
+                        3.鎴彇鍒扮殑鍐呭闇�瑕佹斁杩涗竴椤靛楂樼殑canvas閲岄潰锛屽苟瀵瑰叾浣欏尯鍩熷埛鐧�
+                        */
+                        var ctx = canvas.getContext("2d");
+                        let canvas_max_page_num = 9;
+                        let canvas_current_page_num = 0;
+                        var contentWidth = canvas.width;
+                        var contentHeight = canvas.height;
+    
+                        
+                        //鏈敓鎴恜df鐨刪tml椤甸潰楂樺害
+                        var leftHeight = contentHeight;
+                        //椤甸潰鍋忕Щ
+                        var position = 0;
+                        
+                        //a4绾哥殑灏哄[595.28,841.89]锛宧tml椤甸潰鐢熸垚鐨刢anvas鍦╬df涓浘鐗囩殑瀹介珮
+                        var outputWidth = pw - 2 * marginw;//595.28//宸﹀彸杈硅窛20
+                        let rate = outputWidth / 780;//杈撳嚭瀹藉害鍜屽唴瀹瑰搴︾殑姣斾緥
+                        var outputHeight = ph - 2 * marginh;//宸﹀彸杈硅窛20
+                        let onePdfPageInCanvasHeight = contentWidth/outputWidth*outputHeight;//涓�椤祊df鍦╟anvas涓殑楂樺害;
+                        //var pageData = canvas.toDataURL('image/jpeg', 1.0);
+                        var pageData = null;
+                        var imgData = null;
+                        
+                        var captureHeight = null;// 鎴彇鐨勫綋鍓峜anvas椤电殑楂樺害
+                        
+                        let j = i;
+                        while(position < contentHeight){
+                            
+                            if (j++) {
+                                pdf.addPage();
+                            }
+
+                            if(position+onePdfPageInCanvasHeight>contentHeight){
+                                captureHeight = contentHeight-position;
+                            }else{
+                                captureHeight = onePdfPageInCanvasHeight;
+                            }
+    
+                            imgData = ctx.getImageData(0,position,contentWidth,captureHeight);
+                            pageData = ImageDataToUrl(imgData,onePdfPageInCanvasHeight);
+                            pdf.addImage(pageData, 'JPEG', marginw, marginh, outputWidth, outputHeight);//宸﹀彸杈硅窛20,琚緭鍑虹殑鍥剧墖浼氳鎷変几涓簅utputWidth锛宱utputHeight鐨勫楂�
+                            canvas_current_page_num++;
+                            position += onePdfPageInCanvasHeight;
+                            if (canvas_max_page_num > 0 && canvas_current_page_num >= canvas_max_page_num) {
+                                break;
+                            }
+                        }
+    
+                        recursion(i + 1);
+                    }
+                })
+            };
+            recursion(rei);
+    
+    
+    
+        }
+    
+        //blockme();
+        document.body.onload = function(){
+            
+            let i = 0;
+            let Foo = function(){
+                if ( i == 2) {
+                    if(confirm("PDF宸插姞杞藉畬姣曪紝鏄惁鏄剧ず锛�")){
+                        jsPdfDownload(); 
+                    }
+                }
+            }
+
+            AWSService.query(staticResourceContact.queryUrl, '{!quoteInfo.conAwsDataId}', function(data){
+                //unblockUI();
+                document.getElementById("accountContactName").innerHTML = data.object.lastName;
+                document.getElementById("accountContactPhone").innerHTML = data.object.phone;
+                document.getElementById("accountContactEmail").innerHTML = data.object.email;
+                i++;
+                Foo();
+            }, staticResourceContact.token);
+
+            AWSService.query(staticResourceOpportunity.queryUrl, '{!quoteInfo.oppAwsDataId}', function(data){
+                //unblockUI();
+                document.getElementById("dealerContactName").innerHTML = data.object.dealerSalesStaffName;
+                i++;
+                Foo();
+            }, staticResourceOpportunity.token);
+        }
+        
+        
+    
+</script>
+<!-- 20220221 PI鏀归�� by 寰愪寒 end  -->
 </apex:page>
\ No newline at end of file

--
Gitblit v1.9.1