Problem description

pdfChip converts the HTML DOM into a PDF document. In order to do so, it uses the WebKit engine. As this engine has been developed for use online, and thus high-latency environments (environments where all resources aren't necessarily quickly available), it does what is called 'delay-loading'. This means that it 'finalizes' the DOM, while in the background waiting until resources are downloaded. Once they are available, the DOM is updated on-the-fly.

This works particularly well for websites; you don't want to stare at a blank window until every last image has been downloaded for example. It works less good for some pdfChip templates.

The problem caused by cchip.printPages

The JavaScript function:

cchip.printPages()
Click to copy

causes pdfChip to take the HTML DOM as it is at that specific moment, and convert it into PDF. This can interfere with the delay-loading principle described above. If certain resources have not yet been loaded at that moment in time, they are not available for the conversion to PDF. This may mean that certain elements are missing from the generated PDF file.

This problem is mostly visible with images, and barcodes generated by pdfChip.

HTML objects with parameters

There is a similar, though different, issue with HTML objects that have parameters, when those parameters are dynamically changed in the DOM. This is of primary importance for barcodes when it comes to pdfChip. This chapter also describes a solution for this issue.

Differences between pdfChip versions

To compound problems, there is a difference in how this can be solved depending on the specific version of pdfChip (or pdfToolbox which also uses the pdfChip engine for certain functionality). This chapter focuses on solutions for:

  • pdfChip versions of 2.6 and higher
  • pdfToolbox versions of 16 and higher

The last article in this chapter describes a (less powerful and more complex) technique that can be used in older versions of the applications. You are highly advised to upgrade to at least the versions mentioned above if you want to dynamically load resources.