# PDF::Writer memory error

**URL:** <https://rubytalk.org/t/pdf-writer-memory-error/29354>\
**Category:** ruby-talk\
**Created:** [27 July 2006 19:05 UTC](https://rubytalk.org/t/pdf-writer-memory-error/29354 "2006-07-27T19:05:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_sikorski](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@john\_sikorski](https://rubytalk.org/u/john_sikorski)\
**Post date:** [27 July 2006 19:05 UTC](https://rubytalk.org/t/pdf-writer-memory-error/29354/1 "2006-07-27T19:05:10Z")

</div>

I'm trying to use PDF::Writer to generate a PDF version of a phone list  
but I'm having out of memory problems. The document is formatted for 2  
column output. I originally added all names (about 500) to a single  
four column SimpleTable object which ran without error, albeit slow. I  
then tried creating seperate tables for each letter of the alphabet,  
resulting in an out of memory error. Google searches found a few  
others experiencing the same problem. One suggestion was to set  
split\_rows=true which did prevent the error but the pdf generated was  
poor, rows spilling over to the next page, column headings appearing  
twice, and a few other odd problems. Does anyone know how to make this  
work with PDF::Writer? Any suggestions for other Ruby PDF API's?

Thanks,

John

---

<div class="post-metadata">

**Author:** ![Austin\_Ziegler5](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/austin_ziegler5/32/1985_2.png) [@Austin\_Ziegler5](https://rubytalk.org/u/Austin_Ziegler5)\
**Post date:** [27 July 2006 22:28 UTC](https://rubytalk.org/t/pdf-writer-memory-error/29354/2 "2006-07-27T22:28:36Z")

</div>

I don't have any suggestions right now, but you may want to check the  
Rails list for a post about a version of SimpleTable that doesn't use  
Transaction::Simple. You'll need to ensure the pagination yourself,  
but I will be reviewing SimpleTable's use of Transaction::Simple in  
the future to fix this.

I'll tag this to look at it again next month when I get back to  
PDF::Writer work.

-austin

> **···**
>
> On 7/27/06, john sikorski \<john.sikorski@gmail.com\> wrote:
> 
> > I'm trying to use PDF::Writer to generate a PDF version of a phone list  
> > but I'm having out of memory problems. The document is formatted for 2  
> > column output. I originally added all names (about 500) to a single  
> > four column SimpleTable object which ran without error, albeit slow. I  
> > then tried creating seperate tables for each letter of the alphabet,  
> > resulting in an out of memory error. Google searches found a few  
> > others experiencing the same problem. One suggestion was to set  
> > split\_rows=true which did prevent the error but the pdf generated was  
> > poor, rows spilling over to the next page, column headings appearing  
> > twice, and a few other odd problems. Does anyone know how to make this  
> > work with PDF::Writer? Any suggestions for other Ruby PDF API's?
> 
> --  
> Austin Ziegler \* halostatue@gmail.com \* [http://www.halostatue.ca/](http://www.halostatue.ca/)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\* austin@halostatue.ca \* [You are in a maze of twisty little passages, all alike. // halo • statue](http://www.halostatue.ca/feed/)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\* austin@zieglers.ca

---

<div class="post-metadata">

**Author:** ![john\_sikorski](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@john\_sikorski](https://rubytalk.org/u/john_sikorski)\
**Post date:** [29 July 2006 01:05 UTC](https://rubytalk.org/t/pdf-writer-memory-error/29354/3 "2006-07-29T01:05:12Z")

</div>

In case anyone is interested, I found a work around for this problem.  
If you manually set the table width the out of memory error does not  
occur. In my case I was adding multiple tables to a page formated for  
2 column output. Setting table.width=260 worked for me.

John
