@@ -235,6 +235,8 @@ def produce_pdf(
235235
236236 # Find the best PDF and orientation, by max of returned cards_pp (cards per page). Assumes
237237 # layout_pdf returns a tuple that can be compared; cards_pp,orientation,... will always sort.
238+ # This card orientation defines the overall orientation of the entire PDF; we'll rotate other
239+ # elements (cover, paper wallets) to match.
238240 page_margin_mm = PAGE_MARGIN * MM_IN
239241 cards_pp ,orientation ,page_xy ,pdf ,_ = max (
240242 layout_pdf ( card_dim , page_margin_mm , orientation = orientation , paper_format = paper_format )
@@ -335,6 +337,8 @@ def produce_pdf(
335337 cover_sent += "\n " .join ( slip39_group )
336338 tpl_cover ['cover-sent' ] = cover_sent
337339
340+ # Add the cover page(s), rotated to match the orientation deduced for the cards. Thus, the
341+ # whole PDF will be printable with the deduced card page orientation.
338342 pdf .add_page ()
339343 if orientation .lower ().startswith ( 'p' ):
340344 tpl_cover .render ( offsetx = pdf .epw , rotate = - 90.0 )
@@ -520,7 +524,9 @@ def write_pdfs(
520524
521525 # Unless no card_format (False) or paper wallet password specified, produce a PDF containing
522526 # the SLIP-39 mnemonic recovery cards; remember the deduced (<pdf_paper>,<pdf_orient>). If
523- # we're producing paper wallets, always force portrait orientation for the cards, to match.
527+ # we're producing paper wallets, always force portrait orientation for the cards, to match
528+ # the layout of the paper wallets, so that all page orientations will match; this may result
529+ # in a sub-optimal card layout, but mixing orientations in a PDF confuses some printers.
524530 if card_format is not False or wallet_pwd is not None :
525531 (pdf_paper ,pdf_orient ),pdf ,_ = produce_pdf (
526532 * details ,
@@ -547,7 +553,8 @@ def write_pdfs(
547553
548554 if wallet_pwd is not None :
549555 # Deduce the paper wallet size and create a template. All layouts are in specified in
550- # inches; template dimensions are in mm.
556+ # inches; template dimensions are in mm. Paper wallets are always formatted for
557+ # portrait orientation; we've forced that, above, if paper wallets are desired.
551558 try :
552559 (wall_h ,wall_w ),wall_margin = WALLET_SIZES [wallet_format .lower () if wallet_format else WALLET ]
553560 except KeyError :
@@ -557,8 +564,8 @@ def write_pdfs(
557564 wall_dim = wall .mm ()
558565
559566 # Lay out wallets, always in Portrait orientation, defaulting to the Card paper_format
560- # if it is a standard size (a str, not an (x,y) tuple), otherwise to "Letter" paper. Printers may
561- # have problems with a PDF mixing Landscape and Portrait, but do it if desired.. .
567+ # if it is a standard size (a str, not an (x,y) tuple), otherwise to "Letter" paper.
568+ # Rotate the wallets to match the card's orientation (like the cover page) .
562569 if wallet_paper is None :
563570 wallet_paper = paper_format if type (paper_format ) is str else PAPER
564571
0 commit comments