Exemplo n.º 1
0
 def findxref(fdata):
     ''' Find the cross reference section at the end of a file
     '''
     startloc = fdata.rfind('startxref')
     if startloc < 0:
         raise PdfParseError('Did not find "startxref" at end of file')
     source = PdfTokens(fdata, startloc, False)
     tok = source.next()
     assert tok == 'startxref'  # (We just checked this...)
     tableloc = source.next_default()
     if not tableloc.isdigit():
         source.exception('Expected table location')
     if source.next_default().rstrip().lstrip('%') != 'EOF':
         source.exception('Expected %%EOF')
     return startloc, PdfTokens(fdata, int(tableloc), True)
Exemplo n.º 2
0
 def findxref(fdata):
     ''' Find the cross reference section at the end of a file
     '''
     startloc = fdata.rfind('startxref')
     if startloc < 0:
         raise PdfParseError('Did not find "startxref" at end of file')
     source = PdfTokens(fdata, startloc, False)
     tok = source.next()
     assert tok == 'startxref'  # (We just checked this...)
     tableloc = source.next_default()
     if not tableloc.isdigit():
         source.exception('Expected table location')
     if source.next_default().rstrip().lstrip('%') != 'EOF':
         source.exception('Expected %%EOF')
     return startloc, PdfTokens(fdata, int(tableloc), True)