从某个文件夹打印pdf [英] Print a pdf from a certain folder

查看:93
本文介绍了从某个文件夹打印pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个初学者,所以请原谅我的无知......我想做的是在C#中制作一个程序,它将观察某个文件夹并自动打印出保存在其中的任何发票的两个副本。



到目前为止,当文件夹中添加了一个新文件时,我已经有了Filewatcher来引发事件,但我还没有打印过一个关于打印的文件然而。我想到使用打印到PDF程序将发票保存为PDF但如果像XPS这样的其他文件类型更容易打印,我就不会被困在PDF文件上。



对不起,我没有任何代码可以显示,但就像我说的,我甚至都不知道从哪里开始。



我真的很想有一个无声的打印,但它不一定是。我的主要问题是,你能让一个程序从一个目录C:\Print\Invoice1234.pdf打印一个文件



我试过用用于静音打印的foxit阅读器,但我甚至无法弄清楚如何从远处的文件夹打印任何文件。



每个人似乎都认为你应该知道如何打印东西,但我没有线索!



如果它有所不同我使用Microsoft VS Express 2013进行设置。



请帮忙初学者!感谢

I am a total beginner so please excuse my ignorance... What I am trying to do is make a program in C# that will "watch" a certain folder and automatically print out two copies of any invoice saved in it.

So far I've got the Filewatcher thing to raise an event when a new file is added to the folder, but I haven't got to square one on printing yet. I had in mind to use a "print to PDF" program to save the invoice as a PDF but I am not stuck on a PDF file if another file type like XPS is easier to print.

Sorry I don't have any code to show, but like I said I haven't even a clue where to start.

I'd really like to have a silent print but it wouldn't have to be. My main question is, can you make a program print a file from just a directory "C:\Print\Invoice1234.pdf"

I have tried to use foxit reader for a silent print but I can't even figure out how to print ANYTHING much less a file from a distant folder.

Everyone seems to assume you should know how to print things, but I don't have a clue!

If it makes any difference I am setting it up using Microsoft VS Express 2013.

Please help a beginner! THANKS

推荐答案

您的机器上是否有foxit阅读器? - 我可以想到很多方法(一般来说)



1)使用windows shell,设置'动词'来打印

2)使用互操作并直接与Windows假脱机程序对话

3)使用'PDFSharp'

4)使用Adobe Acrobat< = v9.0并指定命令行选项 - 如果Foxit有命令行选项,你可能可以调整下面链接中的代码来对Foxit做同样的事情



实际上,这个链接< a href =http://www.torres.at/pdf-printing-net/> asp.net pdf打印,没有弹出窗口,没有对话框自由职业者Martin Zeller - php java angularjs [ ^ ]涵盖1,3,4和另一个或两个选项



有专家和骗局 - 使用外部组件,即依赖与采用'较低级别方法'在(2)中 - 但是,(2)可能更稳定并且不会在您的机器上留下其他神器 - 就像僵尸进程中关闭/关闭



顺便说一句 - 我不认为xps比pdf更容易 - 只是你可能需要与'Word'进行互动(例如)(ugh)
is foxit reader all you have on your machine ? - I can think of a number of ways of doing this (in general)

1) with the windows shell, setting the 'verb' to print
2) using interop and talking to the windows spooler directly
3) using 'PDFSharp'
4) using Adobe Acrobat <= v9.0 and specifying command line options - you may be able to adapt the code from the link below to do the same with Foxit if Foxit has command-line options

Actually, this link asp.net pdf print, no popup, no dialog | Freelancer Martin Zeller - php java angularjs[^] covers 1,3,4 and another option or two

There are pro's and con's - using an external component ie dependency vs taking a 'lower level approach' as in (2) - but, (2) might be more 'stable' and not leave other 'artifacts' sitting around on your machine - like 'zombie' processes that havnt closed/shut down

btw - I dont think xps is easier than pdf - just you might need to interact with 'Word' for example (ugh)


这篇关于从某个文件夹打印pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆