I have an issue exporting to pdf and preserving the layers

when exporting to pdf the layers are being combined at times and I am loosing some of the layers not sure why this is happening but I need help fixing it