打印到文件,没有类似于word宏的交互。 。净

时间:2014-08-10 19:47:37

标签: .net vb.net powershell automation

我正在尝试使用Microsoft Office Document Image Writer将图像自动打印到预先确定的文件名和位置,而无需用户交互。

我用word文档实现了这个     objWdDoc.PrintOut(PrintToFile:= True,OutputFileName:= sDestination& sFileName&“.tif”)

我还没有找到一个没有第三方软件的解决方案来“打印到文件”而没有弹出对话框。有.Net的任何建议吗? 我可以将图像加载到表单对象中,如果这样可以实现,或者只是传递文件位置。

我还尝试了shell命令,你发送打印动词,但需要手动输入文件名。

1 个答案:

答案 0 :(得分:0)

我明白了。

PrintDocument1.PrinterSettings.PrintToFile = True
PrintDocument1.PrinterSettings.PrintFileName = outTiff
PrintDocument1.Print()

然后使用PrintDocument1 PrintFile事件加载图像。

Dim newImage As Image = CType(mBitmap, Image)
e.Graphics.DrawImage(newImage, 5, 5)