pdfbox想要将A4页打印到LETTER纸上

时间:2016-02-04 20:38:04

标签: printing pdfbox

当我想要打印具有A4尺寸页面的pdf文档时,使用PdfBox 1.8.x版本,打印机不会在A4纸上打印文档,因为它正在等待输入LETTER纸张。不明白这一点......

如何在A4纸上打印A4文件?或者在全球范围内,我怎么能对打印机说,它必须将文档缩放到A4并且不等待输入任何其他纸张?

谢谢, LACI

1 个答案:

答案 0 :(得分:0)

您是否尝试将代码中创建的PDPage()对象配置为A4大小?创建它们时可以按以下方式完成:

def get_players(team_id, year):
    """
    Get a list of players in a team in a given year.
    Inputs:
        team_id: string, a three-letter id of the team
        year: integer, a year
    Returns:
        a list of strings that are the players' names
    """
    link = "http://espn.go.com/nba/team/stats/_/name/{}/year/{}/".format(team_id, year)
    soup = soup_link(link)

    game_stat_row = soup.find("tr", {"class": "colhead"})

    player_names = []
    for name in game_stat_row:
        player_names.append(name)

    return player_names