Skip to content

Instantly share code, notes, and snippets.

@SKaplanOfficial
Last active November 12, 2022 08:15
Show Gist options
  • Save SKaplanOfficial/6394b424fb5773224ca19c7756f16255 to your computer and use it in GitHub Desktop.
Save SKaplanOfficial/6394b424fb5773224ca19c7756f16255 to your computer and use it in GitHub Desktop.
Printing a TextEdit document with print settings in PyXA
# Tested with PyXA 0.1.0
import PyXA
from datetime import datetime, timedelta
app = PyXA.Application("TextEdit")
doc = app.documents()[0]
print_time = datetime.now() + timedelta(minutes=1)
properties = {
"copies": 3,
"collating": False,
"startingPage": 1,
"endingPage": 10,
"pagesAcross": 3,
"pagesDown": 3,
"requestedPrintTime": print_time,
"errorHandling": app.PrintErrorHandling.DETAILED.value,
"faxNumber": "",
"targetPrinter": ""
}
app.print(doc, print_properties=properties)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment