It is possible to process pages differently depending on the result of a Check (or a Profile). In this article we are using a Process Plan that first identifies pages that are portrait (and not landscape). These pages are then stamped and rotated.
The Process Plan uses 4 steps.
If you need one to try out this is a PDF with portrait and landscape pages.
Page is portrait
Create page list
For each item in the result object the script extracts the page number, adds 1 (because in the result object page numbers are 0 based) and appends it to the page list. Finally the page list that has been created in the script is written into a global variable app.vars.pages.
Place text "Portrait"
The next step places a stamp "Portrait" on the respective pages. The page list that had been created in the previous step and saved into app.vars.pages is now used in the page filter "Preflight only pages" for the Fixup.
Rotate pages -90
The next and last step then rotates the pages from the page list. "Rotate pages -90" is based on a Quick Fix since that is faster than the corresponding regular Fixup. A Quick Fix always has it's own page selector, so we do not use the Process Plan sidebar, but a Quick Fix parameter.