Forum: Ruby on Rails Creating a PDF on the fly

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0c2c0ee1d969801f37dfc242d885756d?d=identicon&s=25 Paul Johnston (Guest)
on 2007-02-27 12:04
(Received via mailing list)
A friend and I are just in the process of trying to create PDFs on the
fly.  This isn't in itself too hard, but we have some repeating images
that are being put in over and over again.  It's increasing file size
too much unfortunately.

Does anyone know the best way to ensure file size is kept to a minimum
for this scenario? We know about linking to a URI, but the problem with
that is that if the PDF gets sent elsewhere, we have to send the linked
images with it.

Any help would be appreciated.

Thanks

Paul
--

PJ Net Solutions Ltd
0871 223 5370
http://www.pjnetsolutions.com
Registered Number  : 4131671 - Registered in England and Wales
Registered address : 35 Ballards Lane, London, N3 1XW
Office address     : 17 Mortain Drive, Berkhamsted, HP4 1JZ
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (austin)
on 2007-02-27 15:01
(Received via mailing list)
On 2/27/07, Paul Johnston <paul@pjnetsolutions.com> wrote:
> A friend and I are just in the process of trying to create PDFs on the
> fly.  This isn't in itself too hard, but we have some repeating images
> that are being put in over and over again.  It's increasing file size
> too much unfortunately.

If you're using PDF::Writer, then it's trivial to reuse images that
are repeating. You just have to do it right (and the demo
chunkbacon.rb shows how).

If you're not using PDF::Writer, then you need to be more specific
about your problem.

-austin
--
Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/
               * austin@halostatue.ca * http://www.halostatue.ca/feed/
               * austin@zieglers.ca
0c2c0ee1d969801f37dfc242d885756d?d=identicon&s=25 Paul Johnston (Guest)
on 2007-02-27 16:57
(Received via mailing list)
On Tue, 2007-02-27 at 09:00 -0500, Austin Ziegler wrote:
> On 2/27/07, Paul Johnston <paul@pjnetsolutions.com> wrote:
> > A friend and I are just in the process of trying to create PDFs on the
> > fly.  This isn't in itself too hard, but we have some repeating images
> > that are being put in over and over again.  It's increasing file size
> > too much unfortunately.
>
> If you're using PDF::Writer, then it's trivial to reuse images that
> are repeating. You just have to do it right (and the demo
> chunkbacon.rb shows how).

That's helpful thanks.  I hadn't found the "demo" section because I was
looking for "examples" :)  I have actually looked at the gem code to
figure out how to load the image only once.  Figured it out now, so
thanks.  Really helpful.

Paul
--

PJ Net Solutions Ltd
0871 223 5370
http://www.pjnetsolutions.com
Registered Number  : 4131671 - Registered in England and Wales
Registered address : 35 Ballards Lane, London, N3 1XW
Office address     : 17 Mortain Drive, Berkhamsted, HP4 1JZ
This topic is locked and can not be replied to.