예제 #1
0
        private bool ExportImage(Document d, XmlNode preset, string filePath, cdrFilter filter, cdrExportRange range, StructExportOptions opt)
        {
            try
            {
                Corel.Interop.VGCore.ICorelExportFilter exp;
                exp = d.ExportEx(filePath, filter, range, opt);
                object[] param = new Object[1];

                if (preset.Attributes["format"].Value == "Jpeg")
                {
                    param[0] = ValToBool(preset.Attributes["progressive"].Value);
                    exp.GetType().InvokeMember("Progressive", BindingFlags.SetProperty, null, exp, param);

                    param[0] = ValToBool(preset.Attributes["optimize"].Value);
                    exp.GetType().InvokeMember("Optimized", BindingFlags.SetProperty, null, exp, param);

                    if (preset.Attributes["subformat"].Value == "Standard (4:2:2)")
                    {
                        param[0] = 0;
                    }
                    else
                    {
                        param[0] = 1;
                    }
                    exp.GetType().InvokeMember("SubFormat", BindingFlags.SetProperty, null, exp, param);

                    param[0] = 100 - Convert.ToInt32(preset.Attributes["quality"].Value);
                    exp.GetType().InvokeMember("Compression", BindingFlags.SetProperty, null, exp, param);

                    param[0] = Convert.ToInt32(preset.Attributes["blur"].Value);
                    exp.GetType().InvokeMember("Smoothing", BindingFlags.SetProperty, null, exp, param);
                }
                else
                {
                    param[0] = ValToBool(preset.Attributes["interlaced"].Value);
                    exp.GetType().InvokeMember("Interlaced", BindingFlags.SetProperty, null, exp, param);
                }

                exp.Finish();
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }
예제 #2
0
        private bool ExportImage(Document d, XmlNode preset, string filePath, cdrFilter filter, cdrExportRange range, StructExportOptions opt)
        {
            try
            {

                Corel.Interop.VGCore.ICorelExportFilter exp;
                exp = d.ExportEx(filePath, filter, range, opt);
                object[] param = new Object[1];

                if (preset.Attributes["format"].Value == "Jpeg")
                {
                    param[0] = ValToBool(preset.Attributes["progressive"].Value);
                    exp.GetType().InvokeMember("Progressive", BindingFlags.SetProperty, null, exp, param);

                    param[0] = ValToBool(preset.Attributes["optimize"].Value);
                    exp.GetType().InvokeMember("Optimized", BindingFlags.SetProperty, null, exp, param);

                    if (preset.Attributes["subformat"].Value == "Standard (4:2:2)") param[0] = 0;
                    else param[0] = 1;
                    exp.GetType().InvokeMember("SubFormat", BindingFlags.SetProperty, null, exp, param);

                    param[0] = 100 - Convert.ToInt32(preset.Attributes["quality"].Value);
                    exp.GetType().InvokeMember("Compression", BindingFlags.SetProperty, null, exp, param);

                    param[0] = Convert.ToInt32(preset.Attributes["blur"].Value);
                    exp.GetType().InvokeMember("Smoothing", BindingFlags.SetProperty, null, exp, param);
                }
                else
                {
                    param[0] = ValToBool(preset.Attributes["interlaced"].Value);
                    exp.GetType().InvokeMember("Interlaced", BindingFlags.SetProperty, null, exp, param);
                }

                exp.Finish();
                return true;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return false;
            }
        }