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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 13.09.2011, 23:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,488 / 846 (79) +++++++
Регистрация: 28.10.2006
palleagermark: Querying printer queues from X++
Источник: http://palleagermark.blogspot.com/20...es-from-x.html
==============

For a client we need to print a page of an X++ report and then some attached files, like PDF or Word documents.

We need all the connected documents to be printed in one batch and we must not print the next X++ page before the attached documents are printed.

So we need to figure out if the shell and the printer are finished printing the attached documents before sending the next document from AX.

Luckily we can use the .NET library System.Printing to query the queue and in particular we can call the NumberOfJobs to figure out if the attached documents have been printed.

Here's a few bits of code for querying the printer queues:

System.Printing.PrintServer printServer
= new System.Printing.LocalPrintServer();
System.Printing.PrintQueueCollection printQueueCollection
= printServer.GetPrintQueues();
System.Printing.PrintQueue printQueue;
System.Collections.IEnumerator enumerator;
;

// Print the local server name
print printServer.get_Name();

// Enumerate and print names of all the queues on the server
enumerator = printQueueCollection.GetEnumerator();

while (enumerator.MoveNext())
{
printQueue = enumerator.get_Current();
print printQueue.get_FullName();
}

// Get information for a particular print queue
printQueue = new System.Printing.PrintQueue(printServer,
"HP Color LaserJet 5550 PS");

print printQueue.get_Description();
print printQueue.get_NumberOfJobs();
print ClrInterop::getAnyTypeForObject(printQueue.get_IsBusy());
print ClrInterop::getAnyTypeForObject(printQueue.get_IsPrinting());

pause;

In AX 2012 I would probably have placed the supporting code in a Visual Studio project rather than calling these CLR objects from X++.</div>


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

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
palleagermark: Convert an image from one format to another from AX Blog bot DAX Blogs 0 22.01.2010 15:05
palleagermark: Print images directly to a printer with ShellExecute (in XP) Blog bot DAX Blogs 0 26.08.2009 17:05
palleagermark: Sample union query from AX 2009 Blog bot DAX Blogs 0 11.07.2008 20:05
palleagermark: Read data from other databases Blog bot DAX Blogs 5 11.06.2008 11:42
palleagermark: Spell checking from AX Blog bot DAX Blogs 0 04.04.2008 10:05

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

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

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