0
私はC#アプリケーションから特定のプリンタ設定でpdfを印刷する必要があります。そのため、プリンタは画像圧縮に最適な品質を、パターンオプションには細かい設定を、解像度としては600 dpiを使用する必要があります。現在C#アプリケーションの印刷ジョブに特定の印刷設定を使用するにはどうすればよいですか?
私はPrintParamsで、これらの値を設定しようとするが、結果は、私は、プリンタの設定GUIを使用して手動で値を設定したときと同じではありません。
これらの値を設定する方法はありますか?
using (Document doc = new Document(fi.FullName))
{
if (doc != null)
{
Console.WriteLine("created print document object with given pdf");
}
using (PrintUserParams userParams = new PrintUserParams())
{
if (userParams != null)
{
Console.WriteLine("created user parameters for printing");
}
userParams.PrintParams.BinaryOK = false;
userParams.StartPage = 0;
userParams.EndPage = doc.NumPages;
Console.WriteLine(string.Format("document contains {0} pages", doc.NumPages));
userParams.NCopies = 1;
userParams.ShrinkToFit = false;
userParams.PrintParams.ShrinkToFit = false;
userParams.PrintParams.ExpandToFit = false;
userParams.DeviceName = printerName;
userParams.PrintParams.BitmapResolution = 600;
userParams.PrintParams.OptimizeForSpeed = false;
userParams.PrintParams.FlattenInfoExternalDPI = 600;
userParams.PrintParams.GradientResolution = 600;
userParams.PrintParams.UseFullResolutionJP2KData = false;
doc.Print(userParams, null);
Console.WriteLine(string.Format("document {0} has been sent to printer {1}", fi.FullName, printerName));
}
}