Skip to content
Discussion options

You must be logged in to vote

So what's the way to create new object from scratch? I know about xref_set_key to add a key to an object, but no way to add my own object to a PDF.

Fairly straightforward I hope.

  1. xref = doc.get_new_xref() - just defines a new xref number
  2. doc.update_object(xref, "<< object definition >>") - fills in definition
  3. if it should be a stream object: doc.update_stream(xref, b"stream data", new=True)

Replies: 5 comments 11 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@JorjMcKie
Comment options

@angea
Comment options

@angea
Comment options

@JorjMcKie
Comment options

@JorjMcKie
Comment options

Comment options

You must be logged in to vote
1 reply
@angea
Comment options

Comment options

You must be logged in to vote
2 replies
@angea
Comment options

@JorjMcKie
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by angea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #1473 on December 20, 2021 20:41.