Develop the XPS browser under Silverlight and support the output format of XPS printer

Source: Internet
Author: User

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)
Return result;

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 ();
}
Return NULL;
}

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 ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.