PDA

View Full Version : سوال: پرینت فایل



shytonak
چهارشنبه 04 اسفند 1389, 14:33 عصر
دوستان من می خوام وقتی کاربر باتن پرینت رو فشار میده یه فایل pdf که آدرسشو به برنامه دادم رو پرینت بگیره.

mehranmsba
چهارشنبه 04 اسفند 1389, 16:07 عصر
دو راه داری:
استفاده از کمپوننت های PDF .
استفاده از آرگومان در برنامه Acrobar Reader :

AcroRd32.exe <filename>

The following switches are available:
/n - Launch a new instance of Reader ever if one is already open
/s - Don't show the splash screen
/o - Don't show the open file dialog
/h - Open as a minimized window
/p <filename> - Open and go straight to the print dialog
/t <filename> <printername> <drivername> <portname> - Print the file the specified printer.

shytonak
چهارشنبه 04 اسفند 1389, 16:23 عصر
ممنون دوست من
خودم با استفاده از کد زیر این مشکلو حل کردم.

printDocument1.DocumentName = Environment.GetFolderPath(Environment.SpecialFolde r.History) + s + ".pdf";
printDialog1.Document = printDocument1;
printDialog1.AllowPrintToFile = true;
printDialog1.AllowSelection = true;
printDialog1.AllowSomePages = true;
printDialog1.PrintToFile = true;
if (printDialog1.ShowDialog() == DialogResult.OK)
printDocument1.Print();