1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
.. default-domain:: js
.. highlight:: javascript
PDFGraftMap
===================
The graft map is a structure used to copy objects between different PDF documents,
and track which objects have already been copied so that they can be re-used.
Constructors
------------
.. class:: PDFGraftMap
|no_new|
Call `PDFDocument.prototype.newGraftMap` to create a graft map.
Instance methods
----------------
.. method:: PDFGraftMap.prototype.graftObject(obj)
Return a deep copy of the given object suitable for use within
the graft map's target document.
:param PDFObject object: The object to graft.
:returns: `PDFObject`
.. code-block::
var map = document.newGraftMap()
map.graftObject(obj)
.. method:: PDFGraftMap.prototype.graftPage(to, srcDoc, srcPage)
Graft a page and its resources at the given page number from
the source document to the requested page number in the
destination document connected to the map.
Page numbers start at 0 and -1 means at the end of the
document.
:param number to: The page number to insert the page before.
:param PDFDocument srcDoc: Source document.
:param number srcPage: Source page number.
.. code-block::
var map = dstdoc.newGraftMap()
map.graftObject(-1, srcdoc, 0)
|