// STEP 2: Convert this WPF Visual to an XPS Document
MemoryStream lMemoryStream = new MemoryStream();
{
Package package = Package.Open(lMemoryStream, FileMode.Create);
XpsDocument doc = new XpsDocument(package);
XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(doc);
//Create PrintTicket for document and set its page size to the proper custom page size
PrintTicket printTicket = new PrintTicket();
//Set the page size to a custom 3.5" x 2.5" page
printTicket.PageMediaSize = new PageMediaSize(3.5 * 96.0, 2.5 * 96.0);
writer.Write(visual,printTicket);
doc.Close();
package.Close();
}
Subscribe to
Posts [Atom]