Guest User

feliam

a guest
Jan 12th, 2010
466
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #From http://feliam.wordpress.com/
  2. from miniPDF import *
  3. #The PDF document
  4. doc= PDFDoc()
  5. #pages
  6. pages = PDFDict()
  7. pages.add('Type', PDFName('Pages'))
  8. doc.add(pages)
  9. #catalog
  10. catalog = PDFDict()
  11. catalog.add('Type', PDFName('Catalog'))
  12. catalog.add('Pages', PDFRef(pages))
  13. doc.add(catalog)
  14. #Set the pdf root, added so we can brand it in the First pdfobj... jojojo
  15. doc.setRoot(catalog)
  16.  
  17. #empty contents for a dummy page
  18. contents = PDFStream('')
  19. doc.add(contents)
  20.  
  21. #The pdf page
  22. page = PDFDict()
  23. page.add('Type', PDFName('Page'))
  24. page.add('Parent', PDFRef(pages))
  25. page.add('Contents', PDFRef(contents))
  26. doc.add(page)
  27.  
  28. #link the page to the pages list
  29. pages.add('Kids',PDFArray([PDFRef(page)]))
  30. pages.add('Count', PDFNum(1))
  31.  
  32. print doc
  33.  
  34.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×