You're right, I forgot to allocate the *changed pointer...
Strange that it worked in some ways but not in others.
Anyway, I also fixed the problem after the PDDocColorConvertPage. I tried to save the doc as optimized but I got the same error. That's because PDDoc needs to be saved before optimizing its AVDoc.
I'm sure the topic will be helpful to those who need to convert pdf colors programmatically
Thank you