What Is The Structure Of a XPS File

2019-04-15 01:45发布

问题:

As I think, XPS files are like PDF files, but what is the structure od a XPS file? It's like PDF files?

回答1:

XPS vs. PDF on CNET

Excerpt:
Behaving more like a ZIP archive file, XPS documents contain all the files necessary to re-create a document on any system. By changing the XPS extension to ZIP, you can view the files related to any XPS document. Specific files include embedded images and fonts so that, if someone doesn't have the same fonts installed on their machine, the XPS Viewer will still render those original fonts, if only for the document.

Portable Document Format (PDF), from Adobe, represents two-dimensional documents in a fixed-layout document that is both device- and resolution-independent. This includes text, forms, images, and 2D vector graphics. Because PDF files do not include information specific to the application or the operating system that created it, PDF files will render the same on any machine.

In short:
Although it shares many similarities with the much more popular Adobe Portable Document Format (PDF), XPS is not a dynamic document format and is designed primarily to transform onscreen content, such as Web sites, into static, printable documents.



回答2:

Dissecting XPS and Microsoft XPS Page.



回答3:

The main diff is the that XPS is a subset of XAML which is a form of XML developed By Microsoft. Which means that XPS consists of a bunch of structured XML data. PDF is a database of objects prodcued from PS.

More info here:

Wikipedia: OpenXPS vs PDF



回答4:

You can find comparisons between PDF and XPS in this Wikipedia article. If you're looking for .Net sample code to read, write, or print XPS files, look at this article on MSDN.



回答5:

A functional perspective

They both capture a print-ready layout paginated for a particular size paper page.

PDF also does interactive things like forms you can fill in. XPS intentionally omits them in favour of simplicity.

A technical perspective

Both XPS and PDF are serialised object graphs. PDF uses a binary serialisation, whereas XPS takes a modern, web-like approach, using a file system to store named resources. This file tree is then compressed into a standard zip file.

The document proper is expressed as XML. This has been lambasted because XML is verbose, but the criticism is meaningless when the whole thing is zipped, because XML compresses extremely well (it yields well to dictionary compression).

A developer's perspective

XPS was designed and implemented as a small, fast, functional knockoff of PDF core functionality. Unlike PDF,

  • There's a supported API for it, documented in MSDN.
  • No special libraries are required beyond the .NET framework so there are no royalties or black box dependencies.
  • The viewer is built into Windows.

A philosophical perspective

Up to Windows 7 there was platform support only for XPS. Windows 8 did introduce platform support for PDF, but most paying customers are corporate running XP or Windows 7 as part of an SOE, and for them the only available platform-supported format is XPS.

Some more on things PDF does that XPS doesn't

When it was the only game in town, PDF's form support was a compelling argument for adoption of the technology. This is now much less true because many of the uses to which it was put have been taken over by web applications.

PDF supports DRM. I'm sure there are book publishers who think that without DRM, life as we know it would come to an end, but I think it more likely that life as they know it would end.

These rarely used capabilities greatly complicate PDF both structurally and from a developer's perspective.