[英]VB.net - print pdf file with printer with paper size
我正在構建一個應用程序,其主要功能是打印.pdf文件。 我搜索了很多東西,卻找不到我需要的東西,所以這是我的問題。
我想創建一種使用所選打印機和紙張尺寸打印.pdf文件的方法。 (我們有一個繪圖儀來自A0-A3圖紙),因此可以批量生產不同尺寸的產品。
Public Sub print_pdf(byval document as string, byval printer as string, byval size as string)
我發現了類似的帖子,但是..它是用c#
編寫的,我看不懂..我只對vb.net熟悉。
我們所有的PC都裝有acrobat閱讀器,但是是否有更好的打印方法? 我願意提出建議!
請幫助..我被卡住了!!
我也在c#
找到了此示例代碼
string path = "" <- your path here.
if (path.EndsWith(".pdf"))
{
if (File.Exists(path))
{
ProcessStartInfo info = new ProcessStartInfo();
info.Verb = "print";
info.FileName = path;
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
Process p = new Process();
p.StartInfo = info;
p.Start();
p.WaitForInputIdle();
System.Threading.Thread.Sleep(3000);
if (false == p.CloseMainWindow())
p.Kill();
}
}
從這篇文章。 有沒有辦法讓空閑直到打印隊列完成? 然后打印一個殺死進程?
您可以使用默認的PDF閱讀器,例如Acrobat或FoxitReader,打開文件然后打印,非常簡單。 這是C#代碼:
獲取您的PDF文件的完整路徑:
String fullpath =System.IO.Path.GetFullPath(@FilePath);
使用默認的PDF Reader打開它:
Process.Start(@fullpath);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.