2016-11-17 2 views
0

pdfExport 이벤트로 검도 편집기의 내용을 내보내고 추가적으로 somme 텍스트를 헤더로 추가하려고합니다.kendo-editor의 pdf 내보내기

그리고 마침내 첫 번째 콘텐츠 인 원래 값으로 돌아가고 싶습니다.

내보내기 종료를 감지하는 이벤트로 e.promise.done을 사용하려고했습니다.

  var meetingsEditorParams = { 
       tools: ['bold', 'italic', 'underline', 'strikethrough', 'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull', 'insertUnorderedList', 'insertOrderedList', 'indent', 'outdent', 'createTable', 'addRowAbove', 'addRowBelow', 'addColumnLeft', 'addColumnRight', 'deleteRow', 'deleteColumn', 'formatting' ,'pdf'], 

       stylesheets: ["../../../../Content/css/pdf-export-styles.css"], 
       pdf: { 
        fileName: "RECAP-TO-PRINT : " + self.fileName + ".pdf",   
        paperSize: "a4", 
        margin: { 
         bottom: 20, 
         left: 20, 
         right: 20, 
         top: 20 
        } 
       }, 
       pdfExport: function (e) { 

      //add the header to the original content and export it 
      self.meetingEditor.value("Header To Insert" + self.Content()); 
      // go back to the original content after the export 
      e.promise.done(self.meetingEditor.value(self.Content())); 

       } 
       , 
       change: function (e) { 
        console.log(self.meetingEditor.value()); 
        self.Content(self.meetingEditor.value()); 
       } 
      }; 

      self.meetingEditor = $("#meetingEditor").kendoEditor(meetingsEditorParams).data("kendoEditor"); 

문제는 내가 항상 원본 콘텐츠를 내보내고 헤더를 무시한다는 것입니다.

답변

0

나는 당신이 거기에 PDF 콘텐츠를 바꿀 수 없다고 생각한다. pdfExport()은 아마도 너무 늦었다.

내장 된 PDF 내보내기 버튼 대신 사용자 정의 버튼을 클릭하여 $("#yourEditor").getKendoEditor().saveAsPDF()을 사용하여 PDF를 생성 할 수 있습니다. 그 전에는 생성 된 PDF를보기를 원하면 변경하고 약속 완료시 다시 변경할 수 있습니다.

$("#btnPdfExport").kendoButton({ 
    click:function(){ 
    // change it here 
    $("#yourEditor").getKendoEditor().saveAsPDF(); 
    } 
}); 

을 그리고 말에 약속이 문제의 코드에서와 같이 완료되면 당신이 그것을 다시 변경할 수 pdfExport 이벤트 :이 같은

뭔가, 아마 (이 테스트를하지 않은 경우).