View Single Post
  #1 (permalink)  
Old April 7th, 2010, 08:55 AM
il_betto il_betto is offline
Authorized User
Join Date: Sep 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default AddPrinterConnection Adobe PDF

Hi to All,

I have this problem:

I have a page.asp, on my_server in intranet in which there is IIS vers. 5.1,

in this page there is a Print button and I want that, when the user-client clicks on it, it will start automatically the generation of the PDF-file of my page.asp

I think that in the code below there are some errors because I have in the server the printer Adobe PDF put with a Port Desktop\*.pdf and not LPT1

Then this "virtual and not physical" printer is shared in intranet with the connection-name: Adobe_PDF9 and the path of this printer is:

Can you help me please to correct the code below ??
Thanks a lot in advance !!!!

<%@ Language=VBScript %>
<% Option Explicit
Dim objFS, objWSHNet, objPrinter
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objWSHNet = CreateObject("WScript.Network")
objWSHNet.AddPrinterConnection "Desktop\*.pdf", "\\my_server_name\Adobe_PDF9"
Set objStampante = objFS.CreateTextFile("Desktop\*.pdf:", True)
On Error Resume Next
objWSHNet.RemovePrinterConnection "Desktop\*.pdf:"
Set objWSHNet = Nothing
Set objFS = Nothing
Set objPrinter = Nothing
<div align="center">
<button onclick="window.print()">Click to Print</Button></p>

The message of error is:
Invalid network adress ...
Reply With Quote