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

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #45 on: August 23, 2010, 03:26:56 PM »
I didn't look up Ghostscript or Redmon, but would rather focus on the Windows side of things as this is for work and so I probably won't be able to use too many external applications.

I was thinking of using the second method as shown on that MSoft page - using the MSDos print function with "/d:\\printserver\\printername", but I'm not sure whether this would actually print PDF's as it says only for use with ASCII files  :|

Lee


JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #46 on: August 23, 2010, 03:48:51 PM »
I didn't look up Ghostscript or Redmon, but would rather focus on the Windows side of things as this is for work and so I probably won't be able to use too many external applications.

Then why were you trying to use Acrobat Reader (What im saying is that your statement doesn't make a whole lot of sense to me but...)?

I was thinking of using the second method as shown on that MSoft page - using the MSDos print function with "/d:\\printserver\\printername", but I'm not sure whether this would actually print PDF's as it says only for use with ASCII files


You are correct; it will not print like you want it to (PRINT will just print the contents of the file...the PS). Use the COPY command to copy to the LPT port you established or the UNC path if one is not already set up for you.

Remember this page: http://support.microsoft.com/kb/158081


EDIT: removed words.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #47 on: August 23, 2010, 04:13:26 PM »
I didn't look up Ghostscript or Redmon, but would rather focus on the Windows side of things as this is for work and so I probably won't be able to use too many external applications.

Then why were you trying to use Acrobat Reader (What im saying is that your statement doesn't make a whole lot of sense to me but...)?

Sorry, let me rephrase - I would rather focus on using programs that are already installed on the work computers: Acrobat Reader being one of them.


Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #48 on: August 23, 2010, 04:14:06 PM »
You are correct; it will not print like you want it to (PRINT will just print the contents of the file...the PS). Use the COPY command to copy to the LPT port you established or the UNC path if one is not already set up for you.

Remember this page: http://support.microsoft.com/kb/158081

Thanks Se7en, I'll try it at work tomorrow  :-)

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #49 on: August 24, 2010, 05:48:21 PM »
So i assume by now `tomorrow' has came and went. Easy, difficult, great, blew-up, launched thermo-nuclear-warhead, what?!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #50 on: August 24, 2010, 05:59:38 PM »
I didn't get around to coding the 'copy' at work (as I would have to map the LPT1 port to the network port using net.exe), but for kicks I tried the print function but got 'invalid switch' but I'm not going to proceed using that function anyway.

Quick question about the use of net.exe - I was reading this article last night (regarding 'Method 1') - will this method affect the printer network port for other users?

Also, I notice that it says to use '/persistent:yes' in the expression - does this mean I would call this method once, print all my files and the printer port would remain mapped to the network port for every file? If so, how would I unmap it after I am finished - or would it not be an issue to leave it this way?

You see, the way I was thinking of approaching it was something like this:

Quote
Pseudo Code
Get List of Filenames to print (full filepath included for each file)  -  done!

Map Printer port LPT1 to Network Printer Port (would this need to be done for each file?)

Use copy statement for each file in the list of filenames

- Perhaps 'unmap' printer port.

What are your thoughts?
« Last Edit: August 24, 2010, 06:27:43 PM by Lee Mac »

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #51 on: August 24, 2010, 06:42:00 PM »
Completely off the top of my head (or out of an orifice, take your pick), have you tried using VL to work with an Explorer object?  I know they can view PDF and should have a print method as well, which may be exposed.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #52 on: August 24, 2010, 06:54:16 PM »
no the LPT(#) port(s) (I think you only get three) are just a shortcut like a shortcut on your desktop or a mapped network drive and they are computer specific. Its been years since i mapped a LPT port (and ive only mapped one to something useful only a handful of times anyways...you can point it at a website, printer, whatever...its an old hacker trick to remap lpt1 to something goofy.)

If i remember right all you have to do to map is: net use LPT1 //printerserver/printer

Years ago i wrote a stand-alone VB progy that would just take a bunch of files and send them to one of three printers using the COPY /B method but  you dont have to use a LPT port; just pass a fully qualified UNC path.

So...
1. get list of files.
    - append path to file name
2. mapcar - copy /b list-item //server/printer
done.

IMO you are making this WAY to difficult. This is a shorty program; this should only take you a few minutes to code up if its just for your use. I would a lot myself maybe a half an hour for coding, and testing (to make sure i didn't launch any rockets).
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #53 on: August 24, 2010, 06:56:44 PM »
Completely off the top of my head (or out of an orifice, take your pick), have you tried using VL to work with an Explorer object?  I know they can view PDF and should have a print method as well, which may be exposed.

VOTE: Second one.


And what happens when you right click on a file and choose print (Hint/Answer: it uses the application associated with the type to open it an print it)?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Vali

  • Mosquito
  • Posts: 9
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #54 on: August 25, 2010, 01:37:47 AM »
Due to all kinds of trouble with networking and people and subcontractors don't following standards, I had everybody to produce plt files. Printer drivers are on server for everybody to download and make the plts. I hate to search for ctb and stb files, to set custom paper sizes and other stuff so the plt is the way to go. Sometimes we produce one "booklet" and all the managers seeing it want their own copy, but only for their scope (structures, earthworks, drainage, etc) and since we don't know how many we should plot plts help us a lot. Then we take the plts for a booklet and dump them to a folder and fire up a cmd that looks like this:

net use lpt3 /delete ;;;Ensure that lpt3 is not assigned

net use lpt3 \\roms02004\ROMP02071 ;;;Assign lpt3 to a plotter network port

timeout 10 ;;;Nice thing to have a delay to reach the plotter or printer before anybody messes up your papers; can be found on the 'net because no longer comes with either XP or 7, it was in the 2k

copy /b d:\acadtemp\plot\PLOTTER\*.plt lpt3 ;;;The copy job

net use lpt3 /delete ;;;Freeing the lpt3.

I know it's dirty but it gets the job done. The folder with plt files should not reside in the "my Documents"  or "desktop" anything that has something to do with active directory and "documents and settings", don't ask me why I found out the hard way.

Good luck,
v.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #55 on: August 25, 2010, 03:32:40 PM »
Hi guys,

Once again I thank you for all the information you have posted in this thread - it is truly appreciated and I have learnt a great deal.

>> IMO you are making this WAY to difficult. This is a shorty program; this should only take you a few minutes to code up if its just for your use. I would a lot myself maybe a half an hour for coding, and testing (to make sure i didn't launch any rockets).

Think about it from someone who is stumbling in the dark - yes its only a few lines of code, but I want to make sure that I completely understand the procedure and all possible consequences before I go ahead and experiment (for obvious reasons). Please bear in mind that I have used very very few DOS commands and have little to no experience in this area.

Anyway, back to the issue at hand, here is today's update:

I tried a multitude of methods today, all involving the DOS copy function, all of which did not throw an error, but also unfortunately did not print anything either, the jobs were not added to the print queue at all.

<EDIT: forget my crap code - forgot to use the strcat function... me = idiot with lack of sleep ... will try again tomorrow - thanks for your patience >
« Last Edit: August 25, 2010, 03:37:39 PM by Lee Mac »

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #56 on: August 26, 2010, 12:24:56 AM »
Lee, we are all stumbling in the dark.  And as for `completely understanding all the possible consequences' goes, you are just starting down a rabbit hole and i told you that already.

Printing is a very difficult task; most people think its easy because all they do is hit the little print button in the application they are using. Now, you are discovering that even getting a file to a plotter is difficult (you will learn more very soon).


BTW, do you understand "net use LPT# ..." is machine specific and will NOT harm other workstations on your network?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Vali

  • Mosquito
  • Posts: 9
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #57 on: August 26, 2010, 04:12:39 AM »
Of course it's machine specific, but for whatever reason it could be assigned from a previous print job or other data transfer (data collector or virtual LPT for USB, only Windoze knows) and I want to be sure I don't copy somewhere into the ughnown.

I'm not an expert, I just assumed that starting with it fresh will save some head scratching, it works for me so I don't intend to fix it.

Regards,
v.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #58 on: August 26, 2010, 07:57:21 AM »
Printing is a very difficult task; most people think its easy because all they do is hit the little print button in the application they are using.

IMO you are making this WAY to[sic] difficult. This is a shorty program; this should only take you a few minutes to code up if its just for your use.

Errr...

BTW, do you understand "net use LPT# ..." is machine specific and will NOT harm other workstations on your network?

Yes, I understood what you posted about it being like a 'shortcut' from one computer to the network port.



JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Re: Manipulating AdobeReader using Visual LISP Possible?
« Reply #59 on: August 26, 2010, 09:30:54 AM »
oh come on Lee, I was talking about the AutoLisp portion being simple...don't put words into my mouth.

TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org