views:

238

answers:

0

Hi, I am using a derived class of DocumentPaginator for generating reports in WPF, But I have problem with fonts I am using a special font which should be embedded into the document otherwise the XpsDocumentWriter will convert the text to image automatically and it doesn't look good when printing in high dpi modes.

I have searched a lot and the only thing that I found regarding embedding fonts in a XPS document is using IXpsFixedPageWriter here. and it works fine except that I cannot use it in my paginator because the only thing that I have in GetPage method is a DocumentPage which doesn't have alot.

XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(doc);

IXpsFixedDocumentSequenceWriter xdSW = doc.AddFixedDocumentSequence();
IXpsFixedDocumentWriter xdW = xdSW.AddFixedDocument();            
IXpsFixedPageWriter xpW = xdW.AddFixedPage();
string fontURI=AddFontResourceToFixedPage(xpW, @"C:\Windows\Fonts\LOTU__SF.TTF");

What I actually need is a way to use the writer object to write a visual in to the document after adding the font like this

writer.Write(myTemplateControl);

but I cannot use this method because the document already has added FixedDocumentSequence I really don't know what else should I do I searched a week but found nothing

Any help would be appreciated