Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

print.print_paper_width doesn't works

  • 1 trả lời
  • 1 gặp vấn đề này
  • 1 lượt xem
  • Trả lời mới nhất được viết bởi Jonathan Watt

more options

I have been trying to print the webpage as PDF. I am trying to change the page height and width, but this code is not working. When I manually enter the value of print.print_paper_width and save in about:config it works. Can someone tell me whats wrong. This is what I am trying:


from selenium.webdriver.firefox.options import Options as FirefoxOptions from selenium import webdriver options = FirefoxOptions() options.add_argument("--headless") FFprofile = webdriver.FirefoxProfile() FFprofile.set_preference('print.always_print_silent', True) FFprofile.set_preference('print.print_to_file', True)

FFprofile.set_preference('print.print_paper_width', '3.7')

FFprofile.set_preference('print.print_to_filename', 'filepath')

driver = webdriver.Firefox(FFprofile,options=options) driver.get('filepath') driver.execute_script("window.print()")

I have been trying to print the webpage as PDF. I am trying to change the page height and width, but this code is not working. When I manually enter the value of print.print_paper_width and save in about:config it works. Can someone tell me whats wrong. This is what I am trying: from selenium.webdriver.firefox.options import Options as FirefoxOptions from selenium import webdriver options = FirefoxOptions() options.add_argument("--headless") FFprofile = webdriver.FirefoxProfile() FFprofile.set_preference('print.always_print_silent', True) FFprofile.set_preference('print.print_to_file', True) FFprofile.set_preference('print.print_paper_width', '3.7') FFprofile.set_preference('print.print_to_filename', 'filepath') driver = webdriver.Firefox(FFprofile,options=options) driver.get('filepath') driver.execute_script("window.print()")

Tất cả các câu trả lời (1)

more options

This is a forum to support Firefox end users so not really the best place to get help on this. I can possibly help though if you can file an issue at https://bugzilla.mozilla.org/ in the 'Core' product and in the 'Printing: Setup' component. The Firefox core code for handling settings is currently in flux, and this use case is probably even more broken in the Firefox 82/83 code. We can try to make this work though.