// Load input MPP file
Project project = new Project("project.mpp");

// Initilize SaveOptions class object
SaveOptions o = new PdfSaveOptions();

// Set the row height to fit cell content
o.setFitContent(true);

// Specify different properties
o.setTimescale(Timescale.Months);
o.setPresentationFormat(PresentationFormat.TaskUsage);

// Set the LegendOnEachPage property to false to hide legends
o.setLegendOnEachPage(false);

// Save output PDF document
project.save("result.pdf", o);