Link

Enabling GZIP Compression

GZIP compression is a widely supported method of reducing the file size of the content sent from the webserver to a web browser, improving the load time. It is supported in effectively all browsers (IE6+, Firefox 2+, Chrome 1+, etc).

It is highly recommended to enable GZIP compression for files produced by BuildVu. In particular, we have found that generated SVG files are highly compressible (in our testing we found example files reduced by as much as 80-90% when compressed).

When using BuildVu we recommend enabling compression for .html, .css, .js, .svg, and .json files, as these cover all of the compressible formats that BuildVu will produce.

Option 1: Enabling GZIP on the webserver

The standard way to enable compression is on the webserver. Tutorials that show how to enable gzip compression do not tend to include the SVG mime type, so if you are following another guide you will need to make sure that compression is applied to the image/svg+xml mime type.

Enabling GZIP on Apache

Add the following to the .htaccess file:

AddOutputFilterByType DEFLATE image/svg+xml text/html text/css text/plain text/javascript application/javascript application/json

Read the official Apache documentation on configuring GZIP compression

Enabling GZIP on NGINX

Add the following to the server configuration:

server {
    gzip on;
    gzip_types      image/svg+xml text/html text/css text/plain text/javascript application/javascript application/json;
    gzip_proxied    no-cache no-store private expired auth;
}

Read the official NGINX documentation on configuring GZIP compression

Enabling GZIP on IIS

Read the official IIS documentation on configuring GZIP compression

Option 2: Enabling GZIP at conversion time (SVG only)

It is also possible to configure BuildVu to generate SVGZ instead of SVG (SVGZ files are simply SVG files which have been GZIP compressed). Pre-generating GZIP compressed SVG is useful as the webserver will not need to compress the file when it is served (which will improve performance).

Important: You will need to make sure that the SVGZ files are served with the Content-Encoding gzip header in order for browsers to correctly read the file.

You can enable SVGZ generation with the JVM flag Dorg.jpedal.pdf2html.compressSVG=true if you are running BuildVu from the command line or by calling setCompressSVG(true) on the HTMLConversionOptions or SVGConversionOptions object if you are running BuildVu from Java.

If you are serving the generated content from Apache, you will need to add the following to the .htaccess file:

AddType image/svg+xml svg svgz
AddEncoding gzip svgz