Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
krekeg  
#1 Posted : Sunday, June 05, 2005 9:25:00 PM(UTC)
krekeg

Rank: Member

Groups: Member
Joined: 3/2/2005(UTC)
Posts: 13

I'm attempting to print some images using the ImagePrintDocumet.PlacementMode.MultipleImages routine.

How do I get it to add footer text to each image?
Alex Kon  
#2 Posted : Monday, June 06, 2005 1:27:00 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups:
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hi, krekeg.

First of all:
Code:
ImagePrintDocument printDoc = new ImagePrintDocument;
printDoc.PrintOptions.FooterEnabled = true;

After that you may use one of the following ways:

1. Set PrintPlaceholder object(s) as ImagePrintDocument.Source property value. PrintPlaceholder object has Footer and Header properties which you can modify:
Code:
PrintPlaceholder[] source = new PrintPlaceholder[10];
for (int i = 0; i < source.Length; i++)
{
	source[i] = new PrintPlaceholder();
	source[i].Footer = "Image N" + i.ToString();
	source[i].Image = GetBitmapFromSomewhere();
}

ImagePrintDocument printDoc = new ImagePrintDocument();
printDoc.Source = source.GetEnumerator();
printDoc.PlacementMode = PlacementMode.MultipleImages;
printDoc.PrintOptions.FooterEnabled = true;
printDoc.Print();


2. Alternative way - add event handler of ImagePrintDocument.QueryImage event and specify footer text there using QueryImageEventArgs.PrintPlaceholder.Footer property. Here is a small code snippet:
Code:
public class TestCase3
{
	private int _imagesCount;

	public void Launch()
	{
		ImagePrintDocument printDoc = new ImagePrintDocument();
		printDoc.PlacementMode = PlacementMode.MultipleImages;
		printDoc.PrintOptions.FooterEnabled = true;
		printDoc.QueryImage +=new QueryImageEventHandler(printDoc_QueryImage);
		
		_imagesCount = 0;
		printDoc.Print();
	}

	private void printDoc_QueryImage(object sender, QueryImageEventArgs e)
	{
		e.PrintPlaceholder.Image = GetBitmapFromSomewhere();
		e.PrintPlaceholder.Footer = "Image N" + _imagesCount.ToString();
		e.HasMoreImages = (_imagesCount++ < 10);
	}
}


By the way, upcoming version 3.1 of GraphicsMill for .NET includes PrintingSample. It demonstrates how to use ImagePrintDocument.PlacementMode.MultipleImages and how to add a footer.

Edited by user Sunday, December 23, 2007 6:17:52 PM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.