Author Topic: Manipulating AdobeReader using Visual LISP Possible?  (Read 23051 times)

0 Members and 1 Guest are viewing this topic.

JohnK

  • Administrator
  • Seagull
  • Posts: 10603
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #60 on: August 26, 2010, 09:33:10 AM »
Vali, good point.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #61 on: August 26, 2010, 02:01:33 PM »
oh come on Lee, I was talking about the AutoLisp portion being simple...don't put words into my mouth.



Yeah sorry, that was a cheap dig.

Anyway, I tried the 'copy' method today but, unfortunately was unsuccessful. The code runs without error, but nothing seems to happen.

Here is the code I have been trying, assume that 'pdfLst' is a list of full filenames of PDF files.

Code: [Select]
(startapp "net use lpt3 /delete")

(startapp "net use lpt3 \\\\<printserver>\\<printer>")

(foreach file pdfLst
  (startapp (strcat "copy /b \"" file "\" lpt3"))
)

(startapp "net use lpt3 /delete")

Code: [Select]
(foreach file pdfLst
  (startapp (strcat "copy /b \"" file "\" \\\\<printserver>\\<printer>"))
)

Code: [Select]
(foreach file pdfLst
  (startapp (strcat "copy /b \"" file "\" //<printserver>/<printer>"))
)

Each with the same result as described above.

So far the closest I have got to printing is using:

Code: [Select]
(setq adobe "C:\\Program Files\\Adobe\\Reader\\AcroRd32.exe")

(foreach file pdfLst
  (startapp (strcat adobe " /t /h \"" file "\""))
)

Which actually registers the necessary files on the print queue, but only the first is sent. The first file is open for longer than the subsequent files, so perhaps these files are not open long enough for the data to be sent to the printer... but, in any case, the printer registers a timeout error and fails to print all but the first file.

Lee




JohnK

  • Administrator
  • Seagull
  • Posts: 10603
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #62 on: August 26, 2010, 03:53:43 PM »
The only thing i got at this point is: are you sure you have the server name and the printer share name properly spelled and used? I'm thinking that you are sending the file into never-never land.

SH stands for SHELL...Type "sh enter enter" on the acad command line to open a prompt and send a file that way once.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

LE3

  • Guest
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #63 on: August 26, 2010, 04:41:48 PM »
Here it is something I just found out, but could not make it to work:

Code: [Select]
(vl-load-com)
(setq prog-id "AcroPDF.PDF.1")
(setq pdf (vlax-create-object prog-id))

(vlax-invoke-method pdf 'LoadFile "C:\\test.pdf") ;; returns :vlax-false no idea why or how to set this...

(setq pdf (vlax-create-object prog-id))
; IAcroAXDocShim: IAcroAXDocShim Interface
; Property values:
;   messageHandler = nil
;   src = ""
; Methods supported:
;   execCommand (1)
;   GetVersions ()
;   goBackwardStack ()
;   goForwardStack ()
;   gotoFirstPage ()
;   gotoLastPage ()
;   gotoNextPage ()
;   gotoPreviousPage ()
;   LoadFile (1)
;   postMessage (1)
;   Print ()
;   printAll ()
;   printAllFit (1)
;   printPages (2)
;   printPagesFit (3)
;   printWithDialog ()
;   setCurrentHighlight (4)
;   setCurrentHightlight (4)
;   setCurrentPage (1)
;   setLayoutMode (1)
;   setNamedDest (1)
;   setPageMode (1)
;   setShowScrollbars (1)
;   setShowToolbar (1)
;   setView (1)
;   setViewRect (4)
;   setViewScroll (2)
;   setZoom (1)
;   setZoomScroll (3)

T
_$

(vlax-release-object pdf)
 

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #64 on: August 26, 2010, 04:45:23 PM »
The only thing i got at this point is: are you sure you have the server name and the printer share name properly spelled and used? I'm thinking that you are sending the file into never-never land.

SH stands for SHELL...Type "sh enter enter" on the acad command line to open a prompt and send a file that way once.

I'll definitely check that - thanks mate.

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #65 on: August 26, 2010, 04:45:59 PM »
Here it is something I just found out, but could not make it to work:

That's interesting Luis - I'll investigate that too when I get a spare minute - thanks.  :-)

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #66 on: August 26, 2010, 04:57:29 PM »
Here it is something I just found out, but could not make it to work:

That's interesting Luis - I'll investigate that too when I get a spare minute - thanks.  :-)

I get the same results as you Luis - unable to load a file.  :-(

LE3

  • Guest
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #67 on: August 26, 2010, 04:59:27 PM »
Here it is something I just found out, but could not make it to work:

That's interesting Luis - I'll investigate that too when I get a spare minute - thanks.  :-)

I get the same results as you Luis - unable to load a file.  :-(
well.... :-( - how about the exe, did it worked?

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #68 on: August 26, 2010, 05:14:24 PM »
Here it is something I just found out, but could not make it to work:

That's interesting Luis - I'll investigate that too when I get a spare minute - thanks.  :-)

I get the same results as you Luis - unable to load a file.  :-(
well.... :-( - how about the exe, did it worked?

The .exe method was the closest I got to actually printing...

See here:

http://www.theswamp.org/index.php?topic=34551.msg398482#msg398482

LE3

  • Guest
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #69 on: August 26, 2010, 05:17:40 PM »
nope... the one sent to you via email

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #70 on: August 26, 2010, 05:45:08 PM »
nope... the one sent to you via email

Ahh - apologies, my email has since changed so I rarely check my old one, I shall have a look now and also send you my new email address.

Daniel Eiszele

  • Newt
  • Posts: 85
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #71 on: August 26, 2010, 06:35:51 PM »
Unless I'm mistaken, the following doesn't work because pdf is still nil.

Here it is something I just found out, but could not make it to work:

Code: [Select]
(vl-load-com)
(setq prog-id "AcroPDF.PDF.1")
(setq pdf (vlax-create-object prog-id))

(vlax-invoke-method pdf 'LoadFile "C:\\test.pdf") ;; returns :vlax-false no idea why or how to set this...

 

because...

Quote
<snip>
Adobe Reader does not support OLE.

Same link as what i posted before.
http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/Overview_GettingStarted.3.10.html


Daniel Eiszele

  • Newt
  • Posts: 85
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #72 on: August 26, 2010, 06:52:38 PM »
@Lee: Just wondering; is there a reason you are trying to do this from code?  If you select the files you want to print in explorer then select "print" from the right click menu then everything prints without a problem (at least on my system).

LE3

  • Guest
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #73 on: August 26, 2010, 08:36:04 PM »
Thanks!
I know and even if that is not possible, I still gave it a try... and that's why I am in the programming field -  :-)

Went the C# route and that looks better (promising) - btw - once there is a working sample will try to post it at the .net side.

Unless I'm mistaken, the following doesn't work because pdf is still nil.

Here it is something I just found out, but could not make it to work:

Code: [Select]
(vl-load-com)
(setq prog-id "AcroPDF.PDF.1")
(setq pdf (vlax-create-object prog-id))

(vlax-invoke-method pdf 'LoadFile "C:\\test.pdf") ;; returns :vlax-false no idea why or how to set this...

 

because...

Quote
<snip>
Adobe Reader does not support OLE.

Same link as what i posted before.
http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/Overview_GettingStarted.3.10.html


Daniel Eiszele

  • Newt
  • Posts: 85
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #74 on: August 26, 2010, 09:06:05 PM »
Thanks!
I know and even if that is not possible, I still gave it a try... and that's why I am in the programming field -  :-)

Went the C# route and that looks better (promising) - btw - once there is a working sample will try to post it at the .net side.


Tell me about it :) I didn't want to believe it either! But, after importing the type library and banging my head against the wall for a couple of hours I just had to assume that even though it looked like all the necessary methods had been exposed, there was still something behind the scenes stopping me from creating the connection.

A bit of further reading suggests that you can use DDE to communicate with Reader.