How to use the pdfmake/build/pdfmake.createPdf function in pdfmake

To help you get started, we’ve selected a few pdfmake examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cboard-org / cboard / src / components / Settings / Export / Export.helpers.js View on Github external
export async function pdfExportAdapter(boards = [], intl) {
  const docDefinition = {
    pageSize: 'A4',
    pageOrientation: 'landscape',
    content: []
  };
  const lastBoardIndex = boards.length - 1;
  const content = await boards.reduce(async (prev, board, i) => {
    const prevContent = await prev;
    const breakPage = i !== lastBoardIndex;
    const boardPDFData = await generatePDFBoard(board, intl, breakPage);
    return prevContent.concat(boardPDFData);
  }, Promise.resolve([]));

  docDefinition.content = content;
  const pdfObj = pdfMake.createPdf(docDefinition);

  if (pdfObj) {
    if (isCordova()) {
      requestCvaWritePermissions();
      pdfObj.getBuffer(buffer => {
        var blob = new Blob([buffer], { type: 'application/pdf' });
        const name = 'Download/board.pdf';
        writeCvaFile(name, blob);
      });
    } else {
      // On a browser simply use download!
      pdfObj.download(EXPORT_CONFIG_BY_TYPE.pdf.filename);
    }
  }
}
github DefinitelyTyped / DefinitelyTyped / types / pdfmake / pdfmake-tests.ts View on Github external
const createPdf = () => {
  const pdf = pdfMake;
  pdf.vfs = pdfFonts.pdfMake.vfs;
  pdfMake.createPdf(docDefinition).download();
};
github egovernments / egov-services / web / react-pgr-web-v2 / src / components / non-framework / wc / connection-workflow.js View on Github external
fontSize: 12,
        lineHeight: 1.1
      },
      subTitle2: {
        fontSize: 12
      },
      contentTitle:{
        fontSize: 12
      }
    },
    defaultStyle: {
      fontSize: 11
    }
  }

  const pdfDocGenerator = pdfMake.createPdf(docDefinition);

  pdfDocGenerator.getDataUrl((dataUrl) => {
    this.setState({
      pdfData: dataUrl
    });

    let formData = new FormData();
    var blob = dataURItoBlob(dataUrl);
    formData.append("file", blob, `WC_${Connection[0].acknowledgementNumber || '0'} + .pdf`);
    formData.append("tenantId", localStorage.getItem('tenantId'));
		formData.append("module", "wc");

    let {
      setLoadingStatus
    } = this.props;
github adamburmister / gitprint.com / src / components / PDFDocument.js View on Github external
renderPdf = (md) => {
    const pdf = pdfMake.createPdf(new DocDefinition(md));
    
    pdf.getDataUrl((dataUrl) => {
      this.setState({ pdfContent: dataUrl });
    });
    
    this.props.onRendered(pdf);
  }
github egovernments / egov-services / web / react-pgr-web / src / components / non-framework / wc / connection-workflow.js View on Github external
fontSize: 12,
        lineHeight: 1.1
      },
      subTitle2: {
        fontSize: 12
      },
      contentTitle:{
        fontSize: 12
      }
    },
    defaultStyle: {
      fontSize: 11
    }
  }

  const pdfDocGenerator = pdfMake.createPdf(docDefinition);

  pdfDocGenerator.getDataUrl((dataUrl) => {
    this.setState({
      pdfData: dataUrl
    });

    let formData = new FormData();
    var blob = dataURItoBlob(dataUrl);
    formData.append("file", blob, `WC_${Connection[0].acknowledgementNumber || '0'} + .pdf`);
    formData.append("tenantId", localStorage.getItem('tenantId'));

    let {
      setLoadingStatus
    } = this.props;

    var errorFunction = function(err) {
github egovernments / egov-services / web / react-pgr-web / src / components / non-framework / tl / transaction / PrintCertificate.js View on Github external
fontSize: 12,
        lineHeight: 1.1
      },
      subTitle2: {
        fontSize: 12
      },
      contentTitle:{
        fontSize: 12
      }
    },
    defaultStyle: {
      fontSize: 11
    }
  }

  const pdfDocGenerator = pdfMake.createPdf(docDefinition);

  pdfDocGenerator.getDataUrl((dataUrl) => {
    this.setState({
      pdfData: dataUrl
    });

    let formData = new FormData();
    var blob = dataURItoBlob(dataUrl);
    formData.append("file", blob, `TL_${license.licenseNumber || '0'} + .pdf`);
    formData.append("tenantId", localStorage.getItem('tenantId'));
    formData.append("module", constants.TRADE_LICENSE_FILE_TAG);

    let {
      setLoadingStatus
    } = this.props;
github egovernments / egov-services / web / react-pgr-web / src / components / contents / pgr / notice / ClosureNote.js View on Github external
},
        subTitle: {
          fontSize: 13
        },
        contentTitle:{
          fontSize: 12
        }
      },
      defaultStyle: {
        fontSize: 11
      }
    };

    let {setLoadingStatus} = this.props;

    const pdfDocGenerator = pdfMake.createPdf(docDefinition);

    pdfDocGenerator.getDataUrl((dataUrl) => {
      this.setState({
        pdfData: dataUrl
      });
      setLoadingStatus('hide');
    });

  }
github egovernments / egov-services / web / ui-web-app / src / development / legal / lib / specifications / templates / VakalatnamaTemplate.js View on Github external
]
        }
      ],
      styles: {
        title: {
          fontSize: 15,
          bold:true,
          lineHeight:1.1
        }
      },
      defaultStyle: {
        fontSize: 11
      }
    }

    const pdfDocGenerator = pdfMake.createPdf(docDefinition);

    pdfDocGenerator.getDataUrl((dataUrl) => {
      this.setState({
        pdfData: dataUrl
      });

      let formData = new FormData();
      var blob = dataURItoBlob(dataUrl);
      formData.append("file", blob, `LEGAL_${data.code}+_VAKALATNAMA.pdf`);
      formData.append("tenantId", localStorage.getItem('tenantId'));
      formData.append("module", "LEGAL");

      Api.commonApiPost("/filestore/v1/files",{},formData).then(function(response)
      {
        var noticeObj = {};
        noticeObj['caseNo'] = data.summon.caseNo;
github egovernments / egov-services / web / react-pgr-web-v2 / src / components / non-framework / tl / transaction / RejectionLetter.js View on Github external
bold:true,
          lineHeight: 1.2
        },
        subTitle: {
          fontSize: 13
        },
        contentTitle:{
          fontSize: 12
        }
      },
      defaultStyle: {
        fontSize: 11
      }
    };

    const pdfDocGenerator = pdfMake.createPdf(docDefinition);

    let {setLoadingStatus} = this.props;

    var errorFunction = function(err) {
      _this.props.errorCallback(err.message);
    };

    pdfDocGenerator.getDataUrl((dataUrl) => {
        this.setState({
          pdfData: dataUrl
        });

        let formData = new FormData();
        var blob = dataURItoBlob(dataUrl);
        formData.append("file", blob, `${license.applicationNumber || 0}_Rejection_Letter.pdf`);
        formData.append("tenantId", _this.getTenantId());
github researchstudio-sat / webofneeds / webofneeds / won-owner-webapp / src / main / webapp / app / components / atom-context-dropdown.jsx View on Github external
exportPdf() {
    if (!this.props.atom) return;
    const docDefinition = wonUtils.createDocumentDefinitionFromPost(
      this.props.atom
    );

    if (docDefinition) {
      pdfMake.vfs = pdfFonts.pdfMake.vfs;
      pdfMake.createPdf(docDefinition).download();
    }
  }