![page layers page layers](https://cdn0.iconfinder.com/data/icons/controls-and-navigation-arrows-1/24/36-512.png)
The program demonstrates both how to flatten a single page document and a multi-page document, and generates a pair of PDF output files. If a page has transparency, this program will create a new, flattened version of the page and replace the original page with the new one. The sample program checks each page of the PDF file for any transparencies. Note that the flatten transparency process does not flatten layers within the PDF file (also known as Optional Content Groups).
![page layers page layers](https://i.pinimg.com/originals/0b/79/97/0b7997f5d5427cc9223a99a46280aca5.jpg)
The flattening process simplifies the PDF file and may make it smaller as well. Flattening images in a PDF file is generally necessary before you can send the document to a printer. After this process the original set of transparent objects cannot be broken out again into their constituent parts. The Flatten Transparency program simply merges a stack of transparent objects or graphics images into a single image on the page. With a stack of transparent images, the final colors shown are the result of blending the colors of all of the overlapping objects. One or more graphics images presented together in a stack is referred to as a transparency group. This is in contrast to opaque objects, where if you have a stack of graphics or images, only the graphic or image on top of the stack will appear. Transparent graphics or images can be stacked in a PDF file, with each one contributing to the final result that appears on the page. PDF files can have objects that are partially or fully transparent, and thus can blend in various ways with objects behind them. The related Createlayer program adds a layer to a PDF file. The Unchanged state can lead to an array being set to both ON and OFF at the same time. Be careful in using the Unchanged state, however.
![page layers page layers](https://ecdn.teacherspayteachers.com/thumbitem/Rainforest-Flip-Flap-Book-1886070-1529216069/original-1886070-3.jpg)
By changing the On/Off state, we can make the layers visible or invisible when opening the PDF file in Adobe Acrobat or another similar viewer. This program changes the On/Off setting for the layers in the PDF file’s default configuration (OptionalContentConfig).