FlexViewer Export to PDF

Posted by: msloan on 8 November 2018, 2:41 am EST

  • Posted 8 November 2018, 2:41 am EST

    Hi,

    Is it possible in code to create a FlexReport, make it the DocumentSource of a FlexView and Export it to as a PDF to a specified file, without any input required from the user?

    Regards,
    Mark
  • Marked as Answer

    Replied 8 November 2018, 3:24 am EST

    Never mind. I have found that I can do the following:


    // Export to PDF
    ExportProvider L_objExportPDFProvider = L_objReport.SupportedExportProviders[0];
    ExportFilter L_objExportFilter = L_objExportPDFProvider.NewExporter() as ExportFilter;
    L_objExportFilter.FileName = P_strFilename;
    L_objExportFilter.Preview = P_boolShowPreview;
    try
    {
    L_objReport.RenderToFilter(L_objExportFilter);
    }
    catch (Exception L_exError)
    {
    MessageBox.Show(string.Format("Failed to export report [{0}], exception:\r\n{1}", L_strReportTitle, L_exError.Message),
    "Error", MessageBoxButton.OK, MessageBoxImage.Error);
    }
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels