Solved

pdf printing and providing filename

Posted on 2003-10-27
5
375 Views
Last Modified: 2010-05-01
Hello,

    I'm creating an application that needs the possiblity to generate PDF-files automatically without
    user interference.
    * Using "printing to the PDF-printer" doesn't allow my program to choose the new file/path so the user
       must deside every time.
    * Using the Acrobat Destiller works, but not for EXCEL files + I read somewhere that this is only for old
       versions of the Adobe PDF-writer.
    * I've allready tried some third-party software to, but nothing is sufficiant enough...

    can anyone help me with a link to a web-page or some example code on how to print to a pdf-file wich
    must be possible from Word/Excel (through automation) and must require NO user input.

thanx.
Bart
0
Comment
Question by:BartVergote
5 Comments
 
LVL 7

Expert Comment

by:_agj_
ID: 9625854
0
 
LVL 44

Accepted Solution

by:
bruintje earned 250 total points
ID: 9626154
title : print a PDF using the Acrobat Reader
source : http://www.planetpdf.com/mainpage.asp?WebPageID=90

description:
-----------
Option Explicit ' Force variable declaration
' Author : Karl De Abrew
' Company : A Round Table Solution
' Date : 30 November, 1998
' Description:
' This vb method uses the VB printer object and a command line call sourced from the Acrobat Developer FAQ to print a single PDF silently
' This method / function should be extended to suit the requirements
' of an organisation

Sub PrintAPDFUsingTheFreeAcrobatReader()

Dim strCommandLine As String
Dim strPrinterName As String
Dim strDriverName As String
Dim strPortName As String
Dim strFileNameToPrint As String

strFileNameToPrint = "c:\temp\filetoprint.pdf"

strPrinterName = Printer.DeviceName
strDriverName = Printer.DriverName
strPortName = Printer.Port

' Perform some error checking here
strCommandLine = "c:\acrobat3\reader\AcroRd32.exe /t """ + _
strFileNameToPrint + """ """ + _
strPrinterName + """ """ + _
strDriverName + """ """ + _
strPortName + """" 

If (Shell(strCommandLine, vbHide) <> 0)Then
MsgBox "Job has been sent to the printer using the command " + strCommandLine
End If
End Sub
-----------

hope this helps a bit
0
 
LVL 8

Expert Comment

by:ampapa
ID: 9633131
Do you have the full version of Acrobat? or are you just using Distiller?
0
 
LVL 1

Author Comment

by:BartVergote
ID: 9633728
I Use a full version of Acrobat.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now