Help Contents

Using compressed HTML5/SVG documents (SVGZ)

Print2HTML5 supports compressed HTML5 documents by compressing page SVG files using GZIP format (SVGZ format). Using document files in this format conserves disk space, reduces network traffic and removes the necessity for web servers to compress documents each time a document is requested thus conserving web server resources.

To turn on compression for HTML5 documents, you need to set Compression option in the HTML5 Output Tab of Document Options window. At programmatic conversion you need to set Compression property of the HTML5Options object to true if you use Print2HTML5 OLE Automation API, or set HTML5Options.Compression parameter to "on" if you use Enhanced Batch Processing.

Configuring Web servers for processing of compressed HTML5 documents

Displaying compressed HTML5 documents in web browsers usually requires a bit of additional web server configuration. The gist of this configuration is to make the web server send the following headers along with each SVGZ file:

Content-Type: image/svg+xml
Content-Encoding: gzip
There are various methods to achieve this with various web servers. Below are configuration instructions for Internet Information Server (IIS) and Apache HTTP Server.
 

Configuring Internet Information Server (IIS)

You'll need Internet Information Server 7 or a later version in order to use compressed HTML5 documents. The configuration requires presence of URL Rewrite module on your web server.

You need to have the following code in the web.config file of your web site:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <outboundRules>
        <rule name="Rewrite SVGZ header" preCondition="IsSVGZ" stopProcessing="true">
          <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
          <action type="Rewrite" value="gzip" />
        </rule>
        <preConditions>
          <preCondition name="IsSVGZ">
            <add input="{PATH_INFO}" pattern="\.svgz$" />
          </preCondition>
        </preConditions>
      </outboundRules>
    </rewrite>
    <staticContent>
      <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
      <mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />
    </staticContent>
  </system.webServer>
</configuration>
If you don't have a web.config file yet, you may create one in any text editor in the root folder of your web site and copy the above code there. If you already have a web.config file, you need to add the rewrite and staticContent tags from the above code to the respective section of your file (under system.webServer tag).

After that your web site should correctly process compressed HTML5 documents and you will be able to download them from your web site and view them in a browser. If you meet with an IIS error 0x800700b7 ("Cannot add duplicate collection entry of type 'mimeMap'...") when loading SVGZ files, remove the respective mimeMap tag from your web.config file.

Configuring Apache HTTP Server

To make Apache HTTP Server process SVGZ files correctly, you need to add the following configuration commands:

AddType image/svg+xml svg svgz
AddEncoding gzip svgz
You may add them either on the local level to the configuration file of your web site .htaccess or at the global level for the entire web server by adding them to the httpd.conf file.