Hello :wave: me and my team want to do PDF generat...
# multiplatform
p
Hello 👋 me and my team want to do PDF generator in KMP (Android, iOS and js targets). We are creating SDK for client apps and we want to have this feature nested in SDK. On pdf template we expect complex datas like tables and charts. Do you know any possible ways of how to do it? Any advices, consternations? As I saw there is no one official and recommended solution. Options we are considering: 1. Create PDF template in compose multiplatform and export it to image, then natively into PDF to make other platforms use it. With this solution we're afraid of performance issues 2. The second option is to use an HTML template without compose multiplatform, load the HTML template in commonMain if possible, if not, then natively Thank you very much in advance for any help! 🍻
m
Honestly, I would go with the HTML to PDF option. It will give you more flexibility and you can control the design (aka theme) of the PDF from CSS
👍 1
t
I'm thinking about this functionality as well (template to PDF) my planned solution is somewhat similar to Compose to PDF but: • I already have a platform independent, extendable multiplatform UI system working (let's say an alternative to Compose, nowhere that mature though) • the JS implementation uses the exact same layout components as the mobile implementations • it is actually very easy to add a PDF adapter (I have to write a few classes such as text rendering, rectangle rendering etc.) • I have my own SVG library which is platform independent as well, could be extended with PDF canvas easily • I already can build complex, reactive UIs in Kotlin • I already have a proof-of-concept for a UI designer which will let me create no-code UI designs The main goal of my project is not PDF generation, it will be just a result of the work I've put in on other areas. I would not say that my project is useful for you as I develop it alone, therefore it probably won't meet the timelines of yours but I think on the long run a well-defined, strict rendering system would worth the effort. Some references: • https://medium.com/@tiz_26128/a-life-without-compose-5b77a9a8129fhttps://github.com/spxbhuhb/adaptive
👍 1
r
Skia has a PDF backend, and there's some movement for letting compose use it: https://github.com/JetBrains/skiko/pull/775
👍 1
p
@rnett yeah we are following this PR, but it still hasn't been merged for a long time 😕
d
i thought of the same and built a sample to experiment i hope this helps . https://github.com/Lilytreasure/MultiplatformPdfGenerator