I have now successfully used the SMask to create transparent PNG images and render them to the page. The code is getting messy and I'm now in the process of tidying it up.
I have a problem with getting the body of the SMask XObject though. When I step through the code slowly the body is returned from the PDFStream as it should be and the rendering process works ok. But when I step through the code quickly or run without debugging, the body becomes shortened and incorrect. I can't see why this is. It seems as though there is a race condition that is causing the body to be returned incorrectly. But, I don't think PDF Clown is multi-threaded…
I've worked out what was happening with the body.
Just by looking at the body property of the SMask XObject while debugging, I was causing the body to have the filtering applied to it because the get accessor causes GetBody to be called, which performs decoding. When I didn't look at the Body property during debugging the filtering was not applied and the error occured. I have now added a condition to check if filtering has been applied and if not, do it.
I know this is an old thread but Glen could you share your final code?
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.