Skip to content

Commit 98c481b

Browse files
authored
PDF to {NULL} only does postscript part (#2045)
* PDF to {NULL} only does postscript part * added TRUEFILENAME in NULL case
1 parent 58f8fbd commit 98c481b

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

library/PDFSTREAM

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
22

3-
(FILECREATED "25-Dec-2024 14:26:23" {WMEDLEY}<library>PDFSTREAM.;60 14292
3+
(FILECREATED "23-Feb-2025 12:18:57" {WMEDLEY}<library>PDFSTREAM.;62 14729
44

55
:EDIT-BY rmk
66

7-
:CHANGES-TO (FNS SEE-PDF)
7+
:CHANGES-TO (FNS OPEN-PDF-STREAM)
88

9-
:PREVIOUS-DATE "10-Dec-2024 14:36:59" {WMEDLEY}<library>PDFSTREAM.;59)
9+
:PREVIOUS-DATE "25-Dec-2024 14:26:23" {WMEDLEY}<library>PDFSTREAM.;60)
1010

1111

1212
(PRETTYCOMPRINT PDFSTREAMCOMS)
@@ -153,7 +153,8 @@
153153
(DEFINEQ
154154

155155
(OPEN-PDF-STREAM
156-
[LAMBDA (FILE OPTIONS) (* ; "Edited 23-Sep-2023 15:38 by rmk")
156+
[LAMBDA (FILE OPTIONS) (* ; "Edited 23-Feb-2025 12:18 by rmk")
157+
(* ; "Edited 23-Sep-2023 15:38 by rmk")
157158
(* ; "Edited 22-Sep-2023 11:04 by rmk")
158159
(* ; "Edited 24-Jun-2023 14:49 by rmk")
159160

@@ -171,20 +172,26 @@
171172
(* ;; "If FILE is on the LPT device, we could just ssume that it can be printed directly, no point in converting. But then we would alo have to lie and give it a PDF extension so it thinks that we are heading to a PDF printer.")
172173

173174
(OPENPOSTSCRIPTSTREAM FILE OPTIONS)
174-
else (CL:UNLESS (ASSOC (PDFCONVERTER)
175-
PDF-CONVERTER-TEMPLATES)
176-
(ERROR "A specified POSTSCRIPT-to-PDF converter cannot be found"))
177-
(SETQ FILE (OR (AND (NEQ FILE T)
178-
(OUTFILEP FILE))
179-
(ERROR "PDF target file not found" FILE)))
180-
(LET ((PSSTREAM (OPENPOSTSCRIPTSTREAM (CONCAT "{UNIX}/tmp/medley-pdf-" (IDATE)
181-
"-"
182-
(RAND)
183-
".ps")
184-
OPTIONS)))
185-
(STREAMPROP PSSTREAM 'AFTERCLOSE (CONS (FUNCTION CLOSE-PDF-STREAM)))
186-
(STREAMPROP PSSTREAM 'PDFTARGETINFO FILE)
187-
PSSTREAM])
175+
elseif (EQ 'NULL (FILENAMEFIELD (TRUEFILENAME FILE)
176+
'HOST))
177+
then
178+
(* ;; "Device NULL used by TMAX, maybe others, to get page number for table of contents, index. Nothing to convert")
179+
180+
(OPENPOSTSCRIPTSTREAM FILE OPTIONS)
181+
elseif (SETQ FILE (OR (AND (NEQ FILE T)
182+
(OUTFILEP FILE))
183+
(ERROR "PDF target file not found" FILE)))
184+
then (CL:UNLESS (ASSOC (PDFCONVERTER)
185+
PDF-CONVERTER-TEMPLATES)
186+
(ERROR "Can't find a POSTSCRIPT-to-PDF converter"))
187+
(LET ((PSSTREAM (OPENPOSTSCRIPTSTREAM (CONCAT "{UNIX}/tmp/medley-pdf-" (IDATE)
188+
"-"
189+
(RAND)
190+
".ps")
191+
OPTIONS)))
192+
(STREAMPROP PSSTREAM 'AFTERCLOSE (CONS (FUNCTION CLOSE-PDF-STREAM)))
193+
(STREAMPROP PSSTREAM 'PDFTARGETINFO FILE)
194+
PSSTREAM])
188195

189196
(CLOSE-PDF-STREAM
190197
[LAMBDA (PSSTREAM) (* ; "Edited 22-Sep-2023 11:18 by rmk")
@@ -285,8 +292,8 @@
285292
thereis (ShellWhich (CAR TEMPLATE])
286293
)
287294
(DECLARE%: DONTCOPY
288-
(FILEMAP (NIL (3255 5869 (PDFFILEP 3265 . 4179) (PDF.HARDCOPYW 4181 . 4779) (PDF.TEXT 4781 . 5498) (
289-
PDF.TEDIT 5500 . 5867)) (6309 13369 (OPEN-PDF-STREAM 6319 . 8455) (CLOSE-PDF-STREAM 8457 . 9744) (
290-
PS-TO-PDF 9746 . 13367)) (13370 13934 (SEE-PDF 13380 . 13932)) (13985 14269 (PDFCONVERTER 13995 .
291-
14267)))))
295+
(FILEMAP (NIL (3263 5877 (PDFFILEP 3273 . 4187) (PDF.HARDCOPYW 4189 . 4787) (PDF.TEXT 4789 . 5506) (
296+
PDF.TEDIT 5508 . 5875)) (6317 13806 (OPEN-PDF-STREAM 6327 . 8892) (CLOSE-PDF-STREAM 8894 . 10181) (
297+
PS-TO-PDF 10183 . 13804)) (13807 14371 (SEE-PDF 13817 . 14369)) (14422 14706 (PDFCONVERTER 14432 .
298+
14704)))))
292299
STOP

library/PDFSTREAM.LCOM

114 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)