MCPcopy
hub / github.com/eldraco/domain_analyzer / writerest

Method writerest

pyText2pdf.py:547–593  ·  view source on GitHub ↗

Finish the file

(self)

Source from the content-addressed store, hash-verified

545 self.endpage(beginstream)
546
547 def writerest(self):
548 """Finish the file"""
549
550 ws = self.writestr
551 self._locations[3] = self._fpos
552
553 ws("3 0 obj\n")
554 ws("<<\n")
555 ws("/Type /Pages\n")
556 buf = "".join(("/Count ", str(self._pageNo), "\n"))
557 ws(buf)
558 buf = "".join(("/MediaBox [ 0 0 ", str(self._pageWd), " ", str(self._pageHt), " ]\n"))
559 ws(buf)
560 ws("/Kids [ ")
561
562 for i in range(1, self._pageNo+1):
563 buf = "".join((str(self._pageObs[i]), " 0 R "))
564 ws(buf)
565
566 ws("]\n")
567 ws(">>\n")
568 ws("endobj\n")
569
570 xref = self._fpos
571 ws("xref\n")
572 buf = "".join(("0 ", str((self._curobj) + 1), "\n"))
573 ws(buf)
574 buf = "".join(("0000000000 65535 f ", str(LINE_END)))
575 ws(buf)
576
577 for i in range(1, self._curobj + 1):
578 val = self._locations[i]
579 buf = "".join((string.zfill(str(val), 10), " 00000 n ", str(LINE_END)))
580 ws(buf)
581
582 ws("trailer\n")
583 ws("<<\n")
584 buf = "".join(("/Size ", str(self._curobj + 1), "\n"))
585 ws(buf)
586 ws("/Root 2 0 R\n")
587 ws("/Info 1 0 R\n")
588 ws(">>\n")
589
590 ws("startxref\n")
591 buf = "".join((str(xref), "\n"))
592 ws(buf)
593 ws("%%EOF\n")
594
595
596def main():

Callers 1

convertMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected