Skip to content
Mark Petereit edited this page Mar 10, 2016 · 3 revisions

I created this project to allow my church, Family Worship Center, in Florence, South Carolina, to use iPads and AirPrint label printers with Breeze Church Management Systems Checkin. This eliminates the need to use the more expensive DYMO label printers, and the need to have them permanently connected to a dedicated PC used as a label printer server.

This project was created with the knowledge and blessing of Jon VerLee, the founder of Breeze.

Most of the meat and bones of the app is in FWCViewController.m. On load, it navigates the UIWebView to your church's checkin URL.

In webViewDidFinishLoad, it overrides the page's javascript and sets the select#printer_list found to true. This prohibits it from displaying the printer not found dialog.

It then injects a new print_tag javascript function to override the function normally called in Breeze's checkin2.js file. This injected print_tag function uses a custom URL scheme to transfer control back to this app when labels are printed.

The webView shouldStartLoadWithRequest function intercepts any navigation requests from the webView. It examines the URL to see if it contains the custom breezeprint:print? protocol. If it does, it pulls the variables from the URL and does a javascript call to pull the nametag_fields array from the webView.

The assign_substitutions function from Breeze's checkin2.js has been ported to Objective-C and lives in the FWCNameTagView and FWCFamilyTagView objects. I only ported the photo-processing portion of that function in the FWCNameTagView, since parent tags don't contain photos. The parent tags may also be missing the code that converts user-defined fields. [If there's a demand, I can get that working. -- Mark Petereit.]

It then creates a new PDF context to contain the labels, creates and populates new FWCNameTagView objects for each child label, generates a PDF image of each label and adds them to the PDF context.

After all children labels are created, it adds a parent label (FWCFamilyTagView), fills its fields, generates the PDF, adds it to the PDF context, and the printLabels: function is called.

The printLabels: function initializes a new UIPrintInteractionController. The first time labels are printed, it displays the AirPrint printer selection dialog and allows the user to select a label printer. Once a printer is selected for the first label printing, the app stores the selected printer in self.labelPrinter. Subsequent printing requests will not prompt the user for a printer again. It will continue to use the same printer previously selected.

Clone this wiki locally