Hello,
I have a running script to print a URL using ChromeDriver.
I could not find any way to set the custom margin printing settings.
The closest example I found is:
"marginsType": 2,
ex:
settings = {
"recentDestinations": [{
"id": "Save as PDF",
"origin": "local",
"account": ""
}],
"selectedDestinationId": "Save as PDF",
"version": 2,
"isHeaderFooterEnabled": False,
"mediaSize": {
"height_microns": 210000,
"name": "ISO_A5",
"width_microns": 148000,
"custom_display_name": "A5"
},
"customMargins": {},
"marginsType": 2,
"scaling": 175,
"scalingType": 3,
"scalingTypePdf": 3,
"isCssBackgroundEnabled": True
}
I have changed it to:
"marginsType": 3
And I tried to set the custom margins here:
"customMargins": {
"margin-top": "2cm",
"margin-bottom": "2cm",
"margin-left": "2cm",
"margin-right": "2cm"
},
And several other syntaxes that I tried to guess, but nothing worked.
It tries to load the setting but end with this error:
selenium.common.exceptions.TimeoutException: Message: script timeout
How can I set the custom margins?
I would appreciate any ideas.
Thank you!