// Create an object of the Document class
Document doc = new Document();

// Initialize Page class object
Page page = new Page();

// Initialize Outline class object
Outline outline = new Outline();

// Initialize OutlineElement class object
OutlineElement outlineElem = new OutlineElement();

// Initialize AttachedFile class object and also pass its icon path
AttachedFile attachedFile = null;

try {
    attachedFile = new AttachedFile("C:\\Files\\sample.pdf", new FileInputStream("C:\\Files\\pdf-icon.png"), ImageFormat.getJpeg());
} catch (FileNotFoundException e) {
    e.printStackTrace();
}

// Add attached file
outlineElem.appendChildLast(attachedFile);

// Add outline element node
outline.appendChildLast(outlineElem);

// Add outline node
page.appendChildLast(outline);

// Add page node
doc.appendChildLast(page);

doc.save("C:\\Files\\output.one");