Author Topic: Multi-sheet PDF with -publish  (Read 3699 times)

0 Members and 1 Guest are viewing this topic.

CincyJeff

  • Newt
  • Posts: 89
Multi-sheet PDF with -publish
« on: April 26, 2018, 08:35:51 AM »
I'm trying to standardize our creation of PDF files by having everyone run a lisp file to create them. Everything works until I use -publish with a .dsd file. If I load the .dsd file into the publish dialog it creates a multi-sheet PDF. When I use -publish with the same .dsd file it creates separate PDFs for each sheet. Is there a way to make a multi-sheet PDF using -publish?

tombu

  • Bull Frog
  • Posts: 289
  • ByLayer=>Not0
Re: Multi-sheet PDF with -publish
« Reply #1 on: April 26, 2018, 09:17:22 AM »
http://help.autodesk.com/view/ACD/2019/ENU/?guid=GUID-2369EDF8-FC5E-4DB9-8DBA-E1997C31BDED
PUBLISHCOLLATE (System Variable)
Controls whether plotting a sheet set, multi-sheet plot file, or plot spool file can be interrupted by other plot jobs.

Type:   Integer
Saved in:   User-settings
Initial value:   1
Publishing sheets as a single job requires a plot driver that supports the multi-sheet plotting or printing option.
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

CincyJeff

  • Newt
  • Posts: 89
Re: Multi-sheet PDF with -publish
« Reply #2 on: April 26, 2018, 09:21:28 AM »
My PUBLISHCOLLATE is 1 for both scenarios. Using -publish always creates separate PDFs.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Multi-sheet PDF with -publish
« Reply #3 on: April 26, 2018, 09:59:20 AM »
I've found the PUBLISHCOLLATE system variable to be unreliable.  I've always preferred to push out individual PDFs and then use another program like Adobe or Bluebeam to put them together.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

CincyJeff

  • Newt
  • Posts: 89
Re: Multi-sheet PDF with -publish
« Reply #4 on: April 26, 2018, 11:28:29 AM »
Someone in the Autodesk Customization forum was able to help me. There's a TYPE setting in the .dsd file that controls the output. Mine was created with the setting at 2 but it creates a multi-sheet PDF if I set it to 6. Thanks to those that posted replies.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Multi-sheet PDF with -publish
« Reply #5 on: April 26, 2018, 12:59:42 PM »
Thanks for sharing your findings.   8)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

BIGAL

  • Swamp Rat
  • Posts: 1436
  • 40 + years of using Autocad
Re: Multi-sheet PDF with -publish
« Reply #6 on: April 27, 2018, 03:06:24 AM »
I gave up on publish we have a plot range of layouts to PDF just enter start and finish via DCL and it uses Ghostscript to make it into 1 PDF file. If you want post.
A man who never made a mistake never made anything

CincyJeff

  • Newt
  • Posts: 89
Re: Multi-sheet PDF with -publish
« Reply #7 on: April 27, 2018, 12:02:31 PM »
Thanks for the offer. I looked at GhostScript but it didn't like our network setup. In testing I could get it to work locally but when I used actual project files it failed to function. The publish option seems to be working fine now and I don't have the maintenance of adding GhostScript to our setup.

BIGAL

  • Swamp Rat
  • Posts: 1436
  • 40 + years of using Autocad
Re: Multi-sheet PDF with -publish
« Reply #8 on: April 29, 2018, 01:09:04 AM »
Here is the ghostscript code you pass the list of pdfs "srcFileLst" and the target file name

Code: [Select]
;MergePdfs
;Merges multiple pdf (or eps) files into one
;Requires the installatoion of Ghostscript

; make a batch file ?
;gs -sDEVICE=pdfwrite \
;    -dNOPAUSE -dBATCH -dSAFER \
;    -sOutputFile=combined.pdf \
;    first.pdf \
;    second.pdf \
;    third.pdf [...]

;Ghostscript (http://www.ghostscript.com/) can be used to combine PDFs.

; Something like this should work: by Roy_043

(defun KGA_String_Join (strLst delim)
(if strLst
(apply
'strcat
(cons
(car strLst)
(mapcar '(lambda (a) (strcat delim a)) (cdr strLst))
)
)
""
)
)


(setq gsexe "P:\\gs\\gs9.19\\bin\\gswin64c.exe")

; Note: Existing trgFile will be overwritten.
(defun CombinePdf (gsExe srcFileLst trgFile)
(startapp
(strcat
gsExe " "
"-sDEVICE=pdfwrite -dBATCH -dNOPAUSE -dQUIET  "
"-sOutputFile=\"" trgFile "\" "
"\"" (KGA_String_Join srcFileLst "\" \"") "\""
)
)
)

Code: [Select]
; each sheet has a plotname
(setq plotnames (cons pdfname plotnames))
(setq trgfile (strcat (getvar "dwgprefix") "pdf\\" dwgname "-D" val1 "-D" val2 ".pdf"))
(setq plotnames (reverse plotnames))
(IF (= (length plotnames) 1)
(princ)
(progn
(if (not combinepdf)(load "mergepdfs"))
(combinepdf gsExe plotnames trgFile )
)
)
A man who never made a mistake never made anything

GHarvey

  • Mosquito
  • Posts: 3
Re: Multi-sheet PDF with -publish
« Reply #9 on: April 30, 2018, 09:04:06 AM »
For what it's worth, here is something I wrote some years back as part of a project I was working on. It's a bit low-tech, but I found it worked as intended. There is no error handling: The input is assumed to be valid. The custom *.dsd is returned as a temporary file which can then be passed to the "-publish" command.



Code: [Select]
;;===========================================================================;;
;; MKDSD IS A UTILITY WHICH WILL CONSTRUCT A DRAWING SET DESCRIPTION FILE    ;;
;; (*.DSD) FOR CONFIGURATION OF THE "PUBLISH" COMMAND                        ;;
;;                                                                           ;;
;; ARGUMENTS: LST -> A LIST - OR LIST OF LISTS - COMPRISED OF:               ;;
;;                   1) SHEET NAME (STR); USUALLY THE NAME OF THE DRAWING    ;;
;;                   2) FULL DRAWING PATH (STR), INCLUDING FILE NAME         ;;
;;                   3) LAYOUT NAME (STR)                                    ;;
;;                   4) PAGE SETUP (STR); NOTE - EMPTY STRING IF PAPERSPACE  ;;
;;                   5) SHEET PATH (STR); TYPICALLY THE SAME AS DRAWING PATH ;;
;;            TYP -> AN INTEGER, INDICATING THE TYPE OF OUTPUT:              ;;
;;                   0 - DWF, SINGLE SHEETS                                  ;;
;;                   1 - DWF, MULTI-SHEET                                    ;;
;;                   2 - PRINTER SPECIFIED IN PAGE SETUP                     ;;
;;                   3 - DWFX, SINGLE SHEETS                                 ;;
;;                   4 - DWFX, MULTI-SHEET                                   ;;
;;                   5 - PDF, SINGLE SHEET                                   ;;
;;                   6 - PDF, MULTI-SHEET                                    ;;
;;            DWF -> OUTPUT (STR) - FULL PATH/NAME FOR MULTI-SHEET FILE      ;;
;;            OUT -> OUTPUT (STR) - PATH ONLY FOR SINGLE SHEET FILES         ;;
;;                                  (NAMES TAKEN FROM INDIVIDUAL SHEET       ;;
;;                                  NAMES, PER LST ARGUMENT, ABOVE)          ;;
;;            VF  -> BOOLEAN - INDICATES WHETHER TO OPEN GENERATED FILE      ;;
;;===========================================================================;;

(defun mkdsd (lst typ dwf out vf / D-S-D FIL FLDSD I S X Y)
  (setq d-s-d (open (setq fil (vl-filename-mktemp "foo.dsd")) "w"))
 
  ; FLDSD CONSTRUCTS STRINGS BASED ON THE LST ARGUMENT,
  ; TO BE WRITTEN INTO THE DSD.
 
  (defun fldsd (strlst / )
    (mapcar '(lambda (s) (write-line s d-s-d))
    (append
      (mapcar '(lambda (x y) (vl-string-subst x "\|/" y))
      strlst
      (list "[DWF6Sheet:\|/]"
    "DWG=\|/"
    "Layout=\|/"
    "Setup=\|/"
    "OriginalSheetPath=\|/"
    ); list
      ); mapcar
      (list "Has Plot Port=0" "Has3DDWF=0")
      ); append
    ); mapcar
    ); defun
  (mapcar '(lambda (i) (write-line i d-s-d))
  (list "[DWF6Version]"
"Ver=1"
"[DWF6MinorVersion]"
"MinorVer=1"
); list
  ); mapcar
  (if (listp (car lst))
    (mapcar 'fldsd lst)
    (fldsd lst)
    ); if
  (mapcar '(lambda (i) (write-line i d-s-d))
  (list "[Target]"
(strcat "Type=" (itoa typ))
(strcat "DWF=" dwf)
(strcat "OUT=" out)
"PWD="
"[MRU block template]"
"MRU=0"
"[MRU Local]"
"MRU=0"
"[MRU Sheet List]"
"MRU=0"
"[AutoCAD Block Data]"
"IncludeBlockInfo=0"
"BlockTmplFilePath="
"[SheetSet Properties]"
"IsSheetSet=FALSE"
"IsHomogeneous=FALSE"
"SheetSet Name="
"NoOfCopies=1"
"PlotStampOn=FALSE"
(strcat "ViewFile=" (if vf "TRUE" "FALSE"))
"JobID=0"
"SelectionSetName="
(strcat "AcadProfile=" (getvar "cprofile"))
"CategoryName="
"LogFilePath="
"IncludeLayer=FALSE"
"LineMerge=FALSE"
"CurrentPrecision="
"PromptForDwfName=FALSE"
"PwdProtectPublishedDWF=FALSE"
"PromptForPwd=FALSE"
"RepublishingMarkups=FALSE"
"PublishSheetSetMetadata=FALSE"
"PublishSheetMetadata=FALSE"
"3DDWFOptions=0 1"
); list
  ); mapcar
  (close d-s-d)
  fil
  ); defun