Changeset 3436 for pkpgcounter/trunk/pkpgpdls/lidil.py
- Timestamp:
- 10/06/08 00:22:07 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/lidil.py
r3410 r3436 8 8 # the Free Software Foundation, either version 3 of the License, or 9 9 # (at your option) any later version. 10 # 10 # 11 11 # This program is distributed in the hope that it will be useful, 12 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 # GNU General Public License for more details. 15 # 15 # 16 16 # You should have received a copy of the GNU General Public License 17 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. … … 22 22 """This modules implements a page counter for HP LIDIL format. 23 23 24 Documentation used : 25 24 Documentation used : 25 26 26 hplip-2.7.10/prnt/ldl.py 27 27 hplip-2.7.10/prnt/hpijs/ldlencap.h … … 52 52 """A parser for HP LIDIL documents.""" 53 53 format = "Hewlett-Packard LIDIL" 54 def isValid(self) : 54 def isValid(self) : 55 55 """Returns True if data is LIDIL, else False.""" 56 56 # Beginning Of File marker is a Sync packet, followed with … … 61 61 # with a Reset packet. We ignore the preceding Sync packet 62 62 # for simplicity's sake. 63 EOFMarker = "$\x00\x10\x00\x08\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff$$\x00\x10\x00\x06\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff$" 63 EOFMarker = "$\x00\x10\x00\x08\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff$$\x00\x10\x00\x06\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff$" 64 64 if self.firstblock.startswith(BOFMarker) \ 65 65 and self.lastblock.endswith(EOFMarker) : 66 66 return True 67 else : 67 else : 68 68 return False 69 69 70 70 def getJobSize(self) : 71 71 """Computes the number of pages in a HP LIDIL document.""" … … 80 80 # Invalid header or no Frame Sync byte. 81 81 raise pdlparser.PDLParserError, "This file doesn't seem to be valid Hewlett-Packard LIDIL datas." 82 (framesync, 82 (framesync, 83 83 cmdlength, 84 84 dummy, … … 93 93 ejectpage += 1 94 94 self.infile.seek(cmdlength + datalength - len(header), 1) # relative seek 95 except struct.error : 95 except struct.error : 96 96 raise pdlparser.PDLParserError, "This file doesn't seem to be valid Hewlett-Packard LIDIL datas." 97 97 98 98 # Number of page eject commands should be sufficient, 99 99 # but we never know : someone could try to cheat the printer