refactored 'reg' function in letter_pdf_gen to use generate_bb()