使用 C# 将 byte[] 转换为 Pdf
Converting byte[] to Pdf using C#
如何将byte[](源文件为word)值写入pdf
这是我正在使用的代码。
FtpWebRequest reqFTP;
strPath="ftp://1.1.1.1/Docs/word.doc";
strFileName="output.doc";
FileStream outputStream = new FileStream("C:/folder/" + Session.SessionID + "/" + strFileName, FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(strPath));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(strUname, strPassword);
reqFTP.Proxy = null;
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
strExt = strFileName.Split('.');
long cl = response.ContentLength;
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
outputStream.Write(buffer, 0, readCount);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
ftpStream.Close();
outputStream.Close();
response.Close();
byte[] 来源来自 FtpWebRequest.GetResponseStream() 来源是word文件..如何将byte[]写入pdf文件.
我已经尝试过 linkByte[] to Pdf 中提到的方法,但是当我尝试打开 pdf 时它显示(Adobe reader 无法打开。因为它不是受支持的文件类型或因为文件已损坏(例如,它作为电子邮件附件发送但未正确解码))。
谢谢
您可以为您的个人使用第三方组件。喜欢 Aspose.Words。它可以简单地为您完成这项工作。
如何将byte[](源文件为word)值写入pdf
这是我正在使用的代码。
FtpWebRequest reqFTP;
strPath="ftp://1.1.1.1/Docs/word.doc";
strFileName="output.doc";
FileStream outputStream = new FileStream("C:/folder/" + Session.SessionID + "/" + strFileName, FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(strPath));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(strUname, strPassword);
reqFTP.Proxy = null;
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
strExt = strFileName.Split('.');
long cl = response.ContentLength;
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
outputStream.Write(buffer, 0, readCount);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
ftpStream.Close();
outputStream.Close();
response.Close();
byte[] 来源来自 FtpWebRequest.GetResponseStream() 来源是word文件..如何将byte[]写入pdf文件.
我已经尝试过 linkByte[] to Pdf 中提到的方法,但是当我尝试打开 pdf 时它显示(Adobe reader 无法打开。因为它不是受支持的文件类型或因为文件已损坏(例如,它作为电子邮件附件发送但未正确解码))。
谢谢
您可以为您的个人使用第三方组件。喜欢 Aspose.Words。它可以简单地为您完成这项工作。