Here is a good example of the sort of tradeoff you can find in converting PDF files to HTML5. The PDF file contains a right aligned table containing a line of dots.
When we make this into a PDF, we can keep all the dots separately in their own div, so that we can position them exactly. This works fine but creates large files which can crash mobile browsers.
So why not roll the dots together into a single structure in a div. The file is much smaller and faster to display but we lose the alignment.
So is there any way we can keep the single div but stretch it out???
It turns out there are 2 possible values we could use.
charSpacing allows us to insert a gap between lines but you cannot have floating point values. So if you have 40 characters on a line you can only adjust the line lengths in minimum 40 pixel increments – we need to stretch the line by about 10 pixels so it is no good to us. If we want to use it we would need the break the line which is getting messy 🙁
wordSpacing allows us to stretch the spaces on the line and gives us a small file and right alignment.
This is the strategy used in today’s release. You can see the compromises on accuracy, speed and filesize. So let us know what matters most to you…
Do you need to write or read JPEG in Java?
We have an easy guide on how to write JPEG in Java using ImageIO and JDeli.
You can learn how to read/write most of the image files in ImageIO. However, it gives little control over the process.
JDeli is easy to use and offers complete support, so why don't you give a try?