word文档转换为PDF文件格式的接口程序

TWW0704 2004-06-16 06:59:32
现在我要做word文档转换为PDF文件格式的接口程序,对文件转化我很陌生,请大伙们指教!!!谈谈实现方法、技术可行性和思路,谢谢!
...全文
241 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
vickyyu 2004-07-15
  • 打赏
  • 举报
回复
我有办法了
首先到http://neevia.com/index.htm下载Neevia docCreator并安装
在项目中引用docCreator.dll,在安装目录里

代码:(vb.net的,你自己修改吧)
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

Dim DC As New docCreator.docCreatorClass

DC.DocumentOutputFormat = "PDF"
DC.DocumentOutputName = "demo1"
DC.DocumentOutputPath = "c:\"
DC.PDFAutoRotatePage = "All"

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()


MsgBox("done")

End Sub
yzf01 2004-07-12
  • 打赏
  • 举报
回复
安装一个Adobe
devfan 2004-07-12
  • 打赏
  • 举报
回复
可以通过水晶报表生成PDF
vickyyu 2004-07-12
  • 打赏
  • 举报
回复
"word文档转换为PDF文件格式的接口程序"
我也在找这个解决方案啊,如果你有办法了就告诉我好吗?
qcbao 2004-06-24
  • 打赏
  • 举报
回复
顶一下
Davily 2004-06-24
  • 打赏
  • 举报
回复
我也不会,帮你顶

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧