I am using pdf2dom and trying their basic documentation. Stated in their documentation - Pdf2Dom is based on the Apache PDFBox™ library.
File file = new File("file.pdf");
PDDocument pdf = PDDocument.load(file);
PDFDomTree parser = new PDFDomTree();
Document dom = parser.createDOM(pdf);
PDDocument pdf = PDDocument.load(pFile);
PDFTextStripper stripper = new PDFTextStripper();
String text = stripper.getText(pd);
There is nothing wrong in your code. The toString() method of Document object returns that way.
[#document: null], consists of two parts. The first part is #document which is the node name. When you parse XML, you always receive a #document node as the top-level node. The second part is null, which is the value of the node. null is used to indicate that the node doesn't have a value.
If you print dom.getDocumentElement().getTextContent() then you should see some value.