Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Saving into a PDF

8 REPLIES 8
Reply
Message 1 of 9
laelic
502 Views, 8 Replies

Saving into a PDF

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
8 REPLIES 8
Message 2 of 9
Anonymous
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
Message 3 of 9
laelic
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.
Message 4 of 9
Anonymous
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
Message 5 of 9
andrew_nao
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:PDF ( / 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
Message 6 of 9
Anonymous
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
Message 7 of 9
laelic
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 ?
Message 8 of 9
shawndoe
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
Message 9 of 9
srestmeyer
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost