def get_crop_margins(page, crop_percent, side='both'):
    """ Get the margins to remove from all sides using the crop_percent """
    width, height = page.mediaBox.upperRight
    w_diff, h_diff = float(width) * (crop_percent / 2), float(height) * (crop_percent / 2)
    scale = (width / (width - w_diff * 2))
    if side == 'left':
        return (w_diff * 2, h_diff), (width, height - h_diff), scale
    elif side == 'right':
        return (0, h_diff), (width - w_diff * 2, height - h_diff), scale
    else:
        return (w_diff, h_diff), (width - w_diff, height - h_diff), scale