private void ExportViaPDFSharp(bool bExportAllLayouts)
        {
            var zQuery = new QueryPanelDialog("Export to PDF (via PDFSharp)", 750, false);

            zQuery.SetIcon(Icon);
            const string ORIENTATION    = "orientation";
            const string OUTPUT_FILE    = "output_file";
            const string OPEN_ON_EXPORT = "open_on_export";

            zQuery.AddPullDownBox("Page Orientation",
                                  new string[]
            {
                PageOrientation.Portrait.ToString(),
                PageOrientation.Landscape.ToString()
            },
                                  m_nPdfExportLastOrientationIndex,
                                  ORIENTATION);

            zQuery.AddFileBrowseBox("Output File", m_sPdfExportLastFile, "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*", OUTPUT_FILE);
            zQuery.AddCheckBox("Open PDF on Export", m_bPdfExportLastOpen, OPEN_ON_EXPORT);

            if (DialogResult.OK != zQuery.ShowDialog(this))
            {
                return;
            }

            var nStartLayoutIdx = 0;
            var nEndLayoutIdx   = ProjectManager.Instance.LoadedProject.Layout.Length;

            if (!bExportAllLayouts)
            {
                int nIdx = ProjectManager.Instance.GetLayoutIndex(LayoutManager.Instance.ActiveLayout);
                if (-1 == nIdx)
                {
                    FormUtils.ShowErrorMessage("Unable to determine the current layout. Please select a layout in the tree view and try again.");
                    return;
                }
                nStartLayoutIdx = nIdx;
                nEndLayoutIdx   = nIdx + 1;
            }

            m_sPdfExportLastFile             = zQuery.GetString(OUTPUT_FILE);
            m_bPdfExportLastOpen             = zQuery.GetBool(OPEN_ON_EXPORT);
            m_nPdfExportLastOrientationIndex = zQuery.GetIndex(ORIENTATION);

            if (!m_sPdfExportLastFile.EndsWith(".pdf", StringComparison.CurrentCultureIgnoreCase))
            {
                m_sPdfExportLastFile += ".pdf";
            }

            var zFileCardExporter = new PdfSharpExporter(nStartLayoutIdx, nEndLayoutIdx, m_sPdfExportLastFile, zQuery.GetString(ORIENTATION));

            var zWait = new WaitDialog(
                2,
                zFileCardExporter.ExportThread,
                "Export",
                new string[] { "Layout", "Card" },
                450);

#if true
            zWait.ShowDialog(this);
#else
            zFileCardExporter.ExportThread();
#endif

            if (zWait.ThreadSuccess &&
                m_bPdfExportLastOpen &&
                File.Exists(m_sPdfExportLastFile))
            {
                Process.Start(m_sPdfExportLastFile);
            }
        }