I have tested the pixOrientDetect/pixOrientCorrect through thousands of similar pages of annual reports with similar layouts. For some reason which I trying to understand I get a 90 cw rotation for pages that are still upright but ONLY when they are in PBM format and if I first convert the PBM files to a JPEG I don't get the rotation.
Attaching PBM in a ZIP file since Github doesn't allow me to upload the PBM.
Leptonica-casuses-wrong-rotation.zip