On 4/22/10 7:20 AM, Tonypm wrote:
> Generally, the kinds of docs I am creating are business docs such as
> invoices, receipts, reports etc. so important functionality is:
IMO, custom reports go beyond the scope of Prawn. Really, we should be
leaning on Andrew France to integrate Prawn into Ruport for these sorts
of needs.
> 1. Easy header/footer with page numbering (not currently in your
> proposal, but something I think would be really useful in prawn
> layout, and I see this has already been mention in other responses)
Repeaters give you this. See the examples, it's now trivial to add
page numbers. We also have number_pages but that might go away.
IMO since repeaters provide everything you need, and header / footer
support seems amorphous, higher level support should be implemented by
extensions. That is, unless we can all agree on what this should look like.
> 2. Good consistent flow of information across pages, with control
> over where the next page picks up. ie sometimes I will start
> something somewhere part way down the page and want it to continue at
> the top of the page and sometimes it might need to be constrained to a
> sub area of the page.
You already have this support, exactly as you worded it. For the
former, use span(), for the latter, use bounding_box(). However, be
aware that both of these methods will disappear, and something much more
unified will replace it. Still in my head though.
Keep an eye out for an announcement about a new positioning system, and
please participate in testing. If you have complex needs, it'd be good
to have some extra eyes on what I build here.
> 3. Some format flexibility inside table cells. Not going overboard
> on this one, but as a minimum being able to put bold/italic/underline
> into some cells is vital. For example if I want to show totals at the
> end of a list of data, I might want a few rows with bold titles
> running down one of the columns. I note the intention of having span,
> which is great.
Yes, I think you're right, and while Brad has the final say here, I
think inline styling within table cells is a high-priority feature
(maybe even a blocker)
> 4. Having some variable control over the presence or absence of lines
> and line style in tables. ie. it is sometimes very helpful to have
> no lines around some cells in a table.
> A possible way of implementing this might be to allow a very limited
> use of a table within a table cell
I am pretty sure that you already can control the borders on every cell
(at least in 0.9, but probably in 0.8, too). Have a look at the
examples and source.
> 4. Pdf writer had the ability to position tables, and that did not
> seem to make it into prawn, eg align a table to the right margin, or
> center it etc. To implement this in prawn I put the table in a
> bounding box, which then has implications for page flow.
I think you just missed the API documentation here for table() in any
Prawn version <= 0.8, at least:
:position:
One of :left, :center or n, where n is an x-offset from the left edge
of the current bounding box.
It's true that we don't have right align here, perhaps we should add it.
I am not sure what the 0.9 API allows for here, much of it is still a
work in progress.
> I like your plan to define an extension API since this should
> hopefully make it possible for users to implement features that are
> not met by the standard prawn feature set. Are you planning to
> publish a draft for the API?
> Also, I wonder if some way for users to share new features might be
> possibly incorporated into the project.
We'll develop it organically by working with those who are building
extensions, and perhaps building some extensions ourselves. It will be
discussed on list, so feel free to throw in suggestions and questions as
needed.
> I have been using Prawn for a while, and the thing I have perhaps
> found difficult is the appearance and removal of features between
> releases. This is an observation not a criticism (and yes I do
> appreciate this is early development), but to be able to use a library
> like prawn relies on a degree of stability and backward compatibility,
> with some advance notice of significant changes.
This was mentioned in the draft spec, but I will summarize here for the
benefit of the group
• Extension API backwards compatible across the 1.x family
• User API can change, but deprecation warnings will be given for a full
point release [eg: 1.x -> 1.(x+1)] before a change or removal is made.
• Major point releases will be done monthly, as we have in the past.
• We will support the latest point release and the one preceeding it,
giving users a little bit more time to migrate than we have afforded in
the past.
So basically, you'll have a line of support for one major version less
than the current one, and deprecation warnings on everything that will
change for one full release cycle. Extensions should never break unless
we find a critical flaw in the Extension API.
Does this sound conservative enough for you? We really can't push much
farther than this without stagnation.
> Thanks for everyone's efforts to date, I really value having a pdf
> generating library like prawn - I just wish I was clever enough to
> help out with the development!
I am sure you are. While we have had complaints in the past of being a
bit gruff to our users (that is hopefully changing for the better), we
also have the reputation of being extremely supportive of our
contributors, even if they're new to PDF or to hacking on open source.
Prawn is really not that hard to work on, because it has lots and lots
of tests, decent code in most places, and lots of examples. You may
need to ask some questions to find your way around, but if you have an
itch, please try to scratch it. We'll be happy to help point you in the
right direction.
-greg