Definitelytyped: @types/pdfmake's getBase64 and getBuffer are not definition

Created on 3 Dec 2018  路  3Comments  路  Source: DefinitelyTyped/DefinitelyTyped

If you know how to fix the issue, make a pull request instead.

    type GetBase64Function = (
        cb?: string,
        options?: string
    ) => void;

    type GetBase64Params = (
        options?: GetBase64Function
    ) => void;

    interface TCreatedPdf {
        download: CreatedPdfParams;
        open: CreatedPdfParams;
        print: CreatedPdfParams;
        getBase64: GetBase64Params;
        getBuffer: GetBase64Params;
    }

I think it can resolve but I have no confidence..

  • [o ] I tried using the @types/pdfmake package and had problems.
  • [ o] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [ x] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [o ] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @bpampuch (original branch) @evolkmann (types author)

If you do not mention the authors the issue will be ignored.

Most helpful comment

@shinriyo Thank you. I was wondering why pdfMake.PageSize.A4 threw error when adding pdf functionality to angular project.

All 3 comments

PageSize is undefined.

import * as pdfMake from 'pdfmake/build/pdfmake';
pdfMake.PageSize

is undefined

so. pdfMake.PageSize.A4 is error.

@shinriyo Thank you. I was wondering why pdfMake.PageSize.A4 threw error when adding pdf functionality to angular project.

This should be fixed after my pull request #42787 is merged. pdfmake.PageSize and pdfmake.PageOrientation were declared as enums, which is not accurate to the source library. Declaring an enum in TypeScript creates an actual runtime object, but this can't happen if the enum is declared in a type definition. pdfMake does not provide any PageSize object of any kind.

Was this page helpful?
0 / 5 - 0 ratings