//Export a single page layout to PDF.
//Create a PDF format with appropriate settings
//BMP, EMF, EPS, GIF, JPEG, PNG, SVG, TGA, and TFF formats are also available for export
PDFFormat PDF = new PDFFormat()
{
OutputFileName = filePath,
Resolution = 300,
DoCompressVectorGraphics = true,
DoEmbedFonts = true,
HasGeoRefInfo = true,
ImageCompression = ImageCompression.Adaptive,
ImageQuality = ImageQuality.Best,
LayersAndAttributes = LayersAndAttributes.LayersAndAttributes
};
//Check to see if the path is valid and export
if (PDF.ValidateOutputFilePath())
{
await QueuedTask.Run(() => layout.Export(PDF)); //Export the layout to PDF on the worker thread
}