检测每一页的方向在PDF使用ABCPDF [英] Detect orientation of every page in a PDF using ABCPDF

查看:209
本文介绍了检测每一页的方向在PDF使用ABCPDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来检测一个PDF文件的每个页面的方向?

Is there a way to detect the orientation of every page in a pdf file?

我创建,增加了水印(文本),以PDF文件的应用程序。
这些文件可以有页面纵向,横向或两者的结合

I am creating an application that adds watermarks(text) to pdf files. These files can have pages portrait, landscape or a combination of both.

使用doc.MediaBox财产,我使用下面的下面的逻辑:

Using the doc.MediaBox property, I use the following logic below:

portrait = box.Height > box.Width



我的问题是,它总是甚至在景观文件返回真值。

My problem is that, it is always returning a true value even on a landscape documents.

推荐答案

一个文档可以有每一个页面上的其他媒体框。要检查媒体框的页面N:

A Doc can have a different MediaBox on every single page. To inspect the Mediabox for page N:

doc.PageNumber = n
portrait = doc.Mediabox.Height > doc.Mediabox.Width

这篇关于检测每一页的方向在PDF使用ABCPDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆