• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Visual LISP, AutoLISP and General Customization

    Reply
    Contributor
    Posts: 18
    Registered: ‎05-25-2006

    Saving into a PDF

    161 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
    Please use plain text.
    *Paul Turvill

    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
    Please use plain text.
    Contributor
    Posts: 18
    Registered: ‎05-25-2006

    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.
    Please use plain text.
    *George Drayton

    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
    Please use plain text.
    Distinguished Contributor
    Posts: 1,419
    Registered: ‎06-03-2002

    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
    Please use plain text.
    *Umlauf Gert

    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
    Please use plain text.
    Contributor
    Posts: 18
    Registered: ‎05-25-2006

    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 ?
    Please use plain text.
    Valued Contributor
    Posts: 73
    Registered: ‎03-27-2005

    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
    Please use plain text.
    Active Contributor
    Posts: 44
    Registered: ‎06-28-2000

    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
    Please use plain text.