How to print on a AirPrint and Non AirPrint Printer
Kluesi last edited by
How can I print from the iPad using a AirPrint printer?
How to print on a standard (old) parallel LPT Interface Printer? E.g. over a printserver. But how to print images and so on?
brumm last edited by brumm
I haven't seen a print option in Pythonista so far, but maybe your interest is more general (otherwise I would ask for some objective c magic :)). There are several apps (like camera roll) where you can print and of course you can send images from pythonista to the camera roll. To print an image I used this tutorial with my usb printer (non airprint). As far as I can remember I tested three options. USB printer connected to the raspberry pi and raspberry pi connected to my wifi router via ethernet cable. Second option: USB printer connected to the raspberry pi with a wifi stick (as wifi hotspot). Thrid option: Raspberry pi only connected via ethernet cable (for protocoll translation) and usb printer connected to a print server. I know you wrote an old parallel LPT Interface Printer, but maybe there's also a hack for this. But there's no guarantee that you printer is supported by cups (so I would start here).
omz last edited by
I haven't seen a print option in Pythonista so far,
In case this question is actually about printing source code in Pythonista, there is an option to generate a printable PDF in the "wrench" menu. After the PDF has been generated, you can print from its "Quick Look" preview.
cook last edited by cook
I was just asking a similar question the other day about printing something with a script. My need was for a script to print HTML content created by a script. I'll share the code below. There are a number of options, like @brumm has indicated, to set up printers for AirPrint. Here is an example for enabling AirPrint for printers on Windows..
This script is in particular for an HTML formatted document. There are other options to program that I haven't explored yet (the different print formatters available in objective c).
# coding: utf-8 from objc_util import * @on_main_thread def print_html_orientation(input, orientation = 'P'): '''takes HTML input and formats it for printing. Uses the built in ios UI print dialogue. Orientation should be 'P' or 'L' ''' html = ObjCClass('UIMarkupTextPrintFormatter').alloc().initWithMarkupText_(ns(input)) printController = ObjCClass('UIPrintInteractionController').sharedPrintController() printInfo = ObjCClass('UIPrintInfo').printInfoWithDictionary_(None) printInfo.orientation = int(orientation.upper() == 'L') printController.printInfo = printInfo printController.setPrintFormatter_(html) printController.presentAnimated_completionHandler_(0, None)
ccc last edited by
printInfo.orientation = int(orientation.upper() == 'L')
brumm last edited by
@cook: Thank you for sharing, btw. printContents should be input or vice versa.
cook last edited by
Phuket2 last edited by
@ccc , if you follow PEP8 for this, it's horrible for selecting on mobile devices. So I guess they need PEP8-M
But there needs to be some recognition of the changes of input devices