There are a variety of ways to solve your problem!
Ideas that come to mind:
> Move Hosts: In most cases you'll have to upgrade over shared hosting to a VPS or dedicated box.
---Shared hosting, as the name implies, uses one machine to service hundreds or thousands of websites. But because it's 1 OS under there they can't allow you to do things like change packages. VPS hosting assigns you some fractional portion of a machine. Inside your fractional portion you can do whatever you want except change the OS (and if you destroy it they'll usually wipe it to factory state for you.) VPS is wildly popular and you can find cheap ones for a few dollars more than a shared host. It's highly recommended, obviously, but you'll need to keep execution times and processor usage down because your sliver of computer is usually about as fast as a cell phone (though VPS machines can be provisioned up to some of the fastest machines on the net for hundreds of dollars per month.)
I have a personal VPS with Hostgator. I'd rate them 7/10, they're reliable but skimp on processor to give you more storage. Based on CentOS installing or upgrading IM is fairly easy. Their default packages are here https://support.hostgator.com/articles/ ... ator-offer
At work we have a handful of MediaTemple "DV" VPS machines for some of our higher-use websites. They are generous on processor and RAM, but skimp heavily on storage. I would rate them 9/10; an excellent VPS service with fantastic support. However customizing your machine is your problem and their costs are high -- they also don't come preloaded with IM. But it's again CentOS and yum will knock that out with the quickness. https://kb.mediatemple.net/questions/23 ... dv_managed
We also have a GoDaddy VPS because their storage is by far the cheapest, but they skimp on everything else. It's used for nothing but file storage for our MediaTemple boxes who charge crazy amounts for storage. It's somewhat unreliable (we were down for about an hour yesterday.) My honest opinion: it sucks, they suck, anything running on it is going to suck. Jump ship now. Our VPS is currently stuck on Fedora Core 7... the current release is core 20 and they refuse to upgrade us. They say we can move to a new box, but they can't migrate it -- we'd have to do it ourselves. Ain't nobody got time for that. If we're migrating it will be to AWS.
And for high use stuff we use Amazon Web Services. This is a 9.8/10 service whose power is surpassed only by it's complexity. It will light your credit card on fire if you're not careful, but is practically unlimited speed in the sky. Not only can you run these at 100% utilization 24/7 they offer machines that can only be described as *insanely* fast. My home develop machine is a i7-3770 with a solid state drive and 24GB of RAM; their top-end machines are approximately 30X faster running the exact same code. They're also about $2.50 PER HOUR.
> Rewrite your code
--- Perhaps the more interesting option, but it can't be solved with a credit card swipe either. I use IM to build PDF's and I've never heard of this inter-line spacing. My general process is to build all the pieces I need individually to temp files, then assemble them onto the output one by one (I do this in perlmagick -- since it's all in memory it can be lossless until output.) In my use-case I'd build each bullet point, grab the height of the bullet point, grab the height of the output area, then do some spacing math and composite. It's not as nice, but it definitely gets the job done.
--- Be careful about execution times. Lots of VPS's will limit your execution time on processes to 15-60 seconds. While that seems like a lot, your VPS is most likely significantly slower than your desktop machine. Large files take lots of time, processor and memory to churn out. Recompiling to Q8 is a recommended speed up, but it's a pain.
> Execute elsewhere
--- Last I leave you with the crazy mans option. Write your code into a service and run the service on a faster box somewhere else (even in your living room if your internet is fast enough.) Call the process with AJAX and report progress back with JSON. It's dirty and complex, but it allows you the ultimate in expand-ability and flexibility. Writing the service to an Elastic Bean Stalk in AWS will turn machines on and off for you and load balance requests across them. It can do amazing things, including melting your credit card. Just wanted that warning in there again; they don't play.