简体   繁体   English

检测PDF是否为彩色[DATALOGICS] [APDFL]

[英]Detect if PDF is colored [DATALOGICS][APDFL]

I am using APDFL 10.1.0 to convert PDF to images. 我正在使用APDFL 10.1.0将PDF转换为图像。 This is how I am loading the PDF file and saving a specific page as image: 这就是我加载PDF文件并将特定页面保存为图像的方式:

Document pdfdocument = null;
pdfdocument = new Document(docpath);
Page docpage = pdfdocument.GetPage(pagelist[0]);
Image pageimage = docpage.GetImage(PageRect);

Is there a way to detect from either the docpage variable or the pageimage variable if the specific page is colored or is grayscale? 有没有一种方法可以从docpage变量或pageimage变量中检测特定页面是彩色的还是灰度的?

You can use pageImage.NumberComponents to determine this. 您可以使用pageImage.NumberComponents来确定这一点。 Color Images will have 3 or 4 components (depending on whether it is an RGB Image or a CMYK Image) while grayscale Images will have 1 component. 彩色图像将具有3个或4个分量(取决于是RGB图像还是CMYK图像),而灰度图像将具有1个分量。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM