Adobe opens automatically when i try and fax a pdf!!

B

Ben Lam

i'm using the fxscomex.dll to fax a pdf document.


faxserver.Connect("Appleton")

faxdoc.Body = "temp.pdf"
faxdoc.Recipients.Add(txtBoxTo.Text.Trim)
faxdoc.CoverPageType = FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptSERVER
faxdoc.CoverPage = "generic"

faxdoc.Note = txtBoxNote.Text.Trim
faxdoc.Subject = txtBoxSubject.Text.Trim

faxID = faxdoc.Submit("Appleton")

after the submit line the pdf is rendered in Acrobat and remains open.
Is there something i need to set to NOT open Acrobat when i try and
fax the pdf?

Is there a way i can safely close that acrobat window from code?

thanks
ben
 
R

Richard Ehemann

Ben:

I had the same problem, only that Microsoft Word would open when I sent a rich
text file. The reason is that Microsoft Fax converts the document to a TIFF
before it sends it out. It opens the document based on association. Therefore,
Acrobat is started because it is associated with PDF's.

Word seemed to popup and then close itself down when it was done, but I guess
Microsoft Fax can't shutdown Acrobat on its own. I don't know how to stop this
behavior, so I just live with it.

I feel your pain!
Rich
 
B

Ben

hey rich, thanks for the response....

i was able to get a list of processes and figuring out through the
registry which program is used to print pdf files and i just loop
through each process matching the name of the process with the acrobat
exe name. When i find it, after i send the fax job, i kill the
process. I'm not too thrilled with this solution but it seems to
work. The limitation is that they have to close all instances of
adobe before they print/fax.

Also, for batch printing, it hangs because it tries to use the same
instance of acrobat used for the previous print job, but it can't
because the previous document is still open. A quick fix for that
would be to add a \n to the printto command for the .pdf in your
folder options\file types

hope this helps....
ben

here's some code snippits for you

' This is to loop through the processes and kill all adobe processes
adobeExe = GetAdobeExeName()

Dim processes() As Process
processes = Process.GetProcesses()

Dim i As Int16 = 0
For i = 0 To processes.Length - 1
If (processes(i).ProcessName.Trim() = adobeExe) Then
processes(i).Kill()
End If

Next


Private Function GetAdobeExeName() As String
Dim adobeExe As String = ""
Dim pdf As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(".pdf")

If (pdf Is Nothing) Then
' Adobe not installed
Return adobeExe
End If

Dim pdfExe As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(pdf.GetValue("").ToString
+ "\shell\printto\command\")
If pdfExe Is Nothing Then
' Adobe not installed
Return adobeExe
End If

Dim value As String = pdfExe.GetValue("").ToString

value = value.Substring(value.IndexOf("""") + 1,
value.IndexOf("""", 1) - 1)

adobeexe = System.IO.Path.GetFileName(value)

adobeExe = adobeExe.Substring(0, adobeExe.IndexOf("."))

Return adobeExe

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top