Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何获得PDF文件大小。?我正在传递直接 pdf url ..有什么想法吗?请
FileInfo info = new FileInfo("C:\\file.txt"); FileAttributes attributes = info.Attributes; Console.WriteLine(attributes); info = new FileInfo("C:\\");
在上面的代码中,我没有获取文件信息。所以请告诉我如何获取 pdf 文件大小?
试试这个,将以字节为单位返回文件大小
FileInfo info = new FileInfo("PDF file path"); long size = info.Length
要在 C# 中获取文件大小,请使用:
long fileSize = (new FileInfo(fileName)).Length;
这不工作吗?