commit 73c10b2fcdd03a36b0934422e5a099fc3faab5e1
parent 6a4016f1361c2d05040227a06d72fddfdb5f750b
Author: Tomas Hlavaty <tom@logand.com>
Date: Sat, 3 Oct 2026 21:13:55 +0200
fix pdf-stream dict /Length
Diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/emacs-pdf.el b/emacs-pdf.el
@@ -163,13 +163,15 @@ the end of the file ends the printable region."
`(pdf-dic /Size ,(1+ (length objs)) ,@(cdr x))))
(pdf-stream
(cl-destructuring-bind (a &rest b) (cdr x)
- (let ((x (with-temp-buffer
- (set-buffer-multibyte nil)
- (mapc #'rec b)
- (buffer-string))))
+ (let* ((x (with-temp-buffer
+ (set-buffer-multibyte nil)
+ (mapc #'rec b)
+ (buffer-string)))
+ (n (length x)))
(rec (if a
- `(/Length ,(length x) ,@a)
- `(pdf-dic /Length ,(length x))))
+ (cl-ecase (car a)
+ (pdf-dic `(pdf-dic /Length ,n ,@(cdr a))))
+ `(pdf-dic /Length ,n)))
(insert "\nstream")
(insert x)
(insert "\nendstream"))))