TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: HelpLispinSeattle on April 27, 2010, 11:38:36 AM

Title: Send pdf to plotter/printer with lisp
Post by: HelpLispinSeattle on April 27, 2010, 11:38:36 AM
Hello,

I would like to make/create a pdf of a dwg then send/print the pdf silently to a plotter.
Can it be done with autolisp/visual lisp?

I've been researching command lines for acrobat but as I understand it they don't
support command lines for acrobat 8 & higher.

I dont need help with making/creating the pdf with lisp. Its what to do after it.

Any ideas?
Title: Re: Send pdf to plotter/printer with lisp
Post by: David Bethel on April 27, 2010, 12:52:43 PM

OOPS,

I misread this one

What I do is:

But it is not single step silent scenario.  I can do that with HPGL2 files, not PDFs

That allows me to sort the pages as required, and make a single multipage PDF.  -Daivd

Title: Re: Send pdf to plotter/printer with lisp
Post by: VovKa on April 27, 2010, 05:08:03 PM
you can try something other than acrobat
as for me, i use http://www.foxitsoftware.com/pdf/reader/reader3.php it's free and supports command line parameters
Title: Re: Send pdf to plotter/printer with lisp
Post by: JohnK on April 27, 2010, 10:52:13 PM
ghostscript
Title: Re: Send pdf to plotter/printer with lisp
Post by: HelpLispinSeattle on April 28, 2010, 09:56:46 AM

Thank you guys for all your ideas. I think I found myself
a solution. I am going to use Dave Fulger's DosLib.

I will use one of the "Process Functions"....dos_shellexe.

Thank you again everyone!

Title: Re: Send pdf to plotter/printer with lisp
Post by: Marc'Antonio Alessi on December 21, 2016, 12:49:11 PM

Thank you guys for all your ideas. I think I found myself
a solution. I am going to use Dave Fulger's DosLib.

I will use one of the "Process Functions"....dos_shellexe.

Thank you again everyone!
I found this old post... question: is there anyone who uses dos_shellexe to send PDFs to the printer?
Title: Re: Send pdf to plotter/printer with lisp
Post by: Marc'Antonio Alessi on December 22, 2016, 02:57:01 AM
I try with a second question: in Windows I can send PDF files directly to default printer (less then 16 without modify Win registry), how can I send PDF to printer like in Windows Explorer?
Title: Re: Send pdf to plotter/printer with lisp
Post by: roy_043 on December 22, 2016, 04:34:51 AM
Studying this VBscript solution may be helpful:
http://www.robvanderwoude.com/sourcecode.php?src=printpdf_vbs
Title: Re: Send pdf to plotter/printer with lisp
Post by: Marc'Antonio Alessi on December 22, 2016, 10:48:58 AM
Studying this VBscript solution may be helpful:
http://www.robvanderwoude.com/sourcecode.php?src=printpdf_vbs
thanks for answering, after many tests I found a fairly simple solution with Acrobat Reader installed:
Code: [Select]
(setq PdfFil "Z:/Temp/Test1.pdf")
(DOS_SHELLEXE "AcroRd32.exe" (strcat "/t /h \"" PdfFil "\"") 0 3)
:-)
Title: Re: Send pdf to plotter/printer with lisp
Post by: Marc'Antonio Alessi on January 03, 2017, 11:17:42 AM
To print many PDF copies I use:
; FlsLst = List of file names
Code: [Select]
(repeat NumCopies
  (foreach ForElm FlsLst
    (setq FilNam (strcat PatNam ForElm))
    (DOS_SHELLEXE "AcroRd32.exe" (strcat "/h /s /p \"" FilNam "\"") 0 3)
    (while (DOS_OPENP FilNam) (vl-cmdf "_.DELAY" 1))
  )
)
Sometimes I need to delete the files after printing but with this method the cancellation can take place before printing is complete, is there a way to execute cancellation after printing? (Dos_OpenP + delay do not works)...
Code: [Select]
(foreach ForElm FlsLst
  (while (DOS_OPENP (strcat PatNam ForElm)) (vl-cmdf "_.DELAY" 1))
  (DOS_DELETE (strcat PatNam ForElm))
)


Other attempt:
Code: [Select]
(setq DelFlg (DOS_MSGBOXEX "Delete the files after plot?"       "Send PDF to Printer" '("No" "Yes") 4))
(DOS_GETPROGRESS "Printing" "Please wait..."      100)
(foreach ForElm FlsLst
  (setq FilNam (strcat PatNam ForElm)  Countr 1)
  (DOS_GETPROGRESS -1)
  (repeat NumCop
    (DOS_SHELLEXE "AcroRd32.exe" (strcat "/h /s /p \"" FilNam "\"") 0 3)
    (vl-cmdf "_.DELAY" 500)
    (while (DOS_OPENP FilNam) (vl-cmdf "_.DELAY" 500))
    (if (and (= NumCop Countr) (= 1 DelFlg))
      (progn (DOS_DELETE FilNam) (alert (strcat FilNam "\n" (itoa Countr))))
      (setq Countr (1+ Countr))
    )
  )
)
(DOS_GETPROGRESS T)
Title: Re: Send pdf to plotter/printer with lisp
Post by: Lee Mac on January 03, 2017, 01:08:59 PM
Based on these references:

http://www.robvanderwoude.com/commandlineswitches.php#Acrobat
http://two.pairlist.net/pipermail/reportlab-users/2003-January/001158.html

Have you tried something like this?:
Code: [Select]
(setq DelFlg (DOS_MSGBOXEX "Delete the files after plot?" "Send PDF to Printer" '("No" "Yes") 4))
(DOS_GETPROGRESS "Printing" "Please wait..." 100)
(foreach ForElm FlsLst
    (setq FilNam (strcat PatNam ForElm))
    (DOS_GETPROGRESS -1)
    (repeat NumCop
        (DOS_SHELLEXE "AcroRd32.exe" (strcat "/N /T \"" FilNam "\" YourPrinterName") 0 3)
        (vl-cmdf "_.DELAY" 500)
        (while (DOS_OPENP FilNam) (vl-cmdf "_.DELAY" 500))
    )
    (if (= 1 DelFlg) (DOS_DELETE FilNam))
)
(DOS_GETPROGRESS T)
Title: Re: Send pdf to plotter/printer with lisp
Post by: Marc'Antonio Alessi on January 04, 2017, 02:46:19 AM
Based on these references:
http://www.robvanderwoude.com/commandlineswitches.php#Acrobat
http://two.pairlist.net/pipermail/reportlab-users/2003-January/001158.html
Have you tried something like this?:
...

/n - Launch a new instance of Reader even if one is already open
/s - Don't show the splash screen
/o - Don't show the open file dialog
/h - Open as a minimized window
/p <filename> - Open and go straight to the print dialog
/t <filename> <printername> <drivername> <portname> - Print the file the specified printer

/N /T > now works better. Generous as always, thanks for your time.  :-)
Title: Re: Send pdf to plotter/printer with lisp
Post by: Lee Mac on January 04, 2017, 08:05:19 AM
/N /T > now works better. Generous as always, thanks for your time.  :-)

Excellent, you're welcome - note that I also removed your counter variable  :wink:
Title: Re: Send pdf to plotter/printer with lisp
Post by: alanjt on January 04, 2017, 10:02:44 AM
Based on these references:

http://www.robvanderwoude.com/commandlineswitches.php#Acrobat
http://two.pairlist.net/pipermail/reportlab-users/2003-January/001158.html

Have you tried something like this?:
Code: [Select]
(setq DelFlg (DOS_MSGBOXEX "Delete the files after plot?" "Send PDF to Printer" '("No" "Yes") 4))
(DOS_GETPROGRESS "Printing" "Please wait..." 100)
(foreach ForElm FlsLst
    (setq FilNam (strcat PatNam ForElm))
    (DOS_GETPROGRESS -1)
    (repeat NumCop
        (DOS_SHELLEXE "AcroRd32.exe" (strcat "/N /T \"" FilNam "\" YourPrinterName") 0 3)
        (vl-cmdf "_.DELAY" 500)
        (while (DOS_OPENP FilNam) (vl-cmdf "_.DELAY" 500))
    )
    (if (= 1 DelFlg) (DOS_DELETE FilNam))
)
(DOS_GETPROGRESS T)
Cool