Basics | Features | Release Notes | Get/Compile Source | Help
RFC3391 - The MIME Application/Vnd.pwg-multiplexed Content-type is used by XHTML-Print as a file format to use when bundling an XHTML-Print document and its associate image and style sheet files into a single, compound document. The app_multiplexed utility creates such a compound document interleaving or multiplexing image and style sheet files with the XHTML-Print document that references it.
The compound document produced by app_multiplexed conforms to the RFC3391:
Content-Type: application/vnd.pwg-multiplexed; type="application/vnd.pwg-xhtml-print+xml"
CHK 0 0 LAST
The following is a simple XHTML-Print document that prints a single page with the words "Hello world!":
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//PWG//DTD XHTML-Print 1.0//EN" "http://www.pwg.org/xhtml-print/xhtml-print10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>greet</title> </head> <body > <p>Hello world!</p> </body> </html>
The following is the document above as a multiplexed document containing the single message that is the XHTML-Print document in a single chunk.
Content-Type: application/vnd.pwg-multiplexed; type=application/vnd.pwg-xhtml-print+xml CHK 1 371 LAST Content-Type: application/vnd.pwg-xhtml-print+xml Content-Location: helloworld.htm <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//PWG//DTD XHTML-Print 1.0//EN" "http://www.pwg.org/xhtml-print/xhtml-print10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>greet</title> </head> <body > <p>Hello world!</p> </body> </html> CHK 0 0 LAST
The following example contains a reference to "image.jpg":
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//PWG//DTD XHTML-Print 1.0//EN" "http://www.pwg.org/xhtml-print/xhtml-print10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Image Reference</title> </head> <body > <p><img src="tests/image.jpg" width="100" height="100" /></p> </body> </html>
The multiplexed document version of this example, contains two messages: the xhtml-print document
(Message 1) and the image, tests/image.jpg
(Message 2). The both
messages are divided into two chunks and interleaved.
The diagram on the right illustrates how the two messages contribute to making the single, compound, multiplexed document that starts with the required Content-Type header and the first chunk of the first message.
The first chunk of the second message follows directly after the reference to it in the first message, which causes the division of the first message into two chunks.
The second message contains the JPEG image, so it is divided into two chunks. The first chunk contains the image header, which provides enough immediate information so that the page can be laid out. The second chunk contains the image data approximately at the end of the page, so that it is available as the printer needs it and not before.
The document ends with the required empty chunk for message zero.
The multiplexed document below is constructed from the XHTML-Print document in this example:
Content-Type: application/vnd.pwg-multiplexed; type=application/vnd.pwg-xhtml-print+xml
CHK 1 395 MORE Content-Type: application/vnd.pwg-xhtml-print+xml Content-Location: imgref.htm <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//PWG//DTD XHTML-Print 1.0//EN" "http://www.pwg.org/xhtml-print/xhtml-print10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Image Reference</title> </head> <body > <p><img src="tests/image.jpg" width="100" height="100" />
CHK 2 686 MORE
Content-Type: image/jpeg
Content-Location: tests/image.jpg
...686 bytes of JPEG image header from message two ...
CHK 1 24 LAST </p> </body> </html>
CHK 2 2516 LAST
...remaining 2516 bytes of JPEG image header from message two
CHK 0 0 LAST
When a document references multiple images, each image is a separate message divided into two chunks: the first chunk containing the image header, the second the image data. Each image header chunk follows directly after an image reference in the XHTML-Print document. The image data chucks are collected a placed in the document at approximately where the printer will need them when printing the page.
The app_multiplexed utility :
This processing involves looking for URI's in the attributes of the img and object elements, as well as the url function within style sheets and style attributes. For example:
<img src="image.jpg" ... />
<object data="image.jpg" ... >
<p style="background-image: url(image.jpg)" ... >
<style type="text/css"> p {background-image: url(image.jpg)} ...
The simplest way to create a multiplexed file is by invoking app_multiplexed from the command line with the name of a file containing an XHTML-Print document:
bash-2.04$ app_multiplexed helloworld.htm > helloworld.mx
In this situation app_multiplexed accepts one file that is assumed to contain an XHTML-Print document, scans the document for URIs, attempts to collect the referenced entities, constructs the multiplexed document and writes it to standard out.
The man page below is the current source of help for this utility.
app_multiplexed(1)
name
app_multiplexed - creates a multiplexed document from an XHTML-Print document
synopsis
app_multiplexed [OPTION]... [-] [FILE] ...
description
Reads FILE(s) and their associated resources (either images or style sheets) and by writes a multiplexed file to standard out when a single input file is specified on the command line. If multiple files are given, app_multiplexed writes a multiplexed file for each input file using either the default file suffix, "mx" or the suffix given by the -output-prefix option at the end of the input file name. For example, "app_multiplexed doc1.htm doc2.htm" results in doc1.htm.mx and doc2.htm.mx.
If no files are given on the command line, then input is taken from standard in
and the multiplexed file is written to standard out. For example,
"cat doc.htm | app_multiplexed | lp"
Command Line Options
Reporting Bugs
Report bugs to www-html-testsuite@w3.org. No guarantee of support is implied by a bug report.
copyright
Copyright (c) 2004 Hewlett-Packard Development Company,
L.P.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice
and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.
See Also
See RFC3391 - The MIME Application/Vnd.pwg-multiplexed Content-type for more information about the multiplexed file format.