https方式使用git@osc设置密码的方式
2014-05-05 20:05
267 查看
使用swftools的pdf2swf.exe命令行来完成这项操作,转换效果理想,支持as3,swftools官网:http://www.swftools.org/
下面是根据使用需要设计的2个方法:
/// <summary>
/// 获取pdf文件的页数
/// </summary>
public static int GetPageCount(string pdfPath)
{
try
{
byte[] buffer = File.ReadAllBytes(pdfPath);
int length = buffer.Length;
if (buffer == null)
return -1;
if (buffer.Length <= 0)
return -1;
string pdfText = Encoding.Default.GetString(buffer);
System.Text.RegularExpressions.Regex rx1 = new System.Text.RegularExpressions.Regex(@"/Type/s*/Page[^s]");
System.Text.RegularExpressions.MatchCollection matches = rx1.Matches(pdfText);
return matches.Count;
}
catch (Exception ex)
{
Util.WriteLog(ex);
}
return -1;
}
/// <summary>
/// 把指定的pdf页面转换成swf
/// </summary>
public static void ConvertToSwf(string pdfPath, string swfPath, int page)
{
try
{
string exe = Path.Combine(Application.StartupPath, "Tools//pdf2swf.exe");
if (!File.Exists(exe))
{
throw new ApplicationException("Can not find: " + exe);
}
//参考:http://www.swftools.org/pdf2swf.html
StringBuilder sb = new StringBuilder();
sb.Append(" -p " + page + "-" + page);//page range
sb.Append(" -j 100");//Set quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)
sb.Append(" -t");//The resulting SWF file will not turn pages automatically.
sb.Append(" -T 9");//flash version
sb.Append(" /"" + pdfPath + "/"");//input
sb.Append(" -o /"" + swfPath + "/"");//output
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = exe;
proc.StartInfo.Arguments = sb.ToString();
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
proc.Start();
proc.WaitForExit();
proc.Close();
}
catch (Exception ex)
{
Util.WriteLog(ex);
}
}
下面是根据使用需要设计的2个方法:
/// <summary>
/// 获取pdf文件的页数
/// </summary>
public static int GetPageCount(string pdfPath)
{
try
{
byte[] buffer = File.ReadAllBytes(pdfPath);
int length = buffer.Length;
if (buffer == null)
return -1;
if (buffer.Length <= 0)
return -1;
string pdfText = Encoding.Default.GetString(buffer);
System.Text.RegularExpressions.Regex rx1 = new System.Text.RegularExpressions.Regex(@"/Type/s*/Page[^s]");
System.Text.RegularExpressions.MatchCollection matches = rx1.Matches(pdfText);
return matches.Count;
}
catch (Exception ex)
{
Util.WriteLog(ex);
}
return -1;
}
/// <summary>
/// 把指定的pdf页面转换成swf
/// </summary>
public static void ConvertToSwf(string pdfPath, string swfPath, int page)
{
try
{
string exe = Path.Combine(Application.StartupPath, "Tools//pdf2swf.exe");
if (!File.Exists(exe))
{
throw new ApplicationException("Can not find: " + exe);
}
//参考:http://www.swftools.org/pdf2swf.html
StringBuilder sb = new StringBuilder();
sb.Append(" -p " + page + "-" + page);//page range
sb.Append(" -j 100");//Set quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)
sb.Append(" -t");//The resulting SWF file will not turn pages automatically.
sb.Append(" -T 9");//flash version
sb.Append(" /"" + pdfPath + "/"");//input
sb.Append(" -o /"" + swfPath + "/"");//output
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = exe;
proc.StartInfo.Arguments = sb.ToString();
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
proc.Start();
proc.WaitForExit();
proc.Close();
}
catch (Exception ex)
{
Util.WriteLog(ex);
}
}
效果图
相关文章推荐
- https方式使用git@osc设置密码的方式
- https方式使用git@osc设置密码的方式
- https 方式使用git@osc设置密码的方式
- https 方式使用git@osc设置密码的方式
- Https方式使用Git@OSC设置密码的方式
- https方式使用git@osc设置密码的方式
- https方式使用TortoiseGit设置git@osc密码长期存储
- 使用git@osc – https方式设置密码方式
- git之https或http方式设置记住用户名和密码的方法
- git之https或http方式设置记住用户名和密码的方法
- git之https或http方式设置记住用户名和密码的方法
- git之https或http方式设置记住用户名和密码的方法
- [转]https方式使用git保存密码的方式
- git之https或http方式设置记住用户名和密码的方法
- Linux 创建用户使用-p参数自动设置密码
- VMware下linux Ubuntu10.04使用NAT共享主机IP上网方式的设置参考
- VSS自动使用指定帐号和密码的最简便设置方法
- Linux/UNIX下使用ssh-keygen设置SSH无密码登录
- github https方式免密码提交代码 在git config 中添加用户名密码
- 设置shell脚本静默方式输入密码方法