bpampuch / pdfmake

Client/server side PDF printing in pure JavaScript
http://pdfmake.org
Other
11.7k stars 2.04k forks source link

React native freeze on >=2 versions of pdfmake #2610

Open dragospeta opened 1 year ago

dragospeta commented 1 year ago

Hi. I'm developing a react native app and i wanted to generate a pdf. expo: ~49.0.5 react: 18.2.0 react-native: 0.72.3 nodejs: v18.13.0

When getBase64 method (or any other method) is called on pdfmake, the application freezes without an error. After looking on some examples from the internet i changed the package version to 0.1.72 and it works. Any idea why?

I can provide a basic code too: import pdfMake from "pdfmake/build/pdfmake"; pdfMake.fonts = { Roboto: { normal: "https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.66/fonts/Roboto/Roboto-Regular.ttf", bold: "https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.66/fonts/Roboto/Roboto-Medium.ttf", italics: "https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.66/fonts/Roboto/Roboto-Italic.ttf", bolditalics: "https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.66/fonts/Roboto/Roboto-MediumItalic.ttf", }, };

pdfMake.createPdf({any pdfmake object}).getBase64((pdfData) => { console.log(pdfData); });

berkalparslan commented 1 year ago

After react native version and node upgrade,

I got same error and crash. Anyone have solution?

change pdfMake version to 0.1.72 is working but what should be ideal solution?

SudheeM commented 1 year ago

I do have similar problem in iOS. I will check withe above version mentioned

https://stackoverflow.com/questions/77329760/unable-to-generate-pdf-in-react-native-ios-app

AbdullahAbdelghani commented 8 months ago

I do have the same problem after upgrading to expo 50 it started freezing

and changing the version of pdfMake to 0.1.72 helped fix the problem

I hope the issue could be addressed in the future versions

shessafridi commented 5 months ago

Changing version to 0.1.72 only worked in development, it still freezes in a release build