How do I embed PJTF or JDF job ticket in PDF using PDFNet SDK?

Q: How do I embed PJTF or JDF job ticket in PDF using PDFNet SDK?

Job ticket files are used for embedding print instructions (such as
duplex printing etc) so that PDF can be used further without any
printer instruction to print.
------
A: You can use PDFNet SDK (http://www.pdftron.com/pdfnet) to embed
PJTF/JDF in PDF.

PJTF job ticket files can be opened using 'pdftron.SDF.SDFDoc' class.
SDFDoc is a low-level class used to manipulate any type of COS based
document (such as PDF, PJTF, FDF, etc). To import PJTF object into PDF
you could use pdfdoc.getSDFDoc().importObj(pjtf_root_obj, true). A
good starting point to familiarize yourself with SDF/COS API is
SDFTest sample (http://www.pdftron.com/pdfnet/samplecode.html#SDF).

Besides using PDFNet to import or extract PJTF/JDF into PDF, you can
also use the PDFNet API to directly editing job ticket information
directly in PDF.

Regarding JDF, it is usually stored in PDF as an embedded XML stream.
You can embed (or replace) a JDF stream as follows:

...
StdFile file = new StdFile("my.jdf", StdFile.OpenMode.e_read_mode);
FilterReader reader = new FilterReader(file);
Obj stm = pdfdoc.CreateIndirectStream(reader);
// Add optional keywords ...
stm.PutName("Subtype", "JDF");

// Reference JDF stream somewhere within PDF document structure, as
required.
// e.g.
pdfdoc.GetRoot().Put("JobTicket", stm);
file.Close();

It is also possible to embed a JDF data from a memory buffer (as shown
in PDFDocMemory sample project - http://www.pdftron.com/pdfnet/samplecode.html#PDFDocMemory).