cover next page > Cover title : Common UNIX Printing System author : Sweet, Michael. publisher : Pearson Education, Inc. isbn10 | asin : 0672321963 print isbn13 : 9780672321962 ebook isbn13 : 9780768658026 language : English subject UNIX (Computer file) , Client/server computing, Printing. publication date : 2002 lcc : QA76.76.O63S943 2002eb ddc : 005.432 subject : UNIX (Computer file) , Client/server computing, Printing. cover next page > < previous page page_i next page > Page i Common UNIX Printing System MICHAEL R. SWEET < previous page page_i next page > < previous page page_ii next page > Page ii Common UNIX Printing System Copyright © 2002 by Sams Publishing All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. International Standard Book Number: 0-672-32196-3 Library of Congress Catalog Card Number: 2001089505 Printed in the United States of America First Printing: August 2001 04 03 02 01 4 3 2 1 Trademarks The UNIX trademark is also shown as Unix; both are registered trademarks of the X Open Group, Inc. All other terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an ''as is" basis. Associate Publisher Jeff Koch Acquisitions Editor Kathryn Purdum Development Editor Mark Renfrow Managing Editor Matt Purcell Project Editor George E. Nedeff Copy Editors Cynthia Fields Margo Catts Karen A. Gill Indexer Larry Sweazy Proofreader Teresa Stephens Technical Editor Tim Hicks Team Coordinator Vicki Harding Interior Designer Gary Adair Cover Designer Alan Clements Page Layout Lizbeth Patterson < previous page page_ii next page > < previous page page_iii next page > Page iii Contents at a Glance Introduction 1 Part I Using CUPS 1 Introduction to CUPS 9 2 Compiling and Installing CUPS 23 3 Setting Up Printers and Classes 37 4 Printing with CUPS 69 5 Server Configuration 91 6 Client Configuration 109 Part II The Internet Printing Protocol 7 Overview of IPP 121 8 Anatomy of an IPP Request 127 9 Printer Objects 141 10 Job Objects 167 11 Subscription Objects 189 12 CUPS Extensions to IPP 205 Part III Programming with CUPS 13 Overview of CUPS Programming 219 14 Using CUPS API Functions 231 15 Sending IPP Requests Using CUPS 267 16 Writing File Filters for CUPS 303 17 Writing Printer Drivers for CUPS 333 18 Writing Backends for CUPS 363 19 Writing Notifiers for CUPS 373 < previous page page_iii next page > < previous page page_iv next page > Page iv Part IV Appendices A Configuration File Directives 383 B IPP Reference 427 C CUPS Constants 435 D CUPS Structures 453 E CUPS Functions 463 F Common UNIX Printing System License Agreement 575 Index 591 < previous page page_iv next page > < previous page page_v next page > Page v Contents Introduction 1 The History of Printing in Unix 1 Printing from Personal Computers 2 The Evolution of CUPS 2 About This Book 5 Part 1 Using CUPS 1 Introduction to CUPS 9 The Printing Problem 10 The Technology 10 Client and Server 11 Jobs 12 Classes 12 Filters 13 Printer Drivers 14 Backends 15 Networking 15 Graphical Interfaces 16 ESP Print Pro 17 GtkLP 17 KUPS 17 QtCUPS 19 XPP 19 Resources 20 The CUPS Mailing List 20 CUPS Newsgroups 21 Web Sites 22 Summary 22 2 Building and Installing CUPS 23 Installing a Source Distribution 24 Getting the CUPS Source Code 24 Requirements 24 Configuring the CUPS Sources 25 Compiling CUPS 29 Testing the Software 30 Installing the Software 30 Upgrading the Software 31 Running the Software 31 < previous page page_v next page > < previous page page_vi next page > Page vi Installing a Binary Distribution 31 Getting a CUPS Binary Distribution 31 Installing or Upgrading a Portable Distribution 32 Installing an RPM Distribution 33 Installing a Debian Distribution 34 Summary 35 3 Setting Up Printers and Classes 37 Basics of Printers 38 Printer Devices 38 Printer Drivers 45 Adding Your First Printer 47 Adding Your First Printer from the Command-Line 47 Configuring Your Printer from the Command-Line 48 Adding Your First Printer from the Web 49 Configuring Your Printer from the Web Interface 51 Printing a Test Page 54 Managing Printers from the Command-Line 55 Setting the Printer Description 56 Setting the Printer Location 56 Changing the Printer Device 56 Changing the Printer Driver 57 Changing the Printer Configuration 57 Setting Quotas on a Printer 58 Restricting Access to a Printer 58 Deleting Printers 59 Setting the Default Printer 59 Starting and Stopping Printers 59 Accepting and Rejecting Print Jobs 60 Managing Printers from the Web Interface 60 Configuring Printers from the Web Interface 61 Modifying Printers 61 Deleting Printers 61 Starting Printers 62 Stopping Printers 62 Accepting Print Jobs 62 Rejecting Print Jobs 62 Printing a Test Page 62 Basics of Classes 62 Managing Printer Classes from the Command-Line 63 Removing Printers from a Class 63 Removing a Class Completely 63 < previous page page_vi next page > < previous page page_vii next page > Page vii Adding Classes from the Web Interface 64 Managing Classes from the Web Interface 65 Modifying Classes 65 Deleting Classes 66 Starting Classes 66 Stopping Classes 67 Accepting Print Jobs 67 Rejecting Print Jobs 68 Printing a Test Page 68 Implicit Classes 68 Summary 68 4 Printing with CUPS 69 Printing Files 70 Choosing a Printer 70 Printing Multiple Copies 70 Encrypting Your Print Jobs 71 Setting Printer Options 71 Printing Collated Copies 71 Printer-Specific Options 71 Standard Printer Options 73 General Options 73 Banner Options 75 Document Options 75 Text Options 77 Image Options 78 HP-GL/2 Options 80 Raw or Unfiltered Output 81 Saving Printer Options 82 Setting Options for a Specific Printer 82 Viewing the Current Saved Options 82 Setting the Default Printer 82 Printer Instances 83 Checking the Printer Status from the Command Line 83 Checking the Printer Status from the Web 84 Canceling a Print Job from the Command-Line 84 Canceling a Print Job from the Web Interface 84 Configuring Applications for CUPS 84 GIMP 85 Netscape 86 Star Office 86 Summary 90 < previous page page_vii next page > < previous page page_viii next page > Page viii 5 Server Configuration 91 The Basics 92 Configuration Files 92 Changing the Server Configuration 92 Server Directives 93 Restarting the CUPS Server 93 Basic Configuration Options 93 Configuring CUPS as a Server 93 Easy Web Browsing 94 Enhanced Security 95 Encryption 95 Enabling Encryption in Your Server 98 Advanced Access Control 100 Basics of Access Control 101 Authentication of Users 101 Authentication of Groups 103 Address-Based Access Control 104 Name-Based Access Control 104 Log Files 105 The Access Log File 105 The Error Log File 106 The Page Log File 107 Summary 107 6 Client Configuration 109 The Basics 110 Manual Configuration of Print Queues 110 Specifying a Single Server for Printing 111 Automatic Configuration of Print Queues 111 Specifying Multiple Servers for Printing 112 Relaying Printers to Other Clients 112 Load Balancing and Failsafe Operation 113 Printing from LPD Clients 114 Printing from Mac OS Clients 115 Columbia Appletalk Package (CAP) 115 XINET KA/Spool 115 NetATalk 116 Printing from Windows Clients 116 Configuring SAMBA 2.0.x 116 Configuring SAMBA 2.2.x 116 Configuring Windows Clients with IPP 117 Summary 117 < previous page page_viii next page > < previous page page_ix next page > Page ix Part II The Internet Printing Protocol 7 Introduction to the Internet Printing Protocol 121 History of IPP 122 The Line Printer Daemon Protocol 122 Making a New Protocol 123 Object Model 124 Extensions 125 References 125 Summary 126 8 Anatomy of an IPP Request 127 Dissecting an IPP Request 128 The HTTP Request 128 The Request Header 129 Groups and Attributes 131 Groups 132 Attributes 133 Array (1setof) Values 134 The Response 134 Status Codes 135 Value Tags 137 Responses Containing Multiple Objects 137 Summary 139 9 Printer Objects 141 What Is a Printer Object? 142 Required Attributes 142 The document-format-supported Attribute 146 Optional Attributes 155 The color-supported Attribute 156 The job-impression-supported Attribute 156 The job-k-octets-supported Attribute 156 The job-media-sheets-supported Attribute 156 The multiple-document-jobs-supported Attribute 157 The multiple-operation-time-out-Attribute 157 The pages-per-minute Attribute 157 The pages-per-minute-color Attribute 157 The print-quality-default Attribute 157 The print-quality-supported Attribute 157 The printer-current-time Attribute 158 The printer-driver-installer Attribute 158 < previous page page_ix next page > [...]... The Set-Job-Attributes Operation Summary 11 IPP Subscription Objects What Is a Subscription Object? Standard Notification Attributes notify-attributes notify-attributes-supported < previous page next page > 17 9 17 9 18 0 18 0 18 0 18 0 18 0 18 1 18 1 18 1 18 1 18 1 18 1 18 2 18 2 18 2 18 2 18 2 18 3 18 3 18 3 18 3 18 4 18 4 18 4 18 5 18 5 18 5 18 6 18 6 18 6 18 7 18 7 18 7 18 8 18 9 19 0 19 0 19 2 19 2 page_xii next page > < previous page... Attribute The sides Attribute CUPS Attributes The blackplot Attribute The brightness Attribute < previous page next page > 17 0 17 0 17 0 17 1 17 1 17 1 17 2 17 2 17 3 17 3 17 3 17 4 17 4 17 4 17 4 17 4 17 4 17 4 17 5 17 5 17 5 17 5 17 5 17 5 17 6 17 6 17 6 17 6 17 6 17 6 17 7 17 7 17 7 17 7 17 7 17 7 17 8 17 8 17 8 17 9 17 9 page_xi next page > < previous page page_xii Page xii The columns Attribute The cpi Attribute The fitplot Attribute The... Summary 10 Job Objects What Is a Job Object? Required Attributes The attributes-charset Attribute The attributes-natural-language Attribute The job-id Attribute The job-name Attribute The job-originating-user-name Attribute The job-printer-up-time Attribute < previous page next page > 15 8 15 8 15 8 15 8 15 8 15 8 15 9 15 9 15 9 15 9 15 9 16 0 16 0 16 0 16 0 16 0 16 0 16 1 16 1 16 1 16 2 16 2 16 3 16 3 16 3 16 3 16 4 16 4 16 4 16 5 16 5... The ippget Notification Scheme The indp Notification Scheme Summary < previous page next page > 19 2 19 2 19 2 19 2 19 4 19 4 19 4 19 4 19 4 19 4 19 4 19 5 19 5 19 5 19 5 19 5 19 6 19 6 19 6 19 6 19 6 19 6 19 6 19 6 19 7 19 7 19 8 19 8 19 8 19 9 19 9 200 200 2 01 202 203 203 204 204 page_xiii next page > < previous page page_xiv Page xiv 12 CUPS Extensions to IPP CUPS Attributes device-class device-info device-make-and-model ppd-natural-language... ServerCertificate ServerKey ServerName ServerRoot SSLListen SSLPort SystemGroup TempDir Timeout User mailto.conf Cc From MailCommand ReplyTo SMTPServer < previous page next page > 405 405 405 406 407 407 407 408 408 409 409 409 410 410 411 411 411 412 412 412 413 413 414 414 414 415 415 415 416 416 416 417 417 417 418 418 418 419 419 419 page_xx next page > < previous page page_xxi Page xxi pdftops.conf... With CUPS 13 Overview of CUPS Programming The Basics Header Files Libraries Your First CUPS Program Detecting the CUPS API Library with GNU Autoconf Autoconf Basics The config.h Header File The Makefile Putting It All Together < previous page page_xiv next page > 205 206 206 207 207 207 207 207 207 207 207 208 208 209 209 210 210 211 211 211 212 212 212 213 213 214 214 215 219 220 220 2 21 2 21 224 224... Files MIME Types and Filters The MIME Type File Format The MIME Filter File Format < previous page next page > 276 276 279 279 280 2 81 285 285 292 292 292 295 295 296 298 298 299 3 01 302 303 304 305 305 306 306 307 308 309 309 310 311 312 312 313 313 314 314 315 315 316 318 page_xvi next page > < previous page page_xvii Page xvii Writing a Script-Based TeX DVI Filter PostScript Output Raster Output Opening... Senior Unix Engineer for HomeSide Lending, Inc He is an HP Certified IT Professional in HP-UX Systems Administration and has been working extensively with HP-UX 10 .10 -11 .00 as well as some work with Solaris 8, AIX 4 .1, FreeBSD, and RedHat 6.2 He has an in-depth knowledge and experience with Highly Available Clusters using HP' MC/ServiceGuard, HP-UX 11 .00, and Oracle 8.05, as well as Sybase 11 He is... The job-printer-up-time Attribute < previous page next page > 15 8 15 8 15 8 15 8 15 8 15 8 15 9 15 9 15 9 15 9 15 9 16 0 16 0 16 0 16 0 16 0 16 0 16 1 16 1 16 1 16 2 16 2 16 3 16 3 16 3 16 3 16 4 16 4 16 4 16 5 16 5 16 7 16 8 16 8 16 9 16 9 16 9 16 9 16 9 16 9 page_x next page > < previous page page_xi Page xi The job-printer-uri Attribute The job-state Attribute The job-state-reasons Attribute The job-uri Attribute The time-at-completed... very little has changed for Unix printing over the 30 years since Unix was first created—applications produce output suitable for the printer, and the spooler sends this file to the printer < previous page page _1 next page > < previous page page_2 next page > Page 2 Printing from Personal Computers When the IBM Personal Computer appeared in 19 81, it duplicated the Unix printing model Applications came . Package (CAP) 11 5 XINET KA/Spool 11 5 NetATalk 11 6 Printing from Windows Clients 11 6 Configuring SAMBA 2.0.x 11 6 Configuring SAMBA 2.2.x 11 6 Configuring Windows Clients with IPP 11 7 Summary 11 7 <. 11 1 Specifying Multiple Servers for Printing 11 2 Relaying Printers to Other Clients 11 2 Load Balancing and Failsafe Operation 11 3 Printing from LPD Clients 11 4 Printing from Mac OS Clients 11 5 Columbia. 209 CUPS-Get-Classes 210 CUPS-Add-Class 210 CUPS-Delete-Class 211 CUPS-Accept-Jobs 211 CUPS-Reject-Jobs 211 CUPS-Set-Default 212 CUPS-Get-Devices 212 CUPS-Get-PPDs 212 CUPS-Move-Job 213 CUPS-Add-Device 213 CUPS-Delete-Device