Dim RVal As Long
RVal = DC.StartPrinting
If (RVal <> 0) Then
MsgBox("Error while calling StartPrinting method!!!")
Exit Sub
End If
Dim MSWord As Object
MSWord = CreateObject("Word.Application")
MSWord.DisplayAlerts = False
'On Error Resume Next
Dim wordDoc
wordDoc = MSWord.Documents.Open("C:\Test.Doc", False, True)
If Err.Number <> 0 Then
MSWord = Nothing
DC.StopPrinting()
Exit Sub
End If
Dim MSWordDialog As Object
MSWordDialog = MSWord.Dialogs(97)
MSWordDialog.Printer = DC.NewPrinterName
MSWordDialog.DoNotSetAsSysDefault = 1
MSWordDialog.Execute()
wordDoc.PrintOut(False)
wordDoc.Close(False)
MSWord.Quit(False)
MSWord = Nothing
DC.DocumentResolution = 300
RVal = DC.Create ' Create output document
If (RVal <> 0) Then
MsgBox("Error while creating document!!!")
Exit Sub
End If
RVal = DC.StopPrinting
If (RVal <> 0) Then
MsgBox("Error while calling StopPrinting method!!!")
Exit Sub
End If
Me.OverwriteLogo() '覆盖最下面的logo
End Sub
问题是每个页面后面会有一个logo
我想办法把它盖住了
下载ABCPdf并安装,引用对应的DLL
Imports WebSupergoo.ABCpdf4
'因为使用docCreator这个组件,会在PDF的下放自动加上一个
'Logo,该函数的目的是覆盖掉该Logo.
Private Sub OverwriteLogo()
Dim gr As String = ""
gr = gr + "q " ' save state
gr = gr + "30 w " ' line width
'gr = gr + "[ ] 0 d " ' dash pattern
gr = gr + "80 20 m " ' move
gr = gr + "520 20 l " ' line
gr = gr + "1 1 1 RG " ' set color white
gr = gr + "S " ' stroke
gr = gr + "Q" ' restore state
Dim theDoc As Doc = New Doc
theDoc.Read("c:\demo1.pdf")
theDoc.Pos.String = "50 760"
theDoc.SetInfo(theDoc.FrameRect(), "stream", gr)
theDoc.Save("c:\new.pdf")
theDoc.Clear()