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); } }
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(); } }