Beispiel #1
0
        private void Sample2Click(object sender, RoutedEventArgs e)
        {
            Directory.SetCurrentDirectory(GetProgramDirectory());
            var document = SampleDocuments.CreateSample2();

            Preview.Ddl = DdlWriter.WriteToString(document);
        }
Beispiel #2
0
 private void OpenDdlClick(object sender, RoutedEventArgs e)
 {
     try
     {
         var dialog = new OpenFileDialog
         {
             CheckFileExists  = true,
             CheckPathExists  = true,
             Filter           = "MigraDoc DDL (*.mdddl)|*.mdddl|All Files (*.*)|*.*",
             FilterIndex      = 1,
             InitialDirectory = Path.GetFullPath(Path.Combine(GetProgramDirectory(), "..\\..\\..\\..\\assets\\ddl"))
         };
         //dialog.RestoreDirectory = true;
         if (dialog.ShowDialog() == true)
         {
             var document = DdlReader.DocumentFromFile(dialog.FileName);
             var folder   = Path.GetDirectoryName(dialog.FileName);
             Environment.CurrentDirectory = folder;
             var ddl = DdlWriter.WriteToString(document);
             Preview.Ddl = ddl;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Title);
         Preview.Ddl = null; // TODO has no effect
     }
     finally
     {
         //if (dialog != null)
         //  dialog.Dispose();
     }
     //UpdateStatusBar();
 }
Beispiel #3
0
        private void miSample2_Click(object sender, EventArgs e)
        {
            Directory.SetCurrentDirectory(GetProgramDirectory());
            Document document = SampleDocuments.CreateSample2();

            this.pagePreview.Ddl = DdlWriter.WriteToString(document);
        }
Beispiel #4
0
        private void OpenDDL_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = null;

            try
            {
                dialog = new OpenFileDialog();
                dialog.CheckFileExists  = true;
                dialog.CheckPathExists  = true;
                dialog.Filter           = "MigraDoc DDL (*.mdddl)|*.mdddl|All Files (*.*)|*.*";
                dialog.FilterIndex      = 1;
                dialog.InitialDirectory = System.IO.Path.Combine(GetProgramDirectory(), "..\\..");
                //dialog.RestoreDirectory = true;
                if (dialog.ShowDialog() == true)
                {
                    Document document = DdlReader.DocumentFromFile(dialog.FileName);
                    string   ddl      = DdlWriter.WriteToString(document);
                    preview.Ddl = ddl;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Title);
                preview.Ddl = null; // TODO has no effect
            }
            finally
            {
                //if (dialog != null)
                //  dialog.Dispose();
            }
            //UpdateStatusBar();
        }
        public ReportWindow(TreeViewItem item)
        {
            InitializeComponent();

            var document = CreateSample1(item);

            DocumentPreview1.Ddl = DdlWriter.WriteToString(document);

            TVItem = item;
        }
Beispiel #6
0
        private Document ClonedDocument()
        {
#if MIGRADOC132
            // Workaround for bug in Clone() implementation (fixed with PDFsharp 1.50 beta 2).
            var str    = DdlWriter.WriteToString(Document);
            var result = DdlReader.DocumentFromString(str);
            return(result);
#else
            return(Document.Clone());
#endif
        }
Beispiel #7
0
        public MainWindow()
        {
            InitializeComponent();

            // Create a new MigraDoc document
            Document document = SampleDocuments.CreateSample1();

            // HACK
            string ddl = DdlWriter.WriteToString(document);

            this.preview.Ddl = ddl;
        }
        void model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            const bool             unicode   = false;
            const PdfFontEmbedding embedding = PdfFontEmbedding.Always;

            if (e.PropertyName == "Document")
            {
                if (model.Document != null)
                {
                    docViewer.Ddl = DdlWriter.WriteToString(model.Document);
                }
            }
        }
Beispiel #9
0
 private void initializerBGW_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     try
     {
         SetEnabled(true);
         SetStatus("");
         toolStripProgressBar1.Style = ProgressBarStyle.Blocks;
         preview.Ddl = DdlWriter.WriteToString(document);
         SetZoomIndexByActualZoom();
     }
     catch
     { }
 }
        public Viewer()
        {
            InitializeComponent();

            // Create a new MigraDoc document.
            var document = SampleDocuments.CreateSample1();

            // HACK
            var ddl = DdlWriter.WriteToString(document);

            _pagePreview.Ddl = ddl;

            UpdateStatusBar();
        }
Beispiel #11
0
        public OknoPodgladRaportow(Document Raport, string NazwaPliku)
        {
            InitializeComponent();

            NazwaPlikuDoZapisu = NazwaPliku;

            // Utworzenie nowego dokumentu MigraDoc
            var dokument = Raport;

            var ddl = DdlWriter.WriteToString(dokument);

            PodgladRaportu.Ddl = ddl;

            LabelPowiekszenie.Text = "100%";
            LabelStrona.Text       = "Str. " + PodgladRaportu.Page.ToString();
        }
        void model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            const bool             unicode   = false;
            const PdfFontEmbedding embedding = PdfFontEmbedding.Always;

            if (e.PropertyName == "Document")
            {
                if (model.Document != null)
                {
                    //PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(unicode, embedding);
                    //pdfRenderer.Document = model.Document;
                    //pdfRenderer.RenderDocument();
                    //const string filename = "HelloWorld.pdf";
                    //pdfRenderer.PdfDocument.Save(filename);
                    //Process.Start(filename);

                    string ddl = DdlWriter.WriteToString(model.Document);
                    docViewer.Ddl = ddl;
                }
            }
        }
Beispiel #13
0
        private void Sample2_Click(object sender, RoutedEventArgs e)
        {
            Document document = SampleDocuments.CreateSample2();

            this.preview.Ddl = DdlWriter.WriteToString(document);
        }
Beispiel #14
0
        private void Sample1Click(object sender, RoutedEventArgs e)
        {
            var document = SampleDocuments.CreateSample1();

            Preview.Ddl = DdlWriter.WriteToString(document);
        }
Beispiel #15
0
        private void miSample1_Click(object sender, EventArgs e)
        {
            Document document = SampleDocuments.CreateSample1();

            this.pagePreview.Ddl = DdlWriter.WriteToString(document);
        }