Many people have made the Silverlight version of the XPS browser, but many people are stuck in the XPS format output by the XPS printer, the results can only browse the XPS exported by office saveas, however, the XPS file output by the XPS printer is not recognized. Today, the output format of the XPS printer is incorrect.
When the XPS document is printed and output, the cause is as follows:
1. application. getresourcestream cannot marry anything because it lacks zippackagestreamresourceinfo
2. I used sharpzip to write the application. getresourcestream replacement method. The font should be reserved. When the XAML load is executed, an error of 0 rows and 0 columns will be reported.
Problem 1 is well solved
Find the open-source implementation of the Silverlight zip library, and then rewrite the application. getresourcestream method, similar:
Internal static streamresourceinfo getresourcestream (Stream stream, URI Path)
VaR result = application. getresourcestream (new system. Windows. Resources. streamresourceinfo (stream, null), PATH );
If (result! = NULL)
If (stream. Canread)
Zipfile = new zipfile (Stream );
Return (from zipentry entity in zipfile
Where entity. Name = path. tostring ()
Select extractfile (zipfile, entity)
Into outmem select new streamresourceinfo (outmem, null). firstordefault ();
Question 2 what is it?
The origin of the problem and fontsource only support the stream (internalmemorystream) obtained by application. getresourcestream; does not support the memorystream returned by the zip above.
This problem occurs, which is generally a dead dish, unless you rewrite the fontsource and glyphs-related font libraries, such as the first floor document toolkit, it looks at this issue, overwrites a bunch of things, and makes a whole control to sell money;
The solution is not none. Replace the big method. glyphs is used to describe the text, find a similar uielement, and replace it with the past. The premise is that you have to deal with fontinfo, after all, no font fonts are given, and the text will be completely invisible;
What needs to be done at this time is to read the odttf file and find the font name. For details, refer to the C ++ source code of monolight.
To be continued ......