I wanted to add watermarks to my XOD files so what I did in code is:
I open the XOD ZIP file, get each XAML page, get its first "Canvas" element and then:
First Approach : I add a new "Glyphs" element in it.
This has the problem that I must calculate the appropriate trasnform for it (to neuteralize the RenderTransform of the FixedPage).
Although I have done some great job at it, something goes wrong, probably not in my code as I saw later.
Second Approach : I move the old Canvas element inside a new Canvas element that I have created and that has RenderTransform="1,0,0,1,0,0" (identity).
Then I append my Glyphs element to the newly created Canvas (that is not trasformed in any way).
This also works fine BUT it only works for some XODs (the same exact problem existed with my previous approach and on the same XODs).
It seems that when the rendering transform of the old Canvas is something like that:
...everything is great, while when it is something like that:
...things go very wrong. My watermark is misplaced and I can't figure out why.
But I don't know if it is the RenderTrasform that causes this divergence in behaviour of something else like the page orientation (if such thing exists in XODs) or something...
In the 2nd approach there is no RenderTransform in any parent of my new Glyphs element.
Yet, it doesn't go when I tell it to go all of the times.
E.g.: I use "10,0,0,10,20,20" and I expect it to start from (20,20) and continue horizontally. Instead it is totally invisible !
Any idea what I am missing here?
You have done some similar work while adding your demo watermark ("www.pdftron.com
") in the XOD converter.
You seem to use the 1st approach mentioned here.