单击按钮,然后打印PDF文件,而无需打开acrobat阅读器。如何在VB.net 2013中做到这一点?
以下代码有效,但首先打开acrobat reader然后打印。
Dim proc As Process = Process.Start("AcroRd32.exe", _
String.Format("/N /T {0} ""{1}""", _
"C:\Path\to\201402124_label.pdf", "Brother QL-700")
答案 0 :(得分:0)
使用/h
开关将AcroRd32.exe <filename>
打开为最小化窗口。您可以在Adobe Developer FAQ doc中找到更多信息。
答案 1 :(得分:0)
你可以试试这个:(c#)
public static Boolean PrintPDFs(string pdfFileName)
{
try
{
Process proc = new Process();
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.Verb = "print";
//Define location of adobe reader/command line
//switches to launch adobe in "print" mode
proc.StartInfo.FileName = @"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe";
proc.StartInfo.Arguments = String.Format(@"/p /h {0}", pdfFileName);
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.Start();
proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
if (proc.HasExited == false)
{
proc.WaitForExit(10000);
}
proc.EnableRaisingEvents = true;
proc.Close();
KillAdobe("AcroRd32");
return true;
}
catch
{
return false;
}
}