Created
April 13, 2016 14:08
-
-
Save Polaringu/9976a8bacdeb65a8c30d83a9d279ea11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint m_nImagesCount = 0; | |
private void CountImageTypeContentItems(PDFXEdit.IPXC_Document srcDoc, PDFXEdit.IPXC_Content content) | |
{ | |
//Getting image or inline image types of the content items | |
for (uint j = 0; j < content.Items.Count; j++) | |
{ | |
PDFXEdit.IPXC_ContentItem ci = content.Items[j]; | |
if ((ci.Type == PDFXEdit.PXC_CIType.CIT_Image) || (ci.Type == PDFXEdit.PXC_CIType.CIT_InlineImage)) | |
{ | |
m_nImagesCount++; | |
} | |
else if (ci.Type == PDFXEdit.PXC_CIType.CIT_XForm) | |
{ | |
PDFXEdit.IPXC_XForm xform = srcDoc.GetXFormByHandle(ci.XForm_Handle); | |
if (xform != null) | |
{ | |
PDFXEdit.IPXC_Content xContent = xform.GetContent(PDFXEdit.PXC_ContentAccessMode.CAccessMode_Readonly); | |
CountImageTypeContentItems(srcDoc, xContent); | |
} | |
} | |
} | |
} | |
private void getImagesCountToolStripMenuItem_Click(object sender, EventArgs e) | |
{ | |
m_nImagesCount = 0; | |
for (uint i = 0; i < pdfCtl.Doc.CoreDoc.Pages.Count; i++) | |
{ | |
PDFXEdit.IPXC_Page page = pdfCtl.Doc.CoreDoc.Pages[i]; | |
PDFXEdit.IPXC_Content content = page.GetContent(PDFXEdit.PXC_ContentAccessMode.CAccessMode_Readonly); | |
CountImageTypeContentItems(pdfCtl.Doc.CoreDoc, content); | |
} | |
MessageBox.Show(Convert.ToString(m_nImagesCount)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment