Author Topic: Send pdf to plotter/printer with lisp  (Read 3153 times)

0 Members and 1 Guest are viewing this topic.

HelpLispinSeattle

  • Guest
Send pdf to plotter/printer with lisp
« 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?

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Send pdf to plotter/printer with lisp
« Reply #1 on: April 27, 2010, 12:52:43 PM »

OOPS,

I misread this one

What I do is:
  • plot to a postscript file in acad via autolisp
  • write a ps based on runfilex.ps
  • then open that file with Distiller
  • then send this to a plotter via a dos type binary copy

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

R12 Dos - A2K

VovKa

  • Water Moccasin
  • Posts: 1629
  • Ukraine
Re: Send pdf to plotter/printer with lisp
« Reply #2 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

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: Send pdf to plotter/printer with lisp
« Reply #3 on: April 27, 2010, 10:52:13 PM »
ghostscript
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

HelpLispinSeattle

  • Guest
Re: Send pdf to plotter/printer with lisp
« Reply #4 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!


Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Send pdf to plotter/printer with lisp
« Reply #5 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?

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Send pdf to plotter/printer with lisp
« Reply #6 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?

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Send pdf to plotter/printer with lisp
« Reply #7 on: December 22, 2016, 04:34:51 AM »
Studying this VBscript solution may be helpful:
http://www.robvanderwoude.com/sourcecode.php?src=printpdf_vbs

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Send pdf to plotter/printer with lisp
« Reply #8 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)
:-)

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Send pdf to plotter/printer with lisp
« Reply #9 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)

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Send pdf to plotter/printer with lisp
« Reply #10 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)

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Send pdf to plotter/printer with lisp
« Reply #11 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.  :-)

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Send pdf to plotter/printer with lisp
« Reply #12 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:

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Send pdf to plotter/printer with lisp
« Reply #13 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
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox