简体   繁体   English

使用C#生成后如何获取pdf文件大小

[英]how to get pdf file size after generating using C#

how to get PDF file size.? 如何获取PDF文件大小。 I am passing direct pdf url ..any idea? 我正在通过直接的pdf网址..任何想法吗? please

FileInfo info = new FileInfo("C:\\file.txt");
FileAttributes attributes = info.Attributes;
Console.WriteLine(attributes);
info = new FileInfo("C:\\");

in above code iam not getting file info.. SO please give me idea how to get pdf file size? 在上面的代码中,我没有获取文件信息。.所以请给我一个想法,如何获取pdf文件大小?

Try this, will return the file size in bytes 试试这个,将返回文件大小(以字节为单位)

FileInfo info = new FileInfo("PDF file path");
long size = info.Length

To get file size in C#, you use: 要使用C#获取文件大小,请使用:

long fileSize = (new FileInfo(fileName)).Length;

Is this not working? 这不行吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在C#中使用iTextSharp获取pdf文件中的特定段落? - how to get the particular paragraph in pdf file using iTextSharp in C#? 为什么我的 PDF 文件大小在拆分和合并后会增加? (使用 PDFSharp c#) - Why does my PDF file size increase after splitting and merging back? (Using PDFSharp c#) 如何使用C#按文件大小拆分PDF文件? - How can I split a PDF file by file size using C#? 如何使用wkhtmltopdf使用C#增加pdf中的字体大小? - How to increase the font size in a pdf using c# with wkhtmltopdf? PDF 文件无法在来自 MemoryStream 的 C# .net 核心项目中正确生成 - PDF file is not get generating properly in C# .net core project from MemoryStream 使用此代码生成PDF文件时,如何增加字体大小? - How can I increase the font size while generating a PDF file using this code? C#获取文件大小 - C# Get file size 在C#中生成pdf报告但未获取数据 - Generating pdf report in C# but don't get Data 在 C# 中,在生成 PDF 时,如何以“第 1 页,共 n”或“第 1/n 页”格式获取页脚中的页码 - In C#, while generating a PDF, how to get page number in footer in the format “Page 1 of n” or “Page 1/n” 如何使用C#获取PDF文件中的彩页数? - How can I get the number of color pages in a PDF file using C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM