Using the TMS WEB Core variant of FNC Core's PDF-generation tools, I'm running into some issues when adding images to the PDF. I've managed to get a bitmap (originally a DataURI - a Base64-encoded PNG file) into the PDF using something like this.
b := TTMSFNCUtils.CreateBitmapFromBase64(CurrentLabel);
p.graphics.DrawImage(b, gcWhite, RectF(50,350,550,600), true, true, itOriginal, 1.0, true);
However, I end up with a small image rendered on the page (the image is actually quite high resolution) and it has a lot of "whitespace" around it, but sadly it isn't white....
- I've had the most success using the Graphics.DrawImage variant with a RectF as a parameter. Which is the best variant to use?
- The second parameter (gcWhite above) was suppose to be the backgound of the image, but it is always just all black, no matter what value I use. Just drawing rectangles, the colors all seem to work fine otherwise.
- After the Rect, the parameters I think are for "stretch" and "aspect ratio", and I'd really like to use those, but they don't seem to work?
- Looking through the source code, I got the impression that the WEB Core version of FNC Core doesn't seem to support SVG as well as it might - passing an SVG didn't work at all. Is that just a work-in-progress, or are there other issues here?
When creating the bitmap, it consistently fails the first time, and then works the second time. The error I get is the following.
Uncaught (in promise) DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
It's almost as if there's some kind of async initialization happening, but I don't know where to look for that. As it works the second time, I'm reasonably certain that the data was correct all along, so is there perhaps another reason why atob might be failing?