AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 04.11.2011, 17:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
palleagermark: Print images directly from AX without user interaction
Источник: http://palleagermark.blogspot.com/20...x-without.html
==============

I have written one other post on doing this by calling WinApi::ShellExecute directly, but here is a more elaborate sample using .NET.

The sample prints an image (in this case a TIFF image) to your default printer without prompting first. You need to add a reference to System.Printing in AX to use the sample.

static void PrintImage(Args _args)
{
System.Printing.PrintServer localPrintServer = new System.Printing.LocalPrintServer();
System.Printing.PrintQueue printQueue = System.Printing.LocalPrintServer::GetDefaultPrintQueue();
System.Diagnostics.Process printProcess = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo processStartInfo;
str arguments;
Filename fileName = @'C:\TESTFILE.TIF';
;

processStartInfo = printProcess.get_StartInfo();

processStartInfo.set_Verb("Print");
processStartInfo.set_FileName(@"C:\WINDOWS\System32\rundll32.exe");

arguments = @'C:\WINDOWS\System32\shimgvw.dll,ImageView_PrintTo /pt ';
arguments += @'"';
arguments += filename;
arguments += @'" ';
arguments += @'"';
arguments += ClrInterop::getAnyTypeForObject(localPrintServer.get_Name()) + @'\' + ClrInterop::getAnyTypeForObject(printQueue.get_Name());
arguments += @'" ';
arguments += @'"%3" "%4"';

processStartInfo.set_Arguments(arguments);

processStartInfo.set_UseShellExecute(false);

printProcess.Start();
printProcess.Close();
}



Источник: http://palleagermark.blogspot.com/20...x-without.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35
palleagermark: Print images directly to a printer with ShellExecute (in XP) Blog bot DAX Blogs 0 26.08.2009 17:05
Inside Dynamics AX 4.0: The Security Framework Blog bot DAX Blogs 0 31.10.2007 11:40

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 18:20.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.