Any event for every printed page?
In WPF, using PrintDialog
and FixedDocument
, is there an event (or in some other way) to get notified when every page is printed?
Detail
My Fargo printer has a Magstripe sensor so it can encode magnetic data on cards in addition to standard raster printing. For magnetic encoding, I need to use the Fargo SDK and call some functions with specific formatted track data to be encoded.
Let's say I have a FixedDocument
containing raster data for 20 maps. I am posting this document to WPF Print Engine with PrintDialog.PrintDocument()
. Here's the problem. I need to call the magnetic encoding functions after each card is printed, but apparently there is no way to get a notification (something like an event PrintPage
) that I can intercept and call the SDK functions in it.
Unlike the WinForms print engine where the PrintPage
event is fired and we compose our result in that event using GDI +.
Is there a way to get notified after every page is printed FixedDocument
?
source to share
Think for yourself. It looks like magnetic printers (or at least the Fargo printer I have) have items TextBlock
that have magstripe data in a property Text
as a special case. Instead of sending them as normal bitmap output, they are sent to a magnetic encoder to be written to magnetic tape. For example, if yours TextBlock
looks like this:
<TextBlock Text="~1%DATA?" />
<TextBlock Text="~2;DATA?" />
<TextBlock Text="~3;DATA?" />
this will be sent to a tape encoder instead of a raster printer. Pay attention to the specific symbols that need to be added and added for each track (tracks 1, 2 and 3, respectively). In addition, there is a specific list of symbols that are allowed for each track. More information can be found on this wiki page .
This way, WPF developers can use standard WPF (and even MVVM) methods to print tape recorder cards using classes PrintDialog
and FixedDocument
without requiring an event PrintPage
.
source to share