The output of pdfwrite currently does not preserve any optional content contained in an input PDF file. We need to add the possibility to do so.
See bug 690633 for a simple OC handler that just skips invisible content. Sample files with invisible layers include: comparefiles/BFAX35P5.pdf and sample files attached to the bugs 689289, 689716, 689924, 690633.
One more file with OC is comparefiles/Bug689290.pdf The file is identical to the sample file of the bug 689289.
*** Bug 697063 has been marked as a duplicate of this bug. ***
This series of commits: de0e9e886a45ab30d71a6ff3944c768d99f79767 647ad9344e825e7495fd5dc4b9d466d37d6f97e8 d0be5631dde5a67d088b2ec2f6aec2d89065bfa0 implements Optional Content preservation in pdfwrite, as documented in this commit: ec6eb8f979d125994679ad1ed295840f9852a4fe I checked the files from the bugs listed in comment 1 and 2 and these now have optional content preserved in the output.