Posted by Deborah Byrd on 12.Jul.05 at 11:15 AM using a Web browser Category: Domino DesignerRelease: 6.5.4Platform: Windows XP Ok, here's the pieces I use to go to adobe writer and then back to the default printer. I'll TRY and get all the pieces in here. I got them from some very wonderful person a few years ago, I just can't remeber who! :) Ok, in the declarations of a script library I have: Declare Function GetProfileString Lib "kernel32.dll" Alias "GetProfileStringA" ( _ Byval lpAppName As String, _ Byval lpKeyName As String, _ Byval lpDefault As String, _ Byval lpReturnedString As String, _ Byval nSize As Long ) As Long Declare Function WriteProfileString Lib "kernel32.dll" Alias "WriteProfileStringA" ( _ Byval lpszSection As String, _ Byval lpszKeyName As String, _ Byval lpszString As String ) As Long Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _ Byval hwnd As Long, _ Byval wMsg As Long, _ Byval wParam As Long, _ lparam As Long ) As Long Declare Sub SleepWin Lib "Kernel32.dll" Alias "Sleep" (Byval Milliseconds As Long) Const ok_info = 64 Const ok_excl = 48 Const yesno_excl = 52 Const ok_stop = 16 Then...in the script to change the printer: 'Set default printer to be Adobe Writer Dim szPrinter As String szPrinter = "Acrobat PDFWriter" On Error Goto ErrorHandler Const HWND_BROADCAST = &HFFFF Const WM_WININICHANGE = &H1A Const WM_SETTINGCHANGE = &H1A Dim rc As Long Dim slength As Long Dim SendCommand As String Dim oldprinter As String Dim t As Long Dim buffer As Variant buffer = Space(1024) Dim buflen As Long buflen = Len(buffer) rc = GetProfileString( "Devices", szPrinter, "", buffer, buflen ) Dim drivername As String Dim printerport As String t = Instr(buffer, ",") If t > 0 Then drivername = Left(buffer, t - 1 ) k = Instr(t + 1, buffer, "," ) If k > 0 Then printerport = Mid( buffer, t + 1, k - t - 1 ) End If Else Messagebox "You do not have the correct printer driver installed for this function. If the Adobe Acrobat PDFWriter Printer driver has been installed, please rename it to Acrobat PDFWriter." Exit Sub End If buffer = String(128, 0) slength = GetProfileString("Windows", "Device", "(error)", buffer, 128) OldPrinter = Left(buffer, slength) ' extract the returned string from the buffer If OldPrinter = "(error)" Then Print "Could not read information from WIN.INI." Else Print "Original Printer: " & OldPrinter End If buffer = Space(1024) buflen = Len(buffer) rc = GetProfileString( "PrinterPorts", szPrinter, "", buffer, buflen ) i = Instr(buffer, ",") If i > 0 Then drivername = Left(buffer, i - 1 ) k = Instr( i + 1, buffer, "," ) If k > 0 Then printerport = Mid( buffer, i + 1, k - i - 1 ) End If End If Dim newprinter As String newprinter = szPrinter & "," & drivername & "," & printerport rc = WriteProfileString( "windows", "Device", NewPrinter) rc = SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE,0,0) Call SleepWin(3000) ''''''''''''''''''''' I call Intelliprint after that and go through that whole thing, so I don't know what you'll have to do. After that's finished, I change it back to the default printer: 'change default printer back rc = WriteProfileString( "windows", "Device", OldPrinter) rc = SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE,0,0) Call SleepWin(3000) buffer = String(128, 0) slength = GetProfileString("Windows", "Device", "(error)", buffer, 128) NewPrinter = Left(buffer, slength) ' extract the returned string from the buffer If NewPrinter = "(error)" Then Print "Could not read information from WIN.INI." Else If NewPrinter = OldPrinter Then Print "Original Printer: " & OldPrinter Else While NewPrinter <> OldPrinter rc = WriteProfileString( "windows", "Device", OldPrinter) rc = SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE,0,0) Call SleepWin(3000) buffer = String(128, 0) slength = GetProfileString("Windows", "Device", "(error)", buffer, 128) NewPrinter = Left(buffer, slength) ' extract the returned string from the buffer Wend End If End If I hope this helps you! Deb ___________________________________________________ After you get your initial PDF created, you can use the Acrobat OLE objects to manipulate the pdf. I use the below code in Excel files to merge all of the pdf files in a directory into one file. This should give you a good start as to how to use the objects. HTH Option Explicit ' Original Author : A Round Table Solution ' E-Mail: info@aroundtablesolution.com ' Date : 08 March 1998 ' Description: JoinAllAcrobatDocsInDir ' This vb method uses IAC to join all PDF documents in a folder to a predetermined filename ' This method / function should be extended to suit the requirements ' of an organisation. ' Modified by: CEB 03/2001 Public Const PDF_WILDCARD = "*.pdf" Public Const JOIN_FILENAME = "proforma.pdf" Dim PDF_DIRECTORY As String Function JoinAllAcrobatDocsInDir(intFileCount) As Integer Dim i As Integer On Error GoTo Handler PDF_DIRECTORY = GetTmpPath & "PDF\" JoinAllAcrobatDocsInDir = 0 Dim AcroExchApp As Object, AcroExchPDDoc As Object, _ AcroExchInsertPDDoc As Object Dim strFileName As String, strPath As String Dim iNumberOfPagesToInsert As Integer, _ iLastPage As Integer Set AcroExchApp = CreateObject("AcroExch.App") Set AcroExchPDDoc = CreateObject("AcroExch.PDDoc") AcroExchApp.Show strPath = PDF_DIRECTORY strFileName = Dir(strPath + "1.pdf", vbNormal) AcroExchPDDoc.Open strPath + strFileName If intFileCount > 1 Then For i = 2 To intFileCount strFileName = Dir(strPath & i & ".pdf", vbNormal) iLastPage = AcroExchPDDoc.GetNumPages - 1 Set AcroExchInsertPDDoc = CreateObject("AcroExch.PDDoc") AcroExchInsertPDDoc.Open strPath + strFileName iNumberOfPagesToInsert = AcroExchInsertPDDoc.GetNumPages AcroExchPDDoc.InsertPages iLastPage, AcroExchInsertPDDoc, 0, iNumberOfPagesToInsert, True AcroExchInsertPDDoc.Close Next End If AcroExchPDDoc.Save &H1, strPath + JOIN_FILENAME AcroExchPDDoc.Close AcroExchApp.Exit Exit Function Handler: strError = "Error Number: " & Err.Number & vbNewLine & "Error Description: " & Err.Description & _ vbNewLine & "Source: MergePDF" JoinAllAcrobatDocsInDir = 1 Exit Function End Function