Ejemplo n.º 1
0
 public static void Publish(Database database, Teigha.GraphicsSystem.LayoutHelperDevice helperDevice)
 {
     using (mDwfExportParams param = new mDwfExportParams())
     {
         param.Database         = database;
         param.BackgroundColor  = helperDevice.BackgroundColor;
         param.InkedArea        = false;
         param.ColorMapOptimize = false;
         PublishDrawingSheets pds = new PublishDrawingSheets(param);
         if (DialogResult.OK == pds.ShowDialog())
         {
             Export_Import.ExportDwf(param);
         }
     }
 }
Ejemplo n.º 2
0
        public static void Publish3d(Database database, Teigha.GraphicsSystem.LayoutHelperDevice helperDevice)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.AddExtension = true;
            sfd.DefaultExt   = "dwf";
            sfd.Title        = "3D DWF Publish";
            sfd.Filter       = String.Format("3D DWF (Desgin Web Format) v6.01 (*.dwf)|*.dwf");
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                using (mDwf3dExportParams param = new mDwf3dExportParams())
                {
                    param.Database        = database;
                    param.FileName        = sfd.FileName;
                    param.BackgroundColor = helperDevice.BackgroundColor;
                    Export_Import.Publish3d(param);
                }
            }
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (DialogResult.OK == openFileDialog.ShowDialog())
            {
                using (GsModule gsModule = (GsModule)SystemObjects.DynamicLinker.LoadModule("WinDirectX.txv", false, true))
                {
                    // create graphics device
                    using (Teigha.GraphicsSystem.Device dev = gsModule.CreateBitmapDevice())
                    {
                        // setup device properties
                        using (Dictionary props = dev.Properties)
                        {
                            props.AtPut("BitPerPixel", new RxVariant(int.Parse(comboBox1.Text)));
                        }
                        ContextForDbDatabase ctx = new ContextForDbDatabase(database);
                        ctx.PaletteBackground = colorDialog.Color;
                        LayoutHelperDevice helperDevice = LayoutHelperDevice.SetupActiveLayoutViews(dev, ctx);

                        helperDevice.SetLogicalPalette(Device.LightPalette); // light palette
                        Rectangle rect = new Rectangle(0, 0, (int)numericUpDownWidth.Value, (int)numericUpDownHeight.Value);
                        helperDevice.OnSize(rect);
                        ctx.SetPlotGeneration(checkBoxPlotGeneration.Checked);
                        if (ctx.IsPlotGeneration)
                        {
                            helperDevice.BackgroundColor = colorDialog.Color;
                        }
                        else
                        {
                            helperDevice.BackgroundColor = Color.FromArgb(0, 173, 174, 173);
                        }

                        helperDevice.Update();

                        if (DialogResult.OK == saveFileDialog.ShowDialog())
                        {
                            Export_Import.ExportBitmap(helperDevice, saveFileDialog.FileName);
                            Close();
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void ExportPDF()
        {
            try
            {
                mPDFExportParams param = new mPDFExportParams();
                param.Author           = "FSSG";
                param.BackgroundColor  = Color.White;
                param.Creator          = "FSSG";
                param.Database         = database;
                param.Flags            = PDFExportFlags.Default;
                param.FlateCompression = true;
                param.imageDPI         = 72;
                param.Keywords         = "";
                param.Layouts.Add("Layout1");

                StreamBuf stream = new FileStreamBuf(@"C:\Users\Tdme\Desktop\2555.00-718.00.pdf", false, FileShareMode.DenyReadWrite, FileCreationDisposition.CreateAlways);
                param.OutputStream = stream;

                PageParams page = new PageParams();
                page.setParams(200, 200);
                param.PageParams.Add(page);

                param.Palette  = new Color[] { Color.Red, Color.Green, Color.Blue };
                param.Producer = "FSSG";
                param.Subject  = "FSSG";
                param.Title    = "FSSG";
                param.UseHLR   = true;
                param.Versions = PDFExportVersions.Last;

                Export_Import.ExportPDF(param);

                ulong i = stream.Length;
                stream.Dispose();
            }
            catch (System.Exception ex) {
                Logger.log("", ex);
            }
        }
Ejemplo n.º 5
0
        public static void DWF_export(Database database, Teigha.GraphicsSystem.LayoutHelperDevice helperDevice)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.AddExtension = true;
            sfd.DefaultExt   = "dwf";
            sfd.Title        = "Export To Dwf";
            sfd.Filter       = String.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}",
                                             "Binary DWF (Desgin Web Format) v6.0 (*.dwf)|*.dwf",
                                             "Zipped Ascii Encoded 2D Stream DWF (Design Web Format) v6.0 (*.dwf)|*.dwf",
                                             "Compressed DWF (Design Web Format) v5.5 (*.dwf)|*.dwf",
                                             "Binary DWF (Design Web Format) v5.5 (*.dwf)|*.dwf",
                                             "Ascii DWF (Design Web Format) v5.5 (*.dwf)|*.dwf",
                                             "Compressed DWF (Design Web Format) v4.2 (*.dwf)|*.dwf",
                                             "Binary DWF (Design Web Format) v4.2 (*.dwf)|*.dwf",
                                             "Ascii DWF (Design Web Format) v4.2 (*.dwf)|*.dwf");
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                String strFileName = sfd.FileName;
                using (mDwfExportParams param = new mDwfExportParams())
                {
                    param.Database            = database;
                    param.FileName            = strFileName;
                    param.BackgroundColor     = helperDevice.BackgroundColor;
                    param.InkedArea           = false;
                    param.ColorMapOptimize    = false;
                    param.ExportInvisibleText = true;
                    DwfPageDataCollection pageDataColl = new DwfPageDataCollection();
                    DWFPageData           pageData;
                    switch (sfd.FilterIndex)
                    {
                    case 1:
                        param.Format  = DwfFormat.UNCOMPRESSED_BINARY;
                        param.Version = DwfVersion.Dwf_v60;

                        pageData        = new DWFPageData();
                        pageData.Layout = LayoutManager.Current.CurrentLayout;
                        pageDataColl.Add(pageData);
                        param.PageData = pageDataColl;
                        break;

                    case 2:
                        param.Format  = DwfFormat.ASCII;
                        param.Version = DwfVersion.Dwf_v60;

                        pageData        = new DWFPageData();
                        pageData.Layout = LayoutManager.Current.CurrentLayout;
                        pageDataColl.Add(pageData);
                        param.PageData = pageDataColl;
                        break;

                    case 3:
                        param.Format  = DwfFormat.COMPRESSED_BINARY;
                        param.Version = DwfVersion.Dwf_v55;
                        break;

                    case 4:
                        param.Format  = DwfFormat.UNCOMPRESSED_BINARY;
                        param.Version = DwfVersion.Dwf_v55;
                        break;

                    case 5:
                        param.Format  = DwfFormat.ASCII;
                        param.Version = DwfVersion.Dwf_v55;
                        break;

                    case 6:
                        param.Format  = DwfFormat.COMPRESSED_BINARY;
                        param.Version = DwfVersion.Dwf_v42;
                        break;

                    case 7:
                        param.Format  = DwfFormat.UNCOMPRESSED_BINARY;
                        param.Version = DwfVersion.Dwf_v42;
                        break;

                    case 8:
                        param.Format  = DwfFormat.ASCII;
                        param.Version = DwfVersion.Dwf_v42;
                        break;

                    default:
                        return;
                    }
                    Export_Import.ExportDwf(param);
                }
            }
        }
Ejemplo n.º 6
0
        private void Export_Click(object sender, EventArgs e)
        {
            if (outputFile.Text.Length > 0)
            {
                using (mPDFExportParams param = new mPDFExportParams())
                {
                    param.Database = database;
                    using (FileStreamBuf fileStrem = new FileStreamBuf(outputFile.Text, false, FileShareMode.DenyNo, FileCreationDisposition.CreateAlways))
                    {
                        param.OutputStream = fileStrem;

                        param.Flags = (embedded_fonts.Checked ? PDFExportFlags.EmbededTTF : 0) |
                                      (SHXTextAsGeometry.Checked ? PDFExportFlags.SHXTextAsGeometry : 0) |
                                      (TTGeometry.Checked ? PDFExportFlags.TTFTextAsGeometry : 0) |
                                      (ESimpGeometryOpt.Checked ? PDFExportFlags.SimpleGeomOptimization : 0) |
                                      (ZoomExtents.Checked ? PDFExportFlags.ZoomToExtentsMode : 0) |
                                      (EnableLayerSup_pdfv1_5.Checked ? PDFExportFlags.EnableLayers : 0) |
                                      (ExportOffLay.Checked ? PDFExportFlags.IncludeOffLayers : 0);

                        param.Title        = textBox_title.Text;
                        param.Author       = textBox_author.Text;
                        param.Subject      = textBox_subject.Text;
                        param.Keywords     = textBox_keywords.Text;
                        param.Creator      = textBox_creator.Text;
                        param.Producer     = textBox_producer.Text;
                        param.UseHLR       = UseHidLRAlgorithm.Checked;
                        param.EncodeStream = EncodedSZ.Checked;

                        bool bV15 = EnableLayerSup_pdfv1_5.Checked || ExportOffLay.Checked;
                        param.Versions = bV15 ? PDFExportVersions.PDFv1_5 : PDFExportVersions.PDFv1_4;

                        StringCollection strColl = new StringCollection();
                        if (radioButton_All.Checked)
                        {
                            using (DBDictionary layouts = (DBDictionary)database.LayoutDictionaryId.GetObject(OpenMode.ForRead))
                            {
                                foreach (DBDictionaryEntry entry in layouts)
                                {
                                    strColl.Add(entry.Key);
                                }
                            }
                        }
                        param.Layouts = strColl;

                        int nPages = Math.Max(1, strColl.Count);
                        PageParamsCollection pParCol = new PageParamsCollection();
                        Double width  = Double.Parse(PapWidth.Text);
                        Double height = Double.Parse(PapHeight.Text);
                        for (int i = 0; i < nPages; ++i)
                        {
                            PageParams pp = new PageParams();
                            pp.setParams(width, height);
                            pParCol.Add(pp);
                        }
                        param.PageParams = pParCol;
                        Export_Import.ExportPDF(param);
                    }
                }
                Close();
            }
        }