Revision: 3478 Author: hans URL: http://bknr.net/trac/changeset/3478
Get PDF generation with M2 icon to work.
U trunk/projects/bos/Makefile U trunk/projects/bos/m2/cert-daemon.lisp U trunk/projects/bos/m2/m2-pdf.lisp
Modified: trunk/projects/bos/Makefile =================================================================== --- trunk/projects/bos/Makefile 2008-07-17 09:02:14 UTC (rev 3477) +++ trunk/projects/bos/Makefile 2008-07-17 09:08:08 UTC (rev 3478) @@ -2,7 +2,7 @@ .PHONY: all
bos.core: build.lisp - sbcl --load build.lisp --eval '(sb-ext:save-lisp-and-die "bos.core")' + env LANG=en_US.UTF-8 sbcl --load build.lisp --eval '(sb-ext:save-lisp-and-die "bos.core")'
# various cleaning stuff .PHONY: cleancore
Modified: trunk/projects/bos/m2/cert-daemon.lisp =================================================================== --- trunk/projects/bos/m2/cert-daemon.lisp 2008-07-17 09:02:14 UTC (rev 3477) +++ trunk/projects/bos/m2/cert-daemon.lisp 2008-07-17 09:08:08 UTC (rev 3478) @@ -1,19 +1,13 @@ (in-package :bos.m2.cert-generator)
-(defun run-tool (program &optional program-args &rest args) - (let* ((process (apply #'run-program program program-args :search t :output :stream args)) - (error-message (unless (zerop (process-exit-code process)) - (with-output-to-string (*standard-output*) - (with-open-stream (output-stream (process-output process)) - (princ (read-line output-stream nil))))))) - (process-close process) - (unless (zerop (process-exit-code process)) - (error "Error executing ~A - Exit code ~D~%Error message: ~A" - (format nil ""~A~{ ~A~}"" program program-args) (process-exit-code process) error-message)))) +(defun run-tool (program &rest args) + (let ((asdf::*verbose-out* t)) + (apply #'asdf:run-shell-command "~S ~{~S ~}" program args)))
(defun fill-form (fdf-pathname pdf-pathname m2-pdf-pathname output-pathname) (handler-case - (with-temporary-file (temporary-pdf-pathname :defaults #P"/tmp/.pdf") + (with-temporary-file (temporary-pdf-pathname :defaults (make-pathname :directory '(:absolute "tmp") + :type "pdf")) (cond ((namestring pdf-pathname) (run-tool "pdftk" (list (namestring pdf-pathname) @@ -42,7 +36,7 @@ country)) template-pathname)) (m2-pdf-pathname (merge-pathnames - (make-pathname :name (format nil "~A-m2s" id)) + (make-pathname :name (format nil "~A-m2s" id) :type "pdf") fdf-pathname)) (output-pathname (merge-pathnames (make-pathname :name id :type "pdf") fdf-pathname))) (fill-form fdf-pathname
Modified: trunk/projects/bos/m2/m2-pdf.lisp =================================================================== --- trunk/projects/bos/m2/m2-pdf.lisp 2008-07-17 09:02:14 UTC (rev 3477) +++ trunk/projects/bos/m2/m2-pdf.lisp 2008-07-17 09:08:08 UTC (rev 3478) @@ -58,7 +58,10 @@ (pdf:line-to x y) (pdf:close-fill-and-stroke)))))))
- (with-open-file (f (contract-m2-pdf-pathname contract :print print) :direction :output :if-exists :supersede) + (with-open-file (f (contract-m2-pdf-pathname contract :print print) + :direction :output + :if-exists :supersede + :external-format :iso-8859-1) ;; cl-pdf does not really handle non-ascii characters in a very ;; usable manner. In order to avoid having to deal with ;; embedding fonts and encoding, just work around the issue: