taxtank-core 2.0.63 → 2.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,6 @@ import mixpanel from 'mixpanel-browser';
41
41
  import { JwtHelperService } from '@auth0/angular-jwt';
42
42
  import { jsPDF } from 'jspdf';
43
43
  import { applyPlugin } from 'jspdf-autotable';
44
- import html2pdf from 'html2pdf.js';
45
44
  import * as xlsx from '@e965/xlsx';
46
45
  import * as FileSaver from 'file-saver';
47
46
  import * as i1$2 from '@angular/platform-browser';
@@ -20612,21 +20611,25 @@ applyPlugin(jsPDF);
20612
20611
  class JsPdf extends jsPDF {
20613
20612
  }
20614
20613
 
20614
+ /**
20615
+ * Settings for generated PDF file from DOM elements
20616
+ */
20615
20617
  const FILE_SETTINGS$1 = {
20616
20618
  margin: 10,
20617
20619
  filename: 'export.pdf',
20618
- image: { type: 'jpeg', quality: 0.95 },
20620
+ image: { type: 'jpeg', quality: 0.8 },
20619
20621
  html2canvas: {
20620
- windowWidth: 1200,
20621
- windowHeight: 900,
20622
- scale: 1.25,
20622
+ scale: 2,
20623
+ windowWidth: 1000,
20624
+ windowHeight: 800,
20623
20625
  foreignObjectRendering: false,
20624
20626
  letterRendering: false,
20625
20627
  useCORS: true,
20626
- backgroundColor: '#fff',
20627
- logging: true
20628
+ logging: true,
20629
+ },
20630
+ pagebreak: {
20631
+ mode: ''
20628
20632
  },
20629
- pagebreak: { mode: 'avoid-all' },
20630
20633
  jsPDF: {
20631
20634
  unit: 'mm',
20632
20635
  format: 'a3',
@@ -20644,44 +20647,31 @@ const FILE_SETTINGS$1 = {
20644
20647
  */
20645
20648
  class PdfFromDomElementService {
20646
20649
  init(elements, fileSettings) {
20647
- const options = FILE_SETTINGS$1;
20650
+ const options = { ...FILE_SETTINGS$1 };
20648
20651
  if (fileSettings) {
20649
20652
  merge(options, fileSettings);
20650
20653
  }
20651
20654
  // HTML container in which the exported DOM elements will be placed
20652
- const htmlWrapper = document.createElement('div');
20653
- this.injectExportStyles(htmlWrapper);
20655
+ // const htmlWrapper: HTMLElement = document.createElement('div');
20656
+ const iframe = document.getElementById('iframe-pdf-export');
20657
+ const idoc = iframe.contentDocument;
20658
+ const htmlWrapper = idoc.getElementById('pdf-export');
20659
+ htmlWrapper.innerHTML = '';
20654
20660
  elements.forEach((element) => {
20655
20661
  htmlWrapper.append(element.cloneNode(true));
20656
20662
  });
20663
+ idoc.body.offsetHeight;
20657
20664
  // Set PDF options, save file and return result as Observable
20658
- return html2pdf().from(htmlWrapper).set(options);
20665
+ return iframe.contentWindow.html2pdf().from(htmlWrapper).set(options);
20659
20666
  }
20660
20667
  download(elements, fileSettings) {
20661
- return from(this.init(elements, fileSettings)
20662
- .save());
20668
+ return from(this.init(elements, fileSettings).save());
20663
20669
  }
20664
20670
  export(elements, filename = FILE_SETTINGS$1.filename) {
20665
20671
  return from(this.init(elements)
20666
20672
  .outputPdf('blob')
20667
20673
  .then((blob) => new File([blob], filename, { type: 'application/pdf' })));
20668
20674
  }
20669
- // fix html2canvas-pro problem with vertical alignment: https://github.com/yorickshan/html2canvas-pro/issues/92
20670
- injectExportStyles(element) {
20671
- element.classList.add('pdf-export');
20672
- if (!document.getElementById('pdf-export-style')) {
20673
- const style = document.createElement('style');
20674
- style.id = 'pdf-export-style';
20675
- style.textContent = `
20676
- .pdf-export input.mat-mdc-input-element {
20677
- height: 30px !important;
20678
- margin-top: 20px;
20679
- padding: 0 15px !important;
20680
- }
20681
- `;
20682
- document.head.appendChild(style);
20683
- }
20684
- }
20685
20675
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: PdfFromDomElementService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
20686
20676
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: PdfFromDomElementService, providedIn: 'root' }); }
20687
20677
  }