[cl-pdf-devel] Representation of basic PDF objects

Arthur Lemmens alemmens at xs4all.nl
Mon Apr 26 18:23:32 UTC 2004


Marc Battyani wrote:

> "Arthur Lemmens" <alemmens at xs4all.nl> wrote:
>
>> I've started work on the PDF parser.
>
> Good.

The grammar is simple enough that I've decided to skip Lispworks'
parser generator and just write some extra parse functions 'by hand'.
So the result should be portable.

>> Mapping names to symbols, dictionaries to property lists
>> and null to nil would make for a more elegant mapping than
>> what CL-PDF seems to be using now, I think. CL-PDF seems to
>> use Lisp strings for names, and :null for NIL.
>
> Hum... I prefer the current mapping.
> Names are case sensitive so symbols are not a good representation

Well, symbols are case sensitive too. But it is a good point that
I hadn't thought of yet.

> Also you have to generate names for fonts and other temporary pdf objects.
> You would end up with lots of symbols! (and symbols are heavy weight objects
> compared to string)
> Alists are as nice as property lists IMO but they work with strings.
> The true/false is not a real problem, IIRC there is only one place where a
> true is used and none with false.

You look at this from the point of view of generating PDF, but at the
moment I'm looking at it with the idea of parsing and editing existing
PDF documents. That gives a slightly different perspective on stuff
like this. As a matter of fact, at the moment I'm even considering the
idea of (semi-automatically) defining a CLOS class for each kind of PDF
object with separate slots for corresponding to each dictionary key.
That way, you could edit any element of the document by using the right
(setf slot-value). But this may be overkill, and it may take more time
than I can spend right now.

>> Using :null instead of NIL means that you would have to
>> insert some special checks when reading/changing dictionary
>> values. (Because a :null value in a dictionary should be
>> equivalent to having to omitting the key from the dictionary.
>> This is exactly equivalent to having a NIL value in a Lisp
>> property list.) These checks seem to be missing from CL-PDF
>> at the moment.
>
> It has probably never be needed so far. (There is no "null" in the
> cl-pdf sources.)

No, but there may be in existing documents ;-)

> No! (I mean I don't agree ;-)

OK, I get the message ;-)
Thanks for your feedback.

Regards,

Arthur





More information about the cl-pdf-devel mailing list