iTextsharp - 在 C# 中获取 pdf 页面的旋转
iTextsharp - Get rotation of pdf page in C#
我正在尝试使用 iTextsharp 在 c# 中 get/read rotation/degree pdf 页面。我完全用谷歌搜索,但除了以下内容我什么也没找到:
iTextSharp.text.pdf.PdfReader inputPdf = new iTextSharp.text.pdf.PdfReader(txtBrowse.Text);
int rotation = inputPdf.GetPageRotation(PageNo);
label1.Text = Convert.ToString(rotation);
以上代码 return 不正确。
请帮助我在 c# 中获取 pdf 页面的旋转。
在您的问题的评论中,您说您的代码 returns int 值为 0、90、180、270 或 360。在您的问题中,您声称您的代码不起作用。您的评论与您的问题自相矛盾。
请阅读 ISO-32000-1(这是 PDF 的 ISO 标准),更多 specifically Table 30 ("Entries in a page object")。它像这样定义 Rotate
条目(文字 copy/paste):
The number of degrees by which the page shall be rotated clockwise
when displayed or printed. The value shall be a multiple of 90.
Default value: 0.
只要 ISO 标准使用 shall 一词,您就会遇到规范性规则(与标准使用 should[=24= 一词相反) ] 在这种情况下,您将面临推荐)。
您在评论中所说的符合PDF规范。如果您期望返回任何其他值,那么您的期望是错误的。另见
我正在尝试使用 iTextsharp 在 c# 中 get/read rotation/degree pdf 页面。我完全用谷歌搜索,但除了以下内容我什么也没找到:
iTextSharp.text.pdf.PdfReader inputPdf = new iTextSharp.text.pdf.PdfReader(txtBrowse.Text);
int rotation = inputPdf.GetPageRotation(PageNo);
label1.Text = Convert.ToString(rotation);
以上代码 return 不正确。
请帮助我在 c# 中获取 pdf 页面的旋转。
在您的问题的评论中,您说您的代码 returns int 值为 0、90、180、270 或 360。在您的问题中,您声称您的代码不起作用。您的评论与您的问题自相矛盾。
请阅读 ISO-32000-1(这是 PDF 的 ISO 标准),更多 specifically Table 30 ("Entries in a page object")。它像这样定义 Rotate
条目(文字 copy/paste):
The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90. Default value: 0.
只要 ISO 标准使用 shall 一词,您就会遇到规范性规则(与标准使用 should[=24= 一词相反) ] 在这种情况下,您将面临推荐)。
您在评论中所说的符合PDF规范。如果您期望返回任何其他值,那么您的期望是错误的。另见