Optimize PDFs
Before putting them online, ensure that any PDFs are correctly optimized for the internet e.g. sampling rate and compression ratio of images, embedded fonts and resolution.
If not, allow the PDF to be downloaded chapter by chapter.
If you want to give users the ability to download a PDF reader, choose light software such as Sumatra (4.3 MB) instead of Adobe (48 MB), as this reduces bandwidth ten-fold for each download and, more importantly, uses less RAM (which helps fight against the digital divide and planned obsolescence).
Do not call a function in the declaration of a for loop
Do not call a function in the declaration of a for loop to avoid the function being called each time the loop is iterated.