taxtank-core 2.0.58 → 2.0.60

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.
@@ -20623,7 +20623,7 @@ const FILE_SETTINGS$1 = {
20623
20623
  scale: 1,
20624
20624
  windowWidth: 1200,
20625
20625
  windowHeight: 900,
20626
- foreignObjectRendering: false,
20626
+ foreignObjectRendering: true,
20627
20627
  letterRendering: false,
20628
20628
  useCORS: true,
20629
20629
  logging: true,
@@ -20647,44 +20647,6 @@ const FILE_SETTINGS$1 = {
20647
20647
  * in which all the styles that the user sees on the page will be saved
20648
20648
  */
20649
20649
  class PdfFromDomElementService {
20650
- createIsolatedDocument(elements) {
20651
- // Создаём скрытый iframe, чтобы клонер html2canvas не копировал всю SPA
20652
- const iframe = document.createElement('iframe');
20653
- Object.assign(iframe.style, {
20654
- position: 'fixed',
20655
- left: '-99999px',
20656
- top: '0',
20657
- width: '1200px',
20658
- height: '900px',
20659
- visibility: 'hidden'
20660
- });
20661
- document.body.appendChild(iframe);
20662
- const idoc = iframe.contentDocument;
20663
- idoc.open();
20664
- idoc.write(`
20665
- <!doctype html>
20666
- <html>
20667
- <head>
20668
- <meta charset="utf-8"/>
20669
- <style>
20670
- body{margin:0;background:#fff;font-family:Arial,Helvetica,sans-serif;}
20671
- .pdf-export input.mat-mdc-input-element{
20672
- height:30px;margin-top:20px;padding:0 15px;
20673
- }
20674
- </style>
20675
- </head>
20676
- <body><div id="pdf-root"></div></body>
20677
- </html>
20678
- `);
20679
- idoc.close();
20680
- const pdfRoot = idoc.getElementById('pdf-root');
20681
- elements.forEach((el) => pdfRoot.append(el.cloneNode(true)));
20682
- // await (idoc as any).fonts?.ready?.catch(() => {});
20683
- // await Promise.all(
20684
- // Array.from(pdfRoot.querySelectorAll('img')).map(img => img.decode?.().catch(() => {}))
20685
- // );
20686
- return pdfRoot;
20687
- }
20688
20650
  init(elements, fileSettings) {
20689
20651
  const options = FILE_SETTINGS$1;
20690
20652
  if (fileSettings) {
@@ -20696,26 +20658,17 @@ class PdfFromDomElementService {
20696
20658
  elements.forEach((element) => {
20697
20659
  htmlWrapper.append(element.cloneNode(true));
20698
20660
  });
20699
- const pdfRoot = this.createIsolatedDocument(elements);
20700
20661
  // Set PDF options, save file and return result as Observable
20701
- return html2pdf().from(pdfRoot).set(options);
20662
+ return html2pdf().from(htmlWrapper).set(options);
20702
20663
  }
20703
20664
  download(elements, fileSettings) {
20704
- const start = new Date();
20705
20665
  return from(this.init(elements, fileSettings)
20706
- .save()
20707
- .then(() => {
20708
- console.log((new Date().getTime() - start.getTime()) / 1000);
20709
- }));
20666
+ .save());
20710
20667
  }
20711
20668
  export(elements, filename = FILE_SETTINGS$1.filename) {
20712
- const start = new Date();
20713
20669
  return from(this.init(elements)
20714
20670
  .outputPdf('blob')
20715
- .then((blob) => {
20716
- console.log((new Date().getTime() - start.getTime()) / 1000);
20717
- return new File([blob], filename, { type: 'application/pdf' });
20718
- }));
20671
+ .then((blob) => new File([blob], filename, { type: 'application/pdf' })));
20719
20672
  }
20720
20673
  // fix html2canvas-pro problem with vertical alignment: https://github.com/yorickshan/html2canvas-pro/issues/92
20721
20674
  injectExportStyles(element) {