Hi Stefan,
thank you very much for your quick answer. And of course, nobody of devs will replay on Sunday
So I updated to latest Version 321 and the exception still exists.
I created a simple WinForms-Project in c#, containing one button btnGetImageData.
Inside the click event 'btnGetImageData_Click' NotImplementedException occurs at line
PDFXCoreAPI.IMemBlock mem = image.
GetImageData(PDFXCoreAPI.PXC_ImageDataType.kIDT_Raw);
// ############### sample project ###########################################
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace TestPDFXCoreAPI
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private PDFXCoreAPI.PXC_Inst g_Inst = new PDFXCoreAPI.PXC_Inst();
private void MainForm_Load(object sender, EventArgs e)
{
// Initialialize Core SDK
g_Inst.Init(@"... < my key > ...");
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
FinalizeCoreSDK();
}
public void FinalizeCoreSDK()
{
g_Inst.Finalize();
g_Inst = null;
}
private void btnGetImageData_Click(object sender, EventArgs e)
{
// A PDF file, containing one or more pages with one image at least
FileInfo fi = new FileInfo("Test.pdf");
if (fi.Exists)
{
PDFXCoreAPI.IPXC_Document pDoc = g_Inst.OpenDocumentFromFile(fi.FullName, null);
if (pDoc != null && pDoc.Pages != null && pDoc.Pages.Count > 0)
{
PDFXCoreAPI.IPXC_Page pPage = pDoc.Pages[0];
PDFXCoreAPI.IPXC_Content content = pPage.GetContent(PDFXCoreAPI.PXC_ContentAccessMode.CAccessMode_Readonly);
PDFXCoreAPI.IPXC_ContentItems items = content.Items;
for (uint j = 0; j < items.Count; j++)
{
PDFXCoreAPI.IPXC_ContentItem item = items[j];
if (item.Type.ToString().ToUpper().Equals("CIT_IMAGE"))
{
PDFXCoreAPI.IPXC_ContentItem it = content.Items[j];
PDFXCoreAPI.IPXC_Image image = it.Image_Object;
if (image != null)
{
try
{
try
{
// Try to get raw data fails with a NotImplemented exception
// for all possible ImageDataTypes
PDFXCoreAPI.IMemBlock mem = image.GetImageData(PDFXCoreAPI.PXC_ImageDataType.kIDT_Raw);
}
catch (System.NotImplementedException ex)
{
Console.WriteLine("NotImplementedException:\t" + ex.Message);
}
}
catch (Exception ex)
{
Console.WriteLine("Exception:\t" + ex.Message);
}
}
// I'm interrested only at the first image
break;
}
}
}
if (pDoc != null)
pDoc.Close();
pDoc = null;
}
}
}
// #################################################
But may be, I will be able to find an other solution to get image data:
- Create a
PDFXCoreAPI.IIXC_Page from Image and
- Finally 'draw' bitmap myself with the help of IIXC_Page method
DrawToDC
Thanks and best regards.
Roland