Mike,
Unfortunately I am not familiar with neither pdftypewriter
nor primopdf. I need to print reports (programmatically)
and specify the file name in code. The only way I could
find at the time was to use Adobe PDFWriter driver and
then manually change the registry just before printing in:
Current_User\Software\Adobe\Acrobat PDFWriter
by setting
PDFFilename to the fileName and
bExecViewer to 0
if you know of a simpler way of specifying the fileName
destination of the report exporting to .pdf format, I
would appreciate a bit of code.
Here is some of the VBA code I use in a Word document to print it, using
the methods and properties of PdfDistiller. I have deleted substantial
parts of the code which was relevant to my task. I hope there's enough
left to show you how to print programmatically to a named PDF file.
As to your original question: you probably need to tell Distiller to
include certain fonts; probably in .joboptions .
Option Explicit
Sub Client_Reporting()
' Requires a Reference to "Acrobat Distiller" (ACRODIST.EXE)
Dim myDocument As String ' Active Document Name
Dim myFilename As String ' Report Filename
Dim theFolder As String ' The file's directory
Dim myPath As String ' Path to Report Files
Dim myPDF As New PdfDistiller ' Class PDFDistiller
Dim oldPrinter As String ' Save the old default
printer
oldPrinter = ActivePrinter ' Save the old default printer
' The next would change the System Default Printer; we don't want that.
'ActivePrinter = "Acrobat Distiller"
' Select a printer without changing the system default printer:
With Dialogs(wdDialogFilePrintSetup)
.Printer = "Acrobat Distiller"
.DoNotSetAsSysDefault = True
.Execute
End With
' This is the guts of it: PrintToFile a PS file with Distiller ...
Application.PrintOut OutputFileName:=myPath & myFilename & ".ps", _
PrintToFile:=True, Background:=False
' ... and convert it to PDF.
myPDF.FileToPDF myPath & myFilename & ".ps", "", theFolder & _
"\eBook-WebReports.joboptions"
Documents(myDocument).Close SaveChanges:=False
'ActivePrinter = oldPrinter ' Would restore previous default printer
' Select a printer without changing the system default printer:
With Dialogs(wdDialogFilePrintSetup)
.Printer = oldPrinter
.DoNotSetAsSysDefault = True
.Execute
End With
' Restore "PrintToFile" back to false by printing nothing!
' See:
http://www.mvps.org/word/FAQs/MacrosVBA/ResetPrintToFile.htm
Application.PrintOut Range:=wdPrintRangeOfPages, Pages:="0", _
PrintToFile:=False
' Delete PS files
With Application.FileSearch
.NewSearch
.LookIn = theFolder
.SearchSubFolders = False
.FileName = "*.ps"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
.Execute
If .FoundFiles.Count > 0 Then
Kill theFolder & "*.ps"
End If
End With
Exit Sub