Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dragospeta opened this issue Jul 28, 2023 · 4 comments
Open

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

dragospeta opened this issue Jul 28, 2023 · 4 comments

Comments

@dragospeta
Copy link

dragospeta commented Jul 28, 2023

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
Copy link

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
Copy link

SudheeM commented Oct 20, 2023

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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants