Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Contributor
laelic
Posts: 18
Registered: ‎05-25-2006
Message 1 of 9 (225 Views)

Saving into a PDF

225 Views, 8 Replies
02-01-2008 10:37 AM
Hello,

My problem is the following, when i finish to revised a drawing, i would like to press a button and do the following : the drawing is save into a pdf file to a given directory. Is there a way to do that ? For the file name, a dialog box can ask for the name.

Thank you
*Paul Turvill
Message 2 of 9 (225 Views)

Re: Saving into a PDF

02-01-2008 10:48 AM in reply to: laelic
First things first: Do you have a PDF writer (printer device) set up on your
machine? The usual way to create a PDF from AutoCAD is to "plot" or "print"
to a PDF device defined in your Printers window.
___

wrote in message news:5837011@discussion.autodesk.com...
Hello,

My problem is the following, when i finish to revised a drawing, i would
like to press a button and do the following : the drawing is save into a pdf
file to a given directory. Is there a way to do that ? For the file name, a
dialog box can ask for the name.

Thank you
Contributor
laelic
Posts: 18
Registered: ‎05-25-2006
Message 3 of 9 (225 Views)

Re: Saving into a PDF

02-01-2008 10:51 AM in reply to: laelic
Yes a i have that. I use cutepdf. I can do that manually, but i would like to automate the process. So, i need to use a button that will start the process with the cutepdf, then save the file to a given directory.
*George Drayton
Message 4 of 9 (225 Views)

Re: Saving into a PDF

02-02-2008 01:08 PM in reply to: laelic
Explore the use of the "-plot" command the responses to which can be put
into a lisp routine or a script. Your customisation needs to answer all
the prompts. You may wish NOT to save afterwards so that the file
remembers your normal plotter.

George Drayton CD-CAD Ltd Christchurch New Zealand
Distinguished Contributor
andrew_nao
Posts: 1,419
Registered: ‎06-03-2002
Message 5 of 9 (225 Views)

Re: Saving into a PDF

02-04-2008 05:53 AM in reply to: laelic
found this code awhile ago
never go around to testing it however
feel free to see if it works for you, you will need to make some changes to
it to suit your need also

(defun C:smileytongue:DF ( / paper orient filename dwgname dwgpre )
;; Setup section
(setq paper "ANSI A (8.50 x 11.00 Inches)")
(setq orient "PORTRAIT")
(setq filename "")
(setq dwgname (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname"))
4) ))
(setq dwgpre (getvar "dwgprefix"))
(setq filename (strcat "c:/bsl/pdf/" dwgname ".pdf"))
;; driver size8.5x11 portrait
Extents Scale Center ..
(command "_plot" "Y" "MODEL" "DWG To PDF.pc3" paper "inches" orient "N" "E"
"1=20" "C" "Y" "monochrome.ctb" "Y" "A" filename "N" "Y")
(prompt "\n ")
(princ)
); end function
(princ)


wrote in message news:5837011@discussion.autodesk.com...
Hello,

My problem is the following, when i finish to revised a drawing, i would
like to press a button and do the following : the drawing is save into a pdf
file to a given directory. Is there a way to do that ? For the file name, a
dialog box can ask for the name.

Thank you
*Umlauf Gert
Message 6 of 9 (225 Views)

Re: Saving into a PDF

02-04-2008 07:24 AM in reply to: laelic
i guess cutepdf wants a least a filename entry
try instead, maybe it works better for your issues 3-Heights™ PDF Producer


George Drayton wrote:
> Explore the use of the "-plot" command the responses to which can be put
> into a lisp routine or a script. Your customisation needs to answer all
> the prompts. You may wish NOT to save afterwards so that the file
> remembers your normal plotter.
>
> George Drayton CD-CAD Ltd Christchurch New Zealand
Contributor
laelic
Posts: 18
Registered: ‎05-25-2006
Message 7 of 9 (225 Views)

Re: Saving into a PDF

02-04-2008 11:03 AM in reply to: laelic
Hi Andrew,

I've modified the code to suit my needs, it work, except that it keep asking the user to enter the name of the file manually. Can you help ?
Valued Contributor
shawndoe
Posts: 73
Registered: ‎03-27-2005
Message 8 of 9 (225 Views)

Re: Saving into a PDF

02-04-2008 04:24 PM in reply to: laelic
Hi,

I don't know about CutePDF, but this is the string I use to get Adobe to Name a file without the dialogue. I wouldn't doubt that CutePDF is doing something similiar. Look for the registry key and change the one shown below as needed.

[code]
(vl-registry-write "HKEY_CURRENT_USER\\SOFTWARE\\ADOBE\\Acrobat Distiller\\PrinterJobControl"
(strcat (vla-get-path (vlax-get-acad-object)) "\\acad.exe")
(strcat path Name "pdf")
)
[/code]

Hope that helps.
Shawndoe
Valued Contributor
srestmeyer
Posts: 65
Registered: ‎06-28-2000
Message 9 of 9 (225 Views)

Re: Saving into a PDF

02-05-2008 12:02 PM in reply to: laelic
Here is some code from an autoplot program I wrote
First you set some parapmeters:

(setq plotter_name "DWG To PDF"); This would be your PDF plotter PC3 file name
(setq paper_size "ANSI expand B (11.00 x 17.00 Inches)")
(setq dwg_o "landscape")
(setq plt_name (strcat (getvar "dwgprefix")(substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))))
)

Next you run the plot:
(command "-plot" "y" "" plotter_name paper_size "i" dwg_o "n" "extents" "fit" "c" "y" "monochrome.ctb"
"y" "n" "y" plt_name "n" "y")

Hope this helps,
Scott R
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.