February 03, 2021 · Electra Cloud · Electrical CAD · What's New

Best Way to Display DWG and DXF on Your Websites, and Save 99% on Bandwidth

DWG and DXF files are known to be very large in size, and cannot be easily displayed on your website, forcing your customers to download a 3rd party software, resulting in a horrible user experience. Surely, there must be a better way.

The problem

If you are a manufacturer and have lots of DWG and DXF drawings, you would surely want to provide a superior user experience to your customers, but right now, all you can do is to list a bunch of DWG and DXF files on your websites.

Your users would have to download a third party software (some of them do not always work well), in addition to downloading a load of files from your website before they can see their content and get what they want.

This provides a very frustrating user experience for your customers and increased your storage and bandwidth cost.

Converting DWG and DXF to SVG

Why convert to SVG? Scalable Vector Graphics or SVG is an open standard that allows you to display your DWG and DXF files on your website, so that the customer have a much better user experience and be able to view the content, before downloading.

Sample DXF converted to SVG
Sample DXF converted to SVG

Converting from DWG to DXF

The first thing you would need to do is to convert DWG files to DXF. This can be achieved through using our favorite ODA converter.

The resulting SVG files is rather large, and may require optimization and some editing.

Converting DXF to SVG

Once converted to DXF, you can use any of the following:

  1. Use Electra Cloud to open your DXF, and perform any editing including text placement and alignment.
  2. Use Vecta.io to open your DXF, and perform any editing.
  3. Drag and drop to Nano to convert and also optimize to very small sized SVG.

All 3 options above, allows you to export optimized SVG files without extraneous metadata, resulting in extremely small SVG file sizes (up to 80% smaller) that would reduce bandwidth and display these drawings quickly on your website.

Use Brotli compression to reduce file sizes by 99%

Brotli is a newer algorithm that offers far better compression rate, especially at higher file sizes.

Our test indicates that when you upload your SVG images to your website, set the Content-Encoding: br, you will be able to have serve these images at very low file size with very low bandwidth, resulting in far faster display, better SEO and user experience.

Large DXF file when converted to SVG and compressed with Brotli
Large DXF file when converted to SVG and compressed with Brotli

As you can see from the table above, original size for DXF files are rather large.

When converted to SVG, the file is smaller in size, but when compressed with Content-Encoding: br using Brotli encoding at quality level 11, the size for the file is more than 99% smaller when compared to the original DXF file.

This is substantial, as essentially even for a large file of 100MB, we are actually uploading a 255KB file in SVG, and can be displayed very quickly to a user. That's more than 99% savings!

Conclusion

If you have DWG files or DXF files, you could easily convert these files to SVG and save 99% in file size, while offering much better user experience to your user.

Thanks for reading!

Like the article? Give the author some claps.

Share it with your friends!
AUTHOR

Thomas Yip

Founder at vecta.io, created Electra, engineering nerd.

Keep yourself updated with the latest development on Electra Cloud.

Electra Cloud