Hello,
I'm having some issues printing .htm / html files without the printer dialog being displayed and the user having to click the print button.
If I print a different file type e.g .txt or .jpg the print process completes successfully without any user interation.
Is there something special that needs to be done to allow html files to print without displaying the print dialog?
btw, I'm using the COM object in Delphi
Cannot Print .html files without displaying the print dialog
Moderator: jr
Re: Cannot Print .html files without displaying the print di
YES its posible print HTML Files without showing system print dialog.
You will need to install PrintHTML.exe file in your server and call it from code. You can download here: http://www.printhtml.com/
STEP 1: Set printing settings, such as, Output File Name, Author, Subject, etc.
STEP 2: Call PrintHTML.exe
Sample (VB.NET):
Try
Dim objPDF_Settings As New Bullzip.PdfWriter.PdfSettings
'// STEP 1
With objPDF_Settings
.PrinterName = "Bullzip PDF Printer"
.SetValue("Author", "xxx")
.SetValue("Title", "xxx")
.SetValue("Subject", "xxx")
.SetValue("Output", [YOUR_PDF_PATH_FILE_NAME])
.SetValue("ShowSettings", "never")
.SetValue("ShowSaveAS", "never")
.SetValue("ShowProgress", "no")
.SetValue("ShowProgressFinished", "no")
.SetValue("ShowPDF", "no")
.SetValue("ConfirmOverwrite", "no")
.SetValue("RememberLastFileName", "no")
.SetValue("RememberLastFolderName", "no")
.SetValue("SuppressErrors", "no")
.SetValue("Linearize", "yes")
.WriteSettings()
'/* STEP 2
Dim objProcess As New System.Diagnostics.Process
With objProcess
.StartInfo.FileName = "PrintHTML.exe"
.StartInfo.Arguments = "file=" & Chr(34) & [YOUR_HTML_FILE_NAME] & Chr(34) & " " & _
"printername=" & Chr(34) & "Bullzip PDF Printer" & Chr(34)
.Start()
.WaitForExit()
.Close()
End With
End With
Catch ex As Exception
End Try
I hope this solve your problem
Regards from Spain
You will need to install PrintHTML.exe file in your server and call it from code. You can download here: http://www.printhtml.com/
STEP 1: Set printing settings, such as, Output File Name, Author, Subject, etc.
STEP 2: Call PrintHTML.exe
Sample (VB.NET):
Try
Dim objPDF_Settings As New Bullzip.PdfWriter.PdfSettings
'// STEP 1
With objPDF_Settings
.PrinterName = "Bullzip PDF Printer"
.SetValue("Author", "xxx")
.SetValue("Title", "xxx")
.SetValue("Subject", "xxx")
.SetValue("Output", [YOUR_PDF_PATH_FILE_NAME])
.SetValue("ShowSettings", "never")
.SetValue("ShowSaveAS", "never")
.SetValue("ShowProgress", "no")
.SetValue("ShowProgressFinished", "no")
.SetValue("ShowPDF", "no")
.SetValue("ConfirmOverwrite", "no")
.SetValue("RememberLastFileName", "no")
.SetValue("RememberLastFolderName", "no")
.SetValue("SuppressErrors", "no")
.SetValue("Linearize", "yes")
.WriteSettings()
'/* STEP 2
Dim objProcess As New System.Diagnostics.Process
With objProcess
.StartInfo.FileName = "PrintHTML.exe"
.StartInfo.Arguments = "file=" & Chr(34) & [YOUR_HTML_FILE_NAME] & Chr(34) & " " & _
"printername=" & Chr(34) & "Bullzip PDF Printer" & Chr(34)
.Start()
.WaitForExit()
.Close()
End With
End With
Catch ex As Exception
End Try
I hope this solve your problem
Regards from Spain