https://kotlinlang.org logo
#announcements
Title
# announcements
m

Mani

10/15/2019, 8:20 PM
Folks, I have a few queries on how to do this in Kotlin. 1. I have a bunch of urls as input. Need to iterate over them and download PDF's 2. Merge all these PDF's into one single PDF what are the relevant libraries for both downloading and merging? and is it advisable to do the merge on server? Worst case there can be 300, 400 urls at once. Also, since it is IO bound to download, will coroutines help in performance?
stackoverflow 2
m

marstran

10/15/2019, 8:26 PM
To the guys hinting to StackOverflow: This question would be closed there, because questions asking for recommendations for some resource or library are off topic.
m

Mani

10/15/2019, 8:29 PM
Thank you 🙂 You understood my pain!
m

Mani

10/15/2019, 8:38 PM
Thanks for the merge related libs. I've looked at it. Could you please advise me if its the right way to do this. I need to download all these files as well.
m

Matteo Mirk

10/16/2019, 8:18 AM
In short, you could use any HTTP client lib you like (here’s a few https://kotlin.libhunt.com/categories/5616-http-clients) to download the file and yes, using coroutines to make parallel requests will speed up the execution.
s

Stephan Schroeder

10/16/2019, 8:46 AM
or you fall back on std-java-lib
Copy code
val pdfInputStream = URL(pdfUrl).openConnection().inputStream
m

Mani

10/16/2019, 6:51 PM
Thank you both. This should help 🙂
3 Views