@@ -540,6 +540,7 @@ def produce_pdf(
540540 accounts : Sequence [Sequence [Account ]], # The crypto account(s); at least 1 of each required
541541 card_format : str = CARD , # 'index' or '(<h>,<w>),<margin>'
542542 paper_format : Any = None , # 'Letter', (x,y) dimensions in mm.
543+ orientations : Sequence [str ] = None , # available orientations; default portrait, landscape
543544) -> Tuple [Tuple [str ,str ], FPDF , Sequence [Sequence [Account ]]]:
544545 """Produces an FPDF containing the specified SLIP-39 Mnemonics group recovery cards.
545546
@@ -548,7 +549,8 @@ def produce_pdf(
548549 """
549550 if paper_format is None :
550551 paper_format = PAPER
551-
552+ if orientations is None :
553+ orientations = ('portrait' , 'landscape' )
552554 # Deduce the card size
553555 try :
554556 (card_h ,card_w ),card_margin = CARD_SIZES [card_format .lower ()]
@@ -568,7 +570,7 @@ def produce_pdf(
568570 page_margin_mm = PAGE_MARGIN * MM_IN
569571 cards_pp ,orientation ,page_xy ,pdf = max (
570572 layout_pdf ( card_dim , page_margin_mm , orientation = orientation , paper_format = paper_format )
571- for orientation in ( 'portrait' , 'landscape' )
573+ for orientation in orientations
572574 )
573575 log .debug ( f"Page: { paper_format } { orientation } { pdf .epw :.8} mm w x { pdf .eph :.8} mm h w/ { page_margin_mm } mm margins,"
574576 f" Card: { card_format } { card_dim .x :.8} mm w x { card_dim .y :.8} mm h == { cards_pp } cards/page" )
@@ -709,12 +711,14 @@ def write_pdfs(
709711 print ( f"{ name } { name and ': ' or '' } { mnem } " )
710712
711713 # Unless no card_format (False) or paper wallet password specified, produce a PDF containing
712- # the SLIP-39 mnemonic recovery cards; remember the deduced (<pdf_paper>,<pdf_orient>)
714+ # the SLIP-39 mnemonic recovery cards; remember the deduced (<pdf_paper>,<pdf_orient>). If
715+ # we're producing paper wallets, always force portrait orientation for the cards, to match.
713716 if card_format is not False or wallet_pwd :
714717 (pdf_paper ,pdf_orient ),pdf ,_ = produce_pdf (
715718 * details ,
716719 card_format = card_format or CARD ,
717- paper_format = paper_format or PAPER
720+ paper_format = paper_format or PAPER ,
721+ orientations = ('portrait' , ) if wallet_pwd else None ,
718722 )
719723
720724 now = datetime .now ()
0 commit comments