Generating a large pdf with expo print

  1. SDK Version: 43
  2. Platforms(Android/iOS/web/all): android ios

I am building an application that, as a central feature, generates a large (100+ page pdf), with around 100 images. At first glance I was thinking that the print module would suffice however I see that in order to include images they have to be encoded into binary. I am concerned this may not be successful for such a large document with so many images. Does anyone have relevant experience? I’ll update this post as I move forward implementing the pdf generation.

One thing I dont quite have my head around with regards to expo is creating backend code. Maybe I am not searching the right terms, but I cant tell if its possible to have local backend code bundled into the app. If so, I could use rust or other to build a binary just for the pdf generation, which could likely handle the large number of images and then call the pdf generation from the expo application. Is some form of this possible?

(this application is entirely local, without any remote server.)

Hi @lastof

I’d first see if I could find an existing React Native module that does what you need and then use EAS Build to build your app.

If you don’t find an existing project that does what you need, you can indeed write some native code and access it from JavaScript.

I’ve never tried this myself, and I believe there are some changes in the works related to this. Here are the React Native docs for this:

You’ll either need to eject or write a Config Plugin to integrate it into a managed Expo app.

The “changes” I mentioned above are a more efficient way for JavaScript code to talk to native code in a React Native app. This is called “JSI”. Not sure where the docs for that are.

I think “Expo modules” might also be relevant to this, but I’m not quite sure what those are about.

1 Like

I’ve just found this too, which might help:

1 Like

Thanks Woden, you’re always helpful :grin:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.