Write the PDF header
(self)
| 305 | return 0 |
| 306 | |
| 307 | def writeheader(self): |
| 308 | """Write the PDF header""" |
| 309 | |
| 310 | ws = self.writestr |
| 311 | |
| 312 | title = self._ifile |
| 313 | |
| 314 | t=time.localtime() |
| 315 | timestr=str(time.strftime("D:%Y%m%d%H%M%S", t)) |
| 316 | ws("%PDF-1.4\n") |
| 317 | self._locations[1] = self._fpos |
| 318 | ws("1 0 obj\n") |
| 319 | ws("<<\n") |
| 320 | |
| 321 | buf = "".join(("/Creator (", self._appname, " By Anand B Pillai )\n")) |
| 322 | ws(buf) |
| 323 | buf = "".join(("/CreationDate (", timestr, ")\n")) |
| 324 | ws(buf) |
| 325 | buf = "".join(("/Producer (", self._appname, "(\\251 Anand B Pillai))\n")) |
| 326 | ws(buf) |
| 327 | if self._subject: |
| 328 | title = self._subject |
| 329 | buf = "".join(("/Subject (",self._subject,")\n")) |
| 330 | ws(buf) |
| 331 | if self._author: |
| 332 | buf = "".join(("/Author (",self._author,")\n")) |
| 333 | ws(buf) |
| 334 | if self._keywords: |
| 335 | buf = "".join(("/Keywords (",' '.join(self._keywords),")\n")) |
| 336 | ws(buf) |
| 337 | |
| 338 | if title: |
| 339 | buf = "".join(("/Title (", title, ")\n")) |
| 340 | ws(buf) |
| 341 | |
| 342 | ws(">>\n") |
| 343 | ws("endobj\n") |
| 344 | |
| 345 | self._locations[2] = self._fpos |
| 346 | |
| 347 | ws("2 0 obj\n") |
| 348 | ws("<<\n") |
| 349 | ws("/Type /Catalog\n") |
| 350 | ws("/Pages 3 0 R\n") |
| 351 | ws(">>\n") |
| 352 | ws("endobj\n") |
| 353 | |
| 354 | self._locations[4] = self._fpos |
| 355 | ws("4 0 obj\n") |
| 356 | ws("<<\n") |
| 357 | buf = "".join(("/BaseFont ", str(self._font), " /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >>\n")) |
| 358 | ws(buf) |
| 359 | |
| 360 | if self._IsoEnc: |
| 361 | ws(ENCODING_STR) |
| 362 | |
| 363 | ws(">>\n") |
| 364 | ws("endobj\n") |