Merging pdf files

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
DerpyJish
Prole
Posts: 5
Joined: Sat Feb 27, 2016 3:34 pm

Merging pdf files

Post by DerpyJish »

I wanted to create a project that is able to take multiple .pdf files and then be able to split them up by page and merge them again. I.E Is their a way in love to combine/rearrange multiple .pdf files (I would assume with the help of 3rd party modules and things).

I realize this is a bizarre thing to try and achieve in a game engine, but I've taken to using love for all of my personal projects. Recently I've been manually combining .pdf files to create mash ups of past exam papers for my school science revision, and I thought it would be fun to try and find a way of automatically generating 'random papers'.

I hope I've been clear, If not yell at me and I'll try to elaborate for you! :nyu:
Thanks in advance! :awesome:
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Merging pdf files

Post by ivan »

Lua can do a lot of things and there any many modules.
Search on Google for "Lua PDF bindings":
http://luahpdf.colloquiki.com/

Rendering the PDFs through Love would be much harder though.
User avatar
DerpyJish
Prole
Posts: 5
Joined: Sat Feb 27, 2016 3:34 pm

Re: Merging pdf files

Post by DerpyJish »

Thanks for replying!

I've seen luahpdf in my search on google, but I couldn't figure out how to use it within love2d. Is there a way? I also remember having difficulty finding a lua binding for specifically merging and spiting pdfs, luahpdf only generates new ones, but I'll carry on looking for one.

Thanks again for your help! :nyu:

EDIT: I haven't actually been able to find any other lua libraries for PDF manipulation. I have found a C++ one that does quite a few cool things (podofo.sourceforge.net), but I'd imagine that that is even more complicated to incorporate into love! :?
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Merging pdf files

Post by ivan »

If you're trying to parse pdf files - what you could do is
use an existing "converter" to turn the files into a manageable format like RTF or TXT.
These would be trivial to handle from Lua.
User avatar
DerpyJish
Prole
Posts: 5
Joined: Sat Feb 27, 2016 3:34 pm

Re: Merging pdf files

Post by DerpyJish »

ivan wrote:If you're trying to parse pdf files - what you could do is
use an existing "converter" to turn the files into a manageable format like RTF or TXT.
These would be trivial to handle from Lua.
Great idea! I went to pdftotext.com to experiment with it, and obviously turning a pdf to txt back to pdf stripped it all of it's formatting, but I also found pdf2png.com which with love will work a charm!

Many thanks for your help! It's great to be able to get such a useful response from clever people! :ultrahappy:
To derp, or not to derp? :3
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests