Printing and Plotting

Printing and Plotting

Reply
Contributor
d2cad
Posts: 15
Registered: ‎03-26-2005
Message 11 of 13 (245 Views)

Re: PDF -plot command line

05-08-2007 06:02 AM in reply to: soverstreet
Could you show me how you did that... I tried to add the line "Ouput File=..." but it still gives me the PDF995 dialogbox.

Jeroen Berkers
D2CAD
Valued Contributor
soverstreet
Posts: 61
Registered: ‎02-19-2007
Message 12 of 13 (245 Views)

Re: PDF -plot command line

05-08-2007 08:15 AM in reply to: soverstreet
This will get rid of the dialog box to name the file (not the advertisement). Plot using the dialog box. This will populate the ini with filenames and stuff you will recognize. Open PDFEdit from Start/Programs/Software995/pdfedit995 and go to the Auto-Name tab. Pick the radio button for "Save all PDF documents to the same filename." Go to the Autolaunch tab and uncheck "Automatically display PDF after printing." Close PDFEdit. Open pdf995.ini and look at the way the entries are formatted. For example, Output File=C:\PLOTS\PDF\PLOTNAME.pdf. Duplicate each line of the ini file as a write from your plot routine. For example (princ (strcat "\nOutput File=C:\\PLOTS\\PDF\\" PLOTNAMEVAR ".pdf") dfile). Until you buy the software you will have to pick the "continue using..." button on the advertisement box. Hope this helps.
*Andrew Dunn
Message 13 of 13 (245 Views)

Re: PDF -plot command line

05-08-2007 07:59 PM in reply to: soverstreet
Yep... you will need to purchase PDF995 to get rid of the sponsor page
display..doesn't cost much so not too much pain there...
Just to be clear, I am in no way assoicated with the PDF995 guys... I have
bought the software and use it in our office that's all...

This is the lisp file we use here:

(defun c:xxx_MPlot ( / xxx_CTAB xxx_DWGNAME xxx_DWGPREFIX xxx_FP1 xxx_FP2
xxx_PLTFILENAME
XXX_FILEEXIST XXX_FP0 XXX_PDFFILENAME XXX_TMP XXX_TMPFILE
XXX_TMPINI)
(vl-load-com)
; build desired output file name and PDF file name... Tab Name followed by
Drawing File Name:
(setq xxx_dwgprefix (getvar "DWGPREFIX")
xxx_dwgname (substr (getvar "DWGNAME") 1 (- (strlen (getvar
"DWGNAME")) 4))
xxx_ctab (getvar "CTAB")
)
(setq xxx_pltfileName (Strcat "Output File=" xxx_dwgprefix xxx_ctab " - "
xxx_dwgname ".PDF")
xxx_pdfFileName (Strcat xxx_dwgprefix xxx_ctab " - " xxx_dwgname
".PDF"))

(princ xxx_pltfileName)(princ "\n") ; print name to screen to prompt user
where to find the file..

(setq xxx_fileExist (findfile xxx_pdfFileName)) ; check to see if file
exists

(while xxx_fileExist ; if file does exist attempt to delete it
(setq xxx_tmp (vl-file-delete xxx_pdfFileName))
(if (= xxx_tmp nil) ; if we can't delete it provide alert - probably
means the file is open in the Acrobat viewer... just close the viewer and
hit OK.
(alert (strcat "Unable to overwrite\n" xxx_pdfFileName)) ; note there is no
way to cancel at this point... if something goes wrong will need to
terminate ACAD.
)
(setq xxx_fileExist (findfile xxx_pdfFileName))
)


;; copy INI file
(setq xxx_tmpini (vl-filename-mktemp "Save.ini"))
(vl-file-copy "C:\\Program Files\\pdf995\\res\\pdf995.ini" xxx_tmpini) ;
save existing PDF995 ini file to a temporary file

;; write BAT file
;; Batch file excutes after PDF995 has completed processing the file. This
is triggered by the entry "ProcessPDF=" in the INI file.
;; Basically with the entry "ProcessPDF=BATCH.BAT" the BATCH.BAT file will
execute after PDF995 is finished processing the file, so
;; we create a self deleting BAT file to clean up... copied the original
INI file back over the one we modified with the file name added, deletes
;; the tempory files, then deletes itself. This pops a Command window up
briefly (would love to know how to stop that happening).

(setq xxx_tmpfile (vl-filename-mktemp "pdfdel.bat"))
(setq xxx_fp0 (open xxx_tmpfile "w"))
(if xxx_fp0
(progn
(write-line (strcat "copy \"" xxx_tmpini "\" \"C:\\Program
Files\\pdf995\\res\\pdf995.ini\" /y") xxx_fp0)
(write-line (strcat "del \"" xxx_tmpini "\"") xxx_fp0)
(write-line (strcat "del \"" xxx_tmpfile "\"") xxx_fp0)
(close xxx_fp0)
)
(princ "***ERROR***\nCannot open temp file for write!\n")
)
(setq xxx_fp1 (open "C:\\Program Files\\pdf995\\res\\pdf995.ini" "w")) ;
open PDF995 ini file to overwrite
(if xxx_fp1
(progn
(write-line "[Parameters]" xxx_fp1)
(write-line "documentevent=5" xxx_fp1) ;; helps with wipeout entites
to stope them printing black..
(write-line "Install=1" xxx_fp1)
(write-line "Quiet=0" xxx_fp1)
(write-line "Use GPL Ghostcript=1" xxx_fp1)
(write-line "Autolaunch=0" xxx_fp1)
(write-line "Strip Extension=0" xxx_fp1)
(write-line (strcat "ProcessPDF=" xxx_tmpfile) xxx_fp1) ;; this
calls the BAT file when finished to clean up
(write-line xxx_pltfileName xxx_fp1) ;; this is the actual PDF file
name that will be created
(close xxx_fp1)
)
(princ "***ERROR***\nCannot open PDF995.INI for write!\n")
)
(command ".-plot" "N" "" "" "" "" "" "")
(princ)
)


This is still a work in progress for us, but it does work. Just a couple of
problems...
I have recently added a test to see if the file can be deleted. This is
because PDF995 will not overwrite the file if it exists, and will not warn
you either, so this was added to make sure that incorrect PDF files were
issued when the guys thought they had rewritten a PDF while having the file
open in the PDF viewer. Unfortunatly, I have done this with an ALERT box...
this is a bit of a cludge because you can't cancel it. I am planning to add
an OK/CANCEL dialog box when I get time...

The routine also relies on the pagesetup being correct. Once again when I
get time I plan to add code to ensure the correct setup is used...

Hope this helps!! We have found it to be a GREAT time saver. Another case of
having to go to great lengths to get around arebitary limitations in
AutoCAD. All we really needed was plot files named by TAB name followed by
Drawing file name. There is no way to do this easily!

Hope this helps!!

Cheers,
Andrew Dunn



wrote in message news:5578594@discussion.autodesk.com...
This will get rid of the dialog box to name the file (not the
advertisement). Plot using the dialog box. This will populate the ini with
filenames and stuff you will recognize. Open PDFEdit from
Start/Programs/Software995/pdfedit995 and go to the Auto-Name tab. Pick the
radio button for "Save all PDF documents to the same filename." Go to the
Autolaunch tab and uncheck "Automatically display PDF after printing."
Close PDFEdit. Open pdf995.ini and look at the way the entries are
formatted. For example, Output File=C:\PLOTS\PDF\PLOTNAME.pdf. Duplicate
each line of the ini file as a write from your plot routine. For example
(princ (strcat "\nOutput File=C:\\PLOTS\\PDF\\" PLOTNAMEVAR ".pdf") dfile).
Until you buy the software you will have to pick the "continue using..."
button on the advertisement box. Hope this helps.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!