I am currently working on a Wrapper of your PDF document class. I want a method that extracts all images and returns a System.Drawing.Image Array.
Here is my Code:
Code: Select all
private Image[] GetImagesFromContentItem(PDFXEdit.IPXC_Content content)
{
var imageList = new List<Image>();
PDFXEdit.IIXC_Page ip;
var items = content.Items;
for (uint j = 0; j < items.Count; j++)
{
var itemType = items[j].Type;
if (itemType == PDFXEdit.PXC_CIType.CIT_Image || itemType == PDFXEdit.PXC_CIType.CIT_InlineImage)
{
ip = items[j].Image_CreateIXCPage(false, PDFXEdit.PXC_RenderingIntent.RI_RelativeColorimetric);
uint hbitmap = ip.CreateHBitmap();
var ptr = new IntPtr(hbitmap);
imageList.Add(Bitmap.FromHbitmap(ptr));
DeleteObject(ptr);
}
if (itemType == PDFXEdit.PXC_CIType.CIT_XForm)
{
var xFormHandle = items[j].XForm_Handle;
var xForm = this.Document.GetXFormByHandle(xFormHandle);
var contentxForm = xForm.GetContent(PDFXEdit.PXC_ContentAccessMode.CAccessMode_WeakClone);
imageList.AddRange(GetImagesFromContentItem(contentxForm));
}
}
return imageList.ToArray();
}
The Problem is, that this Code leads to overflow exceptions, when i use the x86 dll.
Any Idea how i could resolve this issue?
kind regards,
Kutusow