manno
asked on
Central printing of multiple document types
I have to write a central printing engine which can combine Word docs, multi-page TIFs, and maybe HTM documents into a single print job. (We need to send each job to a staple/non-staple print, and maybe to a sheet feeder/enveloper).
One solution was to open an instance of Word and use VBA to paste in TIF pages etc. This worked OK but was a little slow. My boss is suggesting we do everything in HTML, converting our Word-template based system into standard HTML clauses which we assemble at runtime into one HTML file and print it.
I don't like this idea; anyone know of an ActiveX solution on the market, or perhaps just a few ideas about how I could code this myself?
One solution was to open an instance of Word and use VBA to paste in TIF pages etc. This worked OK but was a little slow. My boss is suggesting we do everything in HTML, converting our Word-template based system into standard HTML clauses which we assemble at runtime into one HTML file and print it.
I don't like this idea; anyone know of an ActiveX solution on the market, or perhaps just a few ideas about how I could code this myself?
Why dont you try this to print the pictures
Public Function PrintPictureToFitPage(Prn As Printer, _
Pic As Picture) As Boolean
' #VBIDEUtils#************** ********** ********** ********** *******
' * Programmer Name : Waty Thierry
' * Web Site : www.geocities.com/ResearchTriangle/6311/
' * E-Mail : waty.thierry@usa.net
' * Date : 13/10/98
' * Time : 09:18
' * Module Name : Capture_Module
' * Module Filename : Capture.bas
' * Procedure Name : PrintPictureToFitPage
' * Parameters :
' * Prn As Printer
' * Pic As Picture
' ************************** ********** ********** ********** *********
' * Comments : Prints a Picture object as
'big as possible
' *
' *
' ************************** ********** ********** ********** *****
Const vbHiMetric As Integer = 8
Dim PicRatio As Double
Dim PrnWidth As Double
Dim PrnHeight As Double
Dim PrnRatio As Double
Dim PrnPicWidth As Double
Dim PrnPicHeight As Double
On Error GoTo ErrorHandler
' *** Determine if picture should be printed in
'landscape or portrait and set the orientation
If Pic.Height >= Pic.Width Then
Prn.Orientation = vbPRORPortrait ' Taller than wide
Else
Prn.Orientation = vbPRORLandscape ' Wider than tall
End If
' *** Calculate device independent Width to Height
'ratio for picture
PicRatio = Pic.Width / Pic.Height
' *** Calculate the dimentions of the printable
'area in HiMetric
PrnWidth = Prn.ScaleX(Prn.ScaleWidth, Prn.ScaleMode, vbHiMetric)
PrnHeight = Prn.ScaleY(Prn.ScaleHeight , Prn.ScaleMode, vbHiMetric)
' *** Calculate device independent Width to Height
'ratio for printer
PrnRatio = PrnWidth / PrnHeight
' *** Scale the output to the printable area
If PicRatio >= PrnRatio Then
' *** Scale picture to fit full width of printable area
PrnPicWidth = Prn.ScaleX(PrnWidth, vbHiMetric, _
Prn.ScaleMode)
PrnPicHeight = Prn.ScaleY(PrnWidth / PicRatio, _
vbHiMetric, Prn.ScaleMode)
Else
' *** Scale picture to fit full height of printable area
PrnPicHeight = Prn.ScaleY(PrnHeight, vbHiMetric, _
Prn.ScaleMode)
PrnPicWidth = Prn.ScaleX(PrnHeight * PicRatio, _
vbHiMetric, Prn.ScaleMode)
End If
' *** Print the picture using the PaintPicture method
Prn.PaintPicture Pic, 0, 0, PrnPicWidth, PrnPicHeight
PrintPictureToFitPage = True
Exit Function
ErrorHandler:
PrintPictureToFitPage = False
End Function
Public Function PrintPictureToFitPage(Prn As Printer, _
Pic As Picture) As Boolean
' #VBIDEUtils#**************
' * Programmer Name : Waty Thierry
' * Web Site : www.geocities.com/ResearchTriangle/6311/
' * E-Mail : waty.thierry@usa.net
' * Date : 13/10/98
' * Time : 09:18
' * Module Name : Capture_Module
' * Module Filename : Capture.bas
' * Procedure Name : PrintPictureToFitPage
' * Parameters :
' * Prn As Printer
' * Pic As Picture
' **************************
' * Comments : Prints a Picture object as
'big as possible
' *
' *
' **************************
Const vbHiMetric As Integer = 8
Dim PicRatio As Double
Dim PrnWidth As Double
Dim PrnHeight As Double
Dim PrnRatio As Double
Dim PrnPicWidth As Double
Dim PrnPicHeight As Double
On Error GoTo ErrorHandler
' *** Determine if picture should be printed in
'landscape or portrait and set the orientation
If Pic.Height >= Pic.Width Then
Prn.Orientation = vbPRORPortrait ' Taller than wide
Else
Prn.Orientation = vbPRORLandscape ' Wider than tall
End If
' *** Calculate device independent Width to Height
'ratio for picture
PicRatio = Pic.Width / Pic.Height
' *** Calculate the dimentions of the printable
'area in HiMetric
PrnWidth = Prn.ScaleX(Prn.ScaleWidth,
PrnHeight = Prn.ScaleY(Prn.ScaleHeight
' *** Calculate device independent Width to Height
'ratio for printer
PrnRatio = PrnWidth / PrnHeight
' *** Scale the output to the printable area
If PicRatio >= PrnRatio Then
' *** Scale picture to fit full width of printable area
PrnPicWidth = Prn.ScaleX(PrnWidth, vbHiMetric, _
Prn.ScaleMode)
PrnPicHeight = Prn.ScaleY(PrnWidth / PicRatio, _
vbHiMetric, Prn.ScaleMode)
Else
' *** Scale picture to fit full height of printable area
PrnPicHeight = Prn.ScaleY(PrnHeight, vbHiMetric, _
Prn.ScaleMode)
PrnPicWidth = Prn.ScaleX(PrnHeight * PicRatio, _
vbHiMetric, Prn.ScaleMode)
End If
' *** Print the picture using the PaintPicture method
Prn.PaintPicture Pic, 0, 0, PrnPicWidth, PrnPicHeight
PrintPictureToFitPage = True
Exit Function
ErrorHandler:
PrintPictureToFitPage = False
End Function
ASKER
Thanks N Nayaranan but I don't think this code is relevant.
On the other hand maybe I _could_ use a combination of containers and use the VB Print method...
On the other hand maybe I _could_ use a combination of containers and use the VB Print method...
ASKER
Points increased from 100
ASKER
We need to take an RTF file with bookmarks in it, replace these with database fields, and start a print job where we can append multi-page TIFFs. We also need to add OMR markings to each page. Finally we send the complete job to the printer.
Upping the points as I can't find a way of doing this.
Upping the points as I can't find a way of doing this.
uh why dont you just do this as a mail merge with access?
Hi manno,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Save as PAQ -- No Refund.
manno, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit. Explain why.
==========
DanRollins -- EE database cleanup volunteer
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Save as PAQ -- No Refund.
manno, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit. Explain why.
==========
DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER