[cl-typesetting-devel] Need help with layout

Marc Battyani marc.battyani at fractalconcept.com
Sat Jan 21 02:54:24 UTC 2012


On 1/18/2012 3:32 PM, jcm at SDF.ORG wrote:
>> What you want to do exactly is not clear. Why don't you draw those
>> labels in the drawing function of your user-drown-box?
>> The best way for you to get real practical help would be to post a small
>> simple and self contained example showing your problem.
> I found the best solution here is a table, and that is working very well.
>
> But now I trying to get footers to appear on a landscape style document.
>
> Here's a trimmed down but functional snippet:

Having a real example makes it much easier to fix so here is the
corrected version. 

(with-document ()
  (let* ((header
          (lambda (pdf:*page*)
            (pdf:with-saved-state  ;<= *** you need to save the graphic
state if you use direct pdf functions
              (pdf:translate 0 580)

              (pdf:set-rgb-fill 0.55 0.17 0.08)
              (pdf:set-rgb-stroke 0.55 0.17 0.08)
              (pdf:basic-rect 0 0 841 15)
              (pdf:fill-and-stroke)

              (pdf:set-rgb-fill 0.70 0.22 0.11)
              (pdf:set-rgb-stroke 0.70 0.22 0.11)
              (pdf:basic-rect 0 3 841 9)
              (pdf:fill-and-stroke)

              (pdf:set-rgb-fill 0.78 0.24 0.12)
              (pdf:set-rgb-stroke 0.78 0.24 0.12)
              (pdf:basic-rect 0 6 841 3)
              (pdf:fill-and-stroke)
              (compile-text ())
              )))
         (footer
          (lambda (pdf:*page*)
            (compile-text (:font *font* :font-size 10)
              (paragraph (:h-align :left :color '(1 0 0))
                "Company name")
              (paragraph (:h-align :center :color '(0 0 0))
                (verbatim (format nil "~D" pdf:*page-number*))))))
         (content
          (compile-text (:top-margin 20 :font *font* :font-size
                                     *font-size*)
            (paragraph
                (:h-align :left :font "Times-Roman" :font-size 36
                          :color '(0.8 0.25 0.12))
              "Report"))))
    (draw-pages content
                :orientation :landscape
                :margins '(72 36 72 36)
                :header header
                :footer footer
                :header-top 6   ; <= *** with a margin of 36 and a
default space of 30 above/below the header/footer this leaves only 6 for
them which is way too small
                :footer-bottom 6
                :break :always)
    (pdf:write-document "c:/tmp/clpdf.pdf")))

Marc

>
> (with-document ()
>     (let* ((header
>              (lambda (pdf:*page*)
>                (pdf:translate 0 580)
>
>                (pdf:set-rgb-fill 0.55 0.17 0.08)
>                (pdf:set-rgb-stroke 0.55 0.17 0.08)
>                (pdf:basic-rect 0 0 841 15)
>                (pdf:fill-and-stroke)
>
>                (pdf:set-rgb-fill 0.70 0.22 0.11)
>                (pdf:set-rgb-stroke 0.70 0.22 0.11)
>                (pdf:basic-rect 0 3 841 9)
>                (pdf:fill-and-stroke)
>
>                (pdf:set-rgb-fill 0.78 0.24 0.12)
>                (pdf:set-rgb-stroke 0.78 0.24 0.12)
>                (pdf:basic-rect 0 6 841 3)
>                (pdf:fill-and-stroke)
>
>                (compile-text ())))
>            (footer
>              (lambda (pdf:*page*)
>                (compile-text (:font *font* :font-size 10)
>                  (paragraph (:h-align :left :color '(1 0 0))
>                    "Company name")
>                  (paragraph (:h-align :center :color '(0 0 0))
>                    (verbatim (format nil "~D" pdf:*page-number*))))))
>            (content
>              (compile-text (:top-margin 20 :font *font* :font-size
> *font-size*)
>                (paragraph
>                    (:h-align :left :font "Times-Roman" :font-size 36
> :color '(0.8 0.25 0.12))
>                  "Report"))))
>       (draw-pages content
>                   :orientation :landscape
>                   :margins '(72 36 72 36)
>                   :header header
>                   :footer footer
>                   :break :always
>                   )
>       (pdf:write-document filename)))
>
> Thanks for your help!
>
>




More information about the cl-typesetting-devel mailing list