https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
i

iamsteveholmes

01/28/2023, 6:12 PM
Is anyone working on a multiplatform library for generating pdfs?
👀 3
j

Johann Pardanaud

01/29/2023, 9:53 AM
Do you have any use cases to share? To measure the complexity of the task
i

iamsteveholmes

01/29/2023, 10:47 PM
Oh gosh…well I am actually working on a character creator for Pathfinder (D&D like game). The end result will be to generate a PDF of the completed character. This will be many pages of static content generated from values captured and computed by my app. The best way to handle that might be to use one of the libraries that converts HTML to PDF. At least that would allow me to create a decent looking and very complex set of sheets. At a minimum it needs to support IOS and Android and eventually desktop and/or web. At the moment I’m planning to create a service on AWS that will generate and cache the PDF returning a link where the user will be able to download it. Long term this might be the best bet anyway.
b

Big Chungus

01/29/2023, 10:55 PM
Not ideal, but you can always expect/actual: • on jvm/android - https://pdfbox.apache.org/ • ios - https://github.com/vsouza/awesome-ios#pdf • web - https://github.com/foliojs/pdfkit
As for your original question, I strongly doubt anyone is working on such lib at the moment. Especially with your target set.
i

iamsteveholmes

01/29/2023, 10:58 PM
@Big Chungus Thank you for the response! I had considered doing something like this but the design of the sheets won’t be trivial and I suspect I won’t be able to use the same HTML -> PDF conversion with three+ different libraries.
b

Big Chungus

01/29/2023, 10:59 PM
Well they all take a static html string and spit out some sort of pdf. I'd imagine html has the most influence to the output so should not be that hard to wrap a tailor-made expect-actuals bridge that solves ONLY your case.
i

iamsteveholmes

01/29/2023, 10:59 PM
@Big Chungus I think you’re right but it was worth the ask. I’m finding most of the libraries are quite old but as far as I know there really isn’t an alternative to PDF that would work for the Use case (also needs to print on any old personal printer).
b

Big Chungus

01/29/2023, 10:59 PM
Making it generally useful is the main challenge when building such libs
i

iamsteveholmes

01/29/2023, 11:01 PM
@Big Chungus I agree. I think most folks avoid needing to generate PDFs from mobile.
7 Views