答案 0 :(得分:1)
让divPdf
成为必需的div
,然后您可以embed使用以下文件:
<div id="divPdf">
<embed src="fileName.pdf" />
</div>
答案 1 :(得分:0)
public static void ConvertToSwf(string pdfPath, string swfPath, int page)
{
try
{
string exe = HttpContext.Current.Server.MapPath("PDF2SWF/pdf2swf.exe");
if (!File.Exists(exe))
{
throw new ApplicationException("Can not find: " + exe);
}
StringBuilder sb = new StringBuilder();
sb.Append(" -o \"" + swfPath + "\"");//output
sb.Append(" -z");
sb.Append(" -s flashversion=9");//flash version
sb.Append(" -s disablelinks");
sb.Append(" -p " + "1" + "-" + 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(" \"" + pdfPath + "\"");//input
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)
{
throw ex;
}
}
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)
{
throw ex;
}
}
PDF2Swf.exe可以将【.pdf】转换为【.swf】然后显示在你的页面中 它可能有用!
答案 2 :(得分:-1)
使用此
<div>
<iframe src="[Full path of your PDF file]" ></iframe>
</div>