Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
|
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 7th, 2010, 08:55 AM
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:
\\my_server_name\Adobe_PDF9

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

<%@ Language=VBScript %>
<% Option Explicit
'
Dim objFS, objWSHNet, objPrinter
'
%>
...
<body>
<%
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)
objPrinter.Write("Hello")
On Error Resume Next
objPrinter.Close
'
objWSHNet.RemovePrinterConnection "Desktop\*.pdf:"
Set objWSHNet = Nothing
Set objFS = Nothing
Set objPrinter = Nothing
%>
<div align="center">
&nbsp;<p>&nbsp;</p>
<p>
<button onclick="window.print()">Click to Print</Button></p>
<p>&nbsp;</td>
</div>
</body>

The message of error is:
Invalid network adress ...
Reply With Quote
  #2 (permalink)  
Old April 19th, 2010, 06:40 AM
Authorized User
 
Join Date: Sep 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Sorry,

is there anyone who can help me or suggest me an idea ??

Thanks !!!
Reply With Quote
  #3 (permalink)  
Old June 28th, 2010, 02:16 PM
Authorized User
 
Join Date: May 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I believe the issue that you are experiencing is that an Adobe virtual printer, although can be shared in Windows, cannot be used by a remote client because that application is not actually installed on the client (DLLs, Registry, etc).

Depending on what needs to happen under the hood, something like a ActiveX PDF Generator or a .NET PDF library come to mind, or automating the "print" button sub routine to create the PDF in a temp folder and repost the web page as the src.
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Close Adobe after printing PDF file BoardBabe Access VBA 5 October 11th, 2011 05:26 PM
Populate Adobe PDF with html form data bfoley Classic ASP Basics 4 January 17th, 2008 09:44 AM
Adobe Flex Variables HankS Flash (all versions) 5 August 30th, 2007 06:00 PM
Suppressing 'Creating Adobe PDF' dialog zorb Access VBA 1 October 13th, 2004 06:56 AM
Creating Adobe PDF files from VBA baNTON Access VBA 3 March 11th, 2004 02:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.