Print pdf or tif? can't do either so it can't help me!
I want to use mail print to auto-print incoming faxes (converted to email attachments). But it doesn't work with pdf files (I don't have full Acrobat and can't afford to buy it) and it doesn't work with multi-page tif files. This means that as far as I'm concerned it doesn't work at all!
Which is a shame.
At least I'm glad its trialware!
If there is a solution I'd be grateful to know about it.
8th Sep 2004
Yes we are aware of both of these issues, Windows versions before XP had an internal TIF viewer which works quite well with Mail Print for printing these files but it has been removed from XP and future versions. We are planning to extend our own handler in a future release.
PDF printing is trickier in some ways because Acrobat is so poor at automation, we will probably look at integrating with Ghostscript to handle PDF files.
9th Sep 2004
Thanks for your reply. I guess that's our 24 hour fax service plan gone out of the window for now!
I would be interested to know if you get either the tif or pdf options working without requiring further expensive software.
We use pdf995 but afaik it can only create pdfs, not print them.
However I wrote code which successfully prints pdf files that are saved on the computer, but using some freeware code (credited below) written by someone else to extract a value from the registry. This is written in VBA and it works! Maybe you could use a similar process (suitably adapted of course)?
Regards
Dominic
Private Sub PrintPDFFiles(strFileList As String)
'Prints a list of pdf files separated by semi-colons to the default printer using Adobe Acrobat Reader
'should work at least for reader version 5 & 6, but will fail if Acrobat Reader is not installed
Dim strAcrobatPrintCommand As String, intInsertPos As Integer, i As Integer, j As Integer
strAcrobatPrintCommand = regQuery_A_Key(HKEY_LOCAL_MACHINE, "SOFTWAREClassesAcroExch.DocumentshellPrintcommand", "")
If strAcrobatPrintCommand = "" Then Exit Sub 'fail silently
intInsertPos = InStr(1, strAcrobatPrintCommand, "%1")
Do
i = Minstr(j + 1, strFileList, ";")
If j = i Then Exit Do
Shell Left$(strAcrobatPrintCommand, intInsertPos - 1) & Mid$(strFileList, j + 1, i - j - 1) & Mid$(strAcrobatPrintCommand, intInsertPos + 2), vbMinimizedNoFocus
j = i
Loop
End Sub
Public Function Minstr(ByVal startpos As Integer, ByVal SearchThrough As String, SearchFor As String, Optional Compare As Variant) As Integer
'This is just like Instr() except that instead of returning 0 if string is
'not found it returns Len(String)+1, and you cannot skip the start position parameter
'It's an incredibly useful function!
Dim x As Integer
If IsMissing(Compare) Then Compare = 0
x = InStr(startpos, SearchThrough, SearchFor, Compare)
If x = 0 Then x = Len(SearchThrough) + 1
Minstr% = x
End Function
Public Function regQuery_A_Key(ByVal lngRootKey As Long, _
ByVal strRegKeyPath As String, _
ByVal strRegSubKey As String) As Variant
' --------------------------------------------------------------
' Written by Kenneth Ives kenaso@home.com
'
' Important: If you treat all key data strings as being
' case sensitive, you should never have a problem.
' Always backup your registry files (System.dat
' and User.dat) before performing any type of
' modifications
'
' Description: Function for querying a sub key value.
'
' Parameters:
' lngRootKey - HKEY_CLASSES_ROOT, HKEY_CURRENT_USER,
' HKEY_lOCAL_MACHINE, HKEY_USERS, etc
' strRegKeyPath - is name of the key path you wish to traverse.
' strRegSubKey - is the name of the key which will be queryed.
'
' Syntax:
' strKeyQuery = regQuery_A_Key(HKEY_CURRENT_USER, _
' "SoftwareAAA-Registry TestProducts", _
"StringTestData")
'
' Returns the key value of "StringTestData"
' --------------------------------------------------------------
' --------------------------------------------------------------
' Define variables
' --------------------------------------------------------------
Dim intPosition As Integer
Dim lngKeyHandle As Long
Dim lngDataType As Long
Dim lngBufferSize As Long
Dim lngBuffer As Long
Dim strBuffer As String
' --------------------------------------------------------------
' Initialize variables
' --------------------------------------------------------------
lngKeyHandle = 0
lngBufferSize = 0
' --------------------------------------------------------------
' Query the key path
' --------------------------------------------------------------
m_lngRetVal = RegOpenKey(lngRootKey, strRegKeyPath, lngKeyHandle)
' --------------------------------------------------------------
' If no key handle was found then there is no key. Leave here.
' --------------------------------------------------------------
If lngKeyHandle = 0 Then
regQuery_A_Key = ""
m_lngRetVal = RegCloseKey(lngKeyHandle) ' always close the handle
Exit Function
End If
' --------------------------------------------------------------
' Query the registry and determine the data type.
' --------------------------------------------------------------
m_lngRetVal = RegQueryValueEx(lngKeyHandle, strRegSubKey, 0&, _
lngDataType, ByVal 0&, lngBufferSize)
' --------------------------------------------------------------
' If no key handle was found then there is no key. Leave.
' --------------------------------------------------------------
If lngKeyHandle = 0 Then
regQuery_A_Key = ""
m_lngRetVal = RegCloseKey(lngKeyHandle) ' always close the handle
Exit Function
End If
' --------------------------------------------------------------
' Make the API call to query the registry based on the type
' of data.
' --------------------------------------------------------------
Select Case lngDataType
Case REG_SZ: ' String data (most common)
' Preload the receiving buffer area
strBuffer = Space(lngBufferSize)
m_lngRetVal = RegQueryValueEx(lngKeyHandle, strRegSubKey, 0&, 0&, _
ByVal strBuffer, lngBufferSize)
' If NOT a successful call then leave
If m_lngRetVal <> ERROR_SUCCESS Then
regQuery_A_Key = ""
Else
' Strip out the string data
intPosition = InStr(1, strBuffer, Chr(0)) ' look for the first null char
If intPosition > 0 Then
' if we found one, then save everything up to that point
regQuery_A_Key = Left(strBuffer, intPosition - 1)
Else
' did not find one. Save everything.
regQuery_A_Key = strBuffer
End If
End If
Case REG_DWORD: ' Numeric data (Integer)
m_lngRetVal = RegQueryValueEx(lngKeyHandle, strRegSubKey, 0&, lngDataType, _
lngBuffer, 4&) ' 4& = 4-byte word (long integer)
' If NOT a successful call then leave
If m_lngRetVal <> ERROR_SUCCESS Then
regQuery_A_Key = ""
Else
' Save the captured data
regQuery_A_Key = lngBuffer
End If
Case Else: ' unknown
regQuery_A_Key = ""
End Select
' --------------------------------------------------------------
' Always close the handle in the registry. We do not want to
' corrupt these files.
' --------------------------------------------------------------
m_lngRetVal = RegCloseKey(lngKeyHandle)
End Function
9th Sep 2004
Dominic,
This is pretty much the mechanism we use and to some extent it works with Reader but unfortunately it isn't 100% reliable. Even Adobe refuse to support this method of printing.
9th Sep 2004
Can you please put in a concise manner - is it possible to print pdf if there is a full version of Acrobat? and what about tif files?
9th Sep 2004
Yes if you have the full version of Acrobat you can print PDF files, if you have Windows 2000 or earlier then you can use the Kodak Imaging application to automatically print multi page TIFF files. If you have XP then you can only print single page TIF files.
10th Sep 2004
Thanks!!
10th Sep 2004
Thanks for your earlier reply Tony. We have found our code to be 100% reliable with Acrobat Reader, but even 99% would be better than nothing - whereas Mail Print does not work at all (I find) with Acrobat Reader.
Please let me know if you find a solution. Meantime I have uninstalled Mail Print.
20th Sep 2004
It might be if you can't get it to work at all that you have the COM handling enabled in the options in Mail Print, this option only works with the full version of Acrobat. Disable it to use the Reader to print.
If this isn't the case then does Mail Print give you an error message in the window when you try and print a PDF file?
20th Sep 2004
Still looking for the ability to print .TIF attachments. I see it's been 2 years without any results. Will this ever work? This will be a great product if it is fixed.
5th Sep 2006
Mark,
If you are using Windows XP SP2 turn off the internal handler in the options and tiff printing works fine.
If you aren't using XP then make sure you have the current release as there have been many enhancements to the tiff library.
6th Sep 2006
I am also having the same problem of printing Tif files from PDF attachments. I have XP SP2. Could plz you tell me how to turn off the internal handler and which option button are you referring to. Make it a bit more specific and detailed. Thanks very much.
24th Oct 2007
The options button is on the toolbar. Then look in the images tab.
24th Oct 2007
