Example #1
0
        private void savePdf(PdfDocument document)
        {
            try
            {
                if (this.InvokeRequired)
                {
                    this.BeginInvoke(new Action <PdfDocument>(savePdf), new object[] { document });
                }
                else
                {
                    var sfd = new SaveFileDialog();
                    sfd.FileName = "symboltables_" + Language + ".pdf";
                    sfd.Filter   = "pdf files (*.pdf)|*.pdf|All files (*.*)|*.*";


                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        if (SymbolTablesPdf.savePdfDocument(sfd.FileName, document))
                        {
                            if (ViewPdf)
                            {
                                // ...and start a viewer.
                                Process.Start(sfd.FileName);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "save Pdf");
            }
        }
Example #2
0
        void updateLanguageComboBox()
        {
            var _path = "";

            if (!String.IsNullOrEmpty(CurrentProjectPath))
            {
                _path = SymbolTablesPdf.languageFileDirectory(CurrentProjectPath);
            }

            if (!String.IsNullOrEmpty(CurrentProjectPath) && System.IO.Directory.Exists(_path))
            {
                foreach (var file in System.IO.Directory.GetFiles(_path, "*.json"))
                {
                    var language = System.IO.Path.GetFileNameWithoutExtension(file);
                    if (!languageComboBox.Items.Contains(language))
                    {
                        languageComboBox.Items.Add(language);
                    }
                }
            }
            else
            {
                foreach (var item in Enum.GetValues(typeof(SymbolTablesPdf.LanguageEnum)))
                {
                    if (!languageComboBox.Items.Contains(item.ToString()))
                    {
                        languageComboBox.Items.Add(item.ToString());
                    }
                }
            }
        }
Example #3
0
        private void startButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (OnProcess)
                {
                    return;
                }

                var symbolTablesPdf = new SymbolTablesPdf();
                if (!symbolTablesPdf.validFolder(CurrentProjectPath))
                {
                    return;
                }

                ThreadPool.QueueUserWorkItem(createPdf, CurrentProjectPath);
            }
            catch (Exception)
            {
            }
        }
Example #4
0
        public void createPdf(object path)

        {
            try
            {
                OnProcess = true;

                var symbolTablesPdf = new SymbolTablesPdf();

                symbolTablesPdf.SymbolTablesCount_Changed += SymbolTablesCount_Changed;
                symbolTablesPdf.SymbolImagesCount_Changed += SymbolImagesCount_Changed;
                symbolTablesPdf.Progress_Changed          += Progress_Changed;

                symbolTablesPdf.BorderWidthTop    = 35; // BorderWidth;
                symbolTablesPdf.BorderWidthLeft   = 35; // BorderWidth;
                symbolTablesPdf.BorderWidthRight  = 30; // BorderWidth;
                symbolTablesPdf.BorderWidthBottom = 20; // BorderWidth;
                symbolTablesPdf.ImageSize         = ImageSize;
                symbolTablesPdf.Language          = Language;
                symbolTablesPdf.FontSizeName      = FontSizeName;
                symbolTablesPdf.FontSizeOverlay   = 7; // FontSizeOverlay;
                symbolTablesPdf.Orientation       = Landscape ? PdfSharp.PageOrientation.Landscape : PdfSharp.PageOrientation.Portrait;
                symbolTablesPdf.NewPage           = NewPage;

                var document = symbolTablesPdf.createPdfDocument((string)path);

                symbolTablesPdf.SymbolTablesCount_Changed -= SymbolTablesCount_Changed;
                symbolTablesPdf.SymbolImagesCount_Changed -= SymbolImagesCount_Changed;
                symbolTablesPdf.Progress_Changed          -= Progress_Changed;

                OnProcess = false;
                savePdf(document);
            }
            catch (Exception ex)
            {
                OnProcess = false;
                MessageBox.Show(ex.Message, "save Pdf");
            }
        }