[cl-typesetting-devel] indirect-object with null content, e.g. outline

Dmitri Ivanov divanov at aha.ru
Mon Jun 14 09:13:27 UTC 2004


Hello,

Consider generating PDF without an outline. It seems that we cannot avoid
creating the corresponding top-level indirect object, numbering it, and
pushing into the cross-reference section. Because its content slot is null,
we've got the following printout:

4 0 obj
NILendobj

I suggest the following amendment to the method on write-object (see
pdf.lisp):

(defmethod write-object ((obj indirect-object) &optional root-level)
  (if root-level
    (progn
      (vector-push-extend (format nil "~10,'0d ~5,'0d n "
      (file-position *pdf-stream*)(gen-number obj))
     *xrefs*)
      (format *pdf-stream* "~d ~d obj~%" (obj-number obj)(gen-number obj))
      (when (content obj) (write-object (content obj))) ; skip null content
      (write-string "endobj" *pdf-stream*)
      (write-char #\Newline *pdf-stream*))
    (format *pdf-stream* "~d ~d R" (obj-number obj)(gen-number obj))))

Another solution could be providing an additional method for nulls, which
does nothing:

(defmethod write-object ((obj null) &optional root-level)
  (declare (ignorable obj root-level)))

but it would be better reserved for something like printing the PDF "null"
object.
--
Sincerely,
Dmitri Ivanov
lisp.ystok.ru





More information about the cl-typesetting-devel mailing list