Nevron Open Vision Documentation
Diagram / File Formats / Export / Drawing PDF Export
In This Topic
    Drawing PDF Export
    In This Topic

    The NDrawingPdfExporter can be used to export the active page of a drawing to PDF.

     Saving with a Dialog

    The following code shows how to display the default PDF export dialog provided by NOV:

    Showing the default PDF Export dialog
    Copy Code
    NDrawingPdfExporter imageExporter = new NDrawingPdfExporter(drawingView.Content);
    imageExporter.ShowDialog(DisplayWindow, true);
    

    The following code shows a save PDF file dialog, which allows the user to export the active page of a drawing to the selected PDF file:

    Exporting the active page of a drawing directly to a file selected from a Save File dialog
    Copy Code
    NDrawingPdfExporter pdfExporter = new NDrawingPdfExporter(drawingView.Content);
    pdfExporter.SaveAsPdf();
    
     Saving to File or Stream

    To export the active page of a drawing to PDF and save it directly to a file, without showing a save file dialog, use the SaveToLocalFile method. The following is a code example:

    Saving the active page of a drawing to a PDF file
    Copy Code
    NDrawingPdfExporter pdfExporter = new NDrawingPdfExporter(drawingView.Content);
    pdfExporter.SaveToLocalFile(@"C:\ExportedDiagram.pdf");
    
    Exporting a drawing to an arbitrary file works only on non-sandboxed platforms like WinForms, WPF and Xamarin.Mac.

    To export the active page of the drawing to a PDF stream, use the SaveToStream method. Unlike the SaveToFile method, the SaveToStream method runs synchronously and blocks code execution until it completes. Exporting drawings to PDF is useful when you wish to generate PDF documents in memory instead of saving them to the disc. The following code snippet shows how to export the active page of a drawing to a stream:

    Export the active page of a drawing to a PDF stream
    Copy Code
    NDrawingPdfExporter pdfExporter = new NDrawingPdfExporter(drawingView.Content);
    pdfExporter.SaveToStream(stream);