How to improve the converting time ?

Converting an HTML document to PDF at PDFShift can be done very quickly, but it depends on a lot of parameter.

Here are our top recommandation to follow to drastically reduce the duration of the conversion.

Generally speaking, avoid any network requests. This forces PDFShift to query the server, load the file and process it, which is the #1 cause of increasing conversion time.

  1. Send the raw HTML instead of an URL. This will avoid PDFShift to make a network request to load your file

  2. Replace all Javascript and CSS to inline whenever possible.

  3. Remove all unnecessary Javascript files, such as trackers (Google Analytics for instance)

  4. If possible, replace all your <img src="https://..." /> by raw, base64 encoded data (<img src="data:image/png;base64,{base64_encoded_image}" />). This will remove one network request and data loading per image.

  5. Optimize images for your PDF format. You might not need a 4k image for a A4 document.

By taking these steps into consideration, you'll drastically improve the conversion time taken to generate a PDF.

Was this helpful?