Optimize size comparison & bitmap processing logic

Refactored the code to move the size comparison logic from C to Java,
eliminating unnecessary content-at-margins calculations for all single
page documents. Additionally, added the safeguard against large media
sizes to optimize bitmap operations and reduce memory footprint.

Test: Print Arch E sized PDF to a printer loaded with A4 paper, or
print Arch E sized PDF to a printer loaded with Arch E paper. Confirm
the print job completes without any error.
Signed-off-by: Saurabh Chauhan <[email protected]>

Change-Id: Ieef3fcdefafde924cf40689bb329afde0d42c94b
2 files changed