Leon Atherton Leon is a developer at IDRsolutions and product manager for BuildVu. He oversees the BuildVu product strategy and roadmap in addition to spending lots of time writing code.

Do you need to process or display PDF files?

Find out why you should be using IDRSolutions software

How to Enable SVG Gzip Compression on Apache and NGINX

46 sec read

html5

Gzip compression is a widely supported method of reducing the size of the content sent from a web server in order to improve the load time. Effectively all browsers support gzip compression (IE6+, Firefox 2+, Chrome 1+, etc).

In our experience as the creators of a PDF to SVG converter, our research shows that SVG files, in particular, can be highly compressible. We find that some files reduce by as much as 80-90% when compressed!

The standard way to enable compression is on the web server. Tutorials that show how to enable gzip compression do not often include SVG files, so if you follow another guide you should make sure to apply compression to the image/svg+xml MIME-type.

Enabling Gzip on Apache

Add the following to the .htaccess file:

AddOutputFilterByType DEFLATE image/svg+xml

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

If you would like to do more with gzip compression, we recommend reading the official documentation (links above) to ensure you get the most accurate information.



Our software libraries allow you to

Convert PDF files to HTML
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java
Read and write HEIC and other Image formats in Java
Leon Atherton Leon is a developer at IDRsolutions and product manager for BuildVu. He oversees the BuildVu product strategy and roadmap in addition to spending lots of time writing code.