I am developing a small program like point-of-sale based on WPF. In the program, I used UserControl to make shape of an Invoice. The FlowDocument would be converted into XPS document, and displayed into DocumentViewer. In Windows Vista, this works perfectly.
I tried to run the program on Windows XP SP3, but the application crashed, it seems that XP SP3 can not handle DocumentViewer. So I installed XPS Essentials Pack 1.1 to check if it solve the problem, but it isn't. I have tried searching on Google, but found
no solution. Is it the code that caused the problem? Or just missing components of target platform (WinXP SP3)?
The code used to print the UserControl:
public static FixedDocument GetFixedDocument(FrameworkElement toPrint, PrintDialog printDialog)
PrintCapabilities capabilities = printDialog.PrintQueue.GetPrintCapabilities(printDialog.PrintTicket);
Size pageSize = new Size(printDialog.PrintableAreaWidth, printDialog.PrintableAreaHeight);
Size visibleSize = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
FixedDocument fixedDoc = new FixedDocument();
toPrint.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
toPrint.Arrange(new Rect(new Point(0, 0), toPrint.DesiredSize));
Size size = toPrint.DesiredSize;
double yOffset = 0
View Complete Post