382 | | jobsize = 0 |
383 | | if self.JobSizeBytes : |
384 | | try : |
385 | | from pkpgpdls import analyzer, pdlparser |
386 | | except ImportError : |
387 | | self.printInfo("pkpgcounter is now distributed separately, please grab it from http://www.librelogiciel.com/software/pkpgcounter/action_Download", "error") |
388 | | self.printInfo("Precomputed job size will be forced to 0 pages.", "error") |
389 | | else : |
390 | | infile = open(self.DataFile, "rb") |
391 | | try : |
392 | | parser = analyzer.PDLAnalyzer(infile) |
393 | | jobsize = parser.getJobSize() |
394 | | except pdlparser.PDLParserError, msg : |
395 | | # Here we just log the failure, but |
396 | | # we finally ignore it and return 0 since this |
397 | | # computation is just an indication of what the |
398 | | # job's size MAY be. |
399 | | self.printInfo(_("Unable to precompute the job's size with the generic PDL analyzer : %s") % msg, "warn") |
400 | | else : |
401 | | if self.InputFile is not None : |
402 | | # when a filename is passed as an argument, the backend |
403 | | # must generate the correct number of copies. |
404 | | jobsize *= self.Copies |
405 | | infile.close() |
406 | | self.softwareJobSize = jobsize |
| 382 | self.preaccounter.beginJob(None) |
| 383 | self.preaccounter.endJob(None) |
| 384 | self.softwareJobSize = self.preaccounter.getJobSize(None) |