Example #1
0
        private void ExitDesign()
        {
            if (this.IsDirty)
            {
                if (MessageBox.Show("The design has unsaved changed, do you want to discard the changes?", App.GetName() + " ยท Discard changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }
            }

            SetDesign(this.designName, null);

            preview.Hide();

            #region Save Window State
            Properties.Settings.Default.EditorState = this.WindowState;
            if (this.WindowState == FormWindowState.Normal)
            {
                Properties.Settings.Default.EditorLocation = this.Location;
                Properties.Settings.Default.EditorSize     = this.Size;
            }
            else
            {
                Properties.Settings.Default.EditorLocation = this.RestoreBounds.Location;
                Properties.Settings.Default.EditorSize     = this.RestoreBounds.Size;
            }
            Properties.Settings.Default.Save();
            #endregion

            this.Hide();
        }
Example #2
0
        private void PrintDesign()
        {
            DesignEntry country = this.design.GetCountry(1);

            bool excludeNumber        = country.Settings.ToLower().Contains("!includenumber");
            bool excludeValueAndColor = country.Settings.ToLower().Contains("!includevalueandcolor");

            Print print = new Print(PrintMode.ToDocument, excludeNumber, excludeValueAndColor);

            DialogResult result = print.ShowDialog();

            if (result == DialogResult.OK)
            {
                preview.Hide();

                PageSetup setup = PageSetup.Load();

                DesignEntry album = design.GetAlbum();

                string pdfName = album.Pdf;

                if (setup.Catalog != Catalog.None)
                {
                    pdfName += "_" + setup.Catalog;
                }

                pdfName += "_" + setup.PageFormat.FormatName;

                pdfName += "_v" + album.Version;

                if (setup.IncludeMarginForPunchHoles)
                {
                    pdfName += "_offcenter";
                }

                if (setup.IncludeSamplePagesOnly)
                {
                    pdfName += "_sample";
                }

                if (setup.FontSize == FontSize.Medium)
                {
                    pdfName += "_font6";
                }
                else if (setup.FontSize == FontSize.Large)
                {
                    pdfName += "_font7";
                }

                string bookmarksInXml = null;
                string bookmarksInHtm = null;

                if (setup.IncludePdfBookmarks)
                {
                    BookmarksHelper.GetBookmarks(this.design, album.Pdf, setup.IncludeSamplePagesOnly, out bookmarksInXml, out bookmarksInHtm);
                }

                PDF995Helper pdfHelper = new PDF995Helper(album.Pdf, pdfName, bookmarksInXml, bookmarksInHtm);

                Progress progress = new Progress(this.design.NumberOfPages());
                progress.Show();
                progress.Refresh();

                preview.PrintDocument(App.GetSetting("PDFPrinter"), setup.PageFormat.PageWidth, setup.PageFormat.PageHeight, this.design, progress.SetPrintingProgress);

                if (setup.IncludePdfImages)
                {
                    for (int pageNumber = 1; pageNumber <= this.design.NumberOfPages(); pageNumber++)
                    {
                        progress.SetCreatingProgress(pageNumber);

                        preview.ShowPreview(this.design, pageNumber, this.design.GetPagefeed(pageNumber).AlbumNumber, PrintMode.ToDocument, ScreenMode.MatchPaper);

                        preview.CreateImage(string.Format("{0}\\{1}-large.jpg", App.GetSetting("PDFImagesFolder"), pageNumber), 0.75F);
                        preview.CreateImage(string.Format("{0}\\{1}-small.jpg", App.GetSetting("PDFImagesFolder"), pageNumber), 0.25F);
                    }
                }

                progress.SetWaiting();

                pdfHelper.WaitForCompletion();

                progress.Close();
            }
        }