PXC_AddImageFromMemory returning S_OK but _PXCImage* is 0

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
omascia
User
Posts: 48
Joined: Thu Mar 11, 2010 7:07 pm

PXC_AddImageFromMemory returning S_OK but _PXCImage* is 0

Post by omascia »

Hello,

Attempting to add a B/W image built in memory using PXC_AddImageFromMemory using MemType_8bpp. According to the documentation: "The image has a maximum of 256 colors, and the pal (which must be valid) contains up to 256 entries. Each pixel in the image is represented by one byte, the value of which is an index in the palette."

The API returns S_OK, but the _PXCImage* is still 0 (as initialized before the call) and a PXC_PlaceImage using that identifier returns invalid object id. The question is: what supposed error in the data might get PXC_AddImageFromMemory to say it succeeded when it failed returning a image object id?

I have a very simple memory structure. A square image of 174x174 pixels. The buffer is 174x174 bytes (1 byte per pixel). These pixel bytes are 0 for white and 1 for black and the palette is defined as : RGBQUAD pal[256] = { { 0xff, 0xff, 0xff, 0 }, { 0, 0, 0, 0 } };

The code is similar to this:

// bmsize is 174, pbitmap points to the first byte of the array 174x174 bytes, the lDelta is then positive and equal to bmsize (174)

_PXCImage* imageid = 0;
HRESULT hres = PXC_AddImageFromMemory(page, MemType_8bpp, pbitmap, bmsize,
&pal[0], 256, bmsize, bmsize, bmsize*bmsize, &imageid);
if (IS_DS_FAILED(hres))
...

hres is S_OK and yet imageid == 0

What trivial thing have I misunderstood from the documentation?

Thanks !
omascia
User
Posts: 48
Joined: Thu Mar 11, 2010 7:07 pm

Re: PXC_AddImageFromMemory returning S_OK but _PXCImage* is

Post by omascia »

Hum, err, huh...
What trivial thing have I misunderstood from the documentation?
Do not pass _PXCPage to AddImage... but _PXCDocument.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17910
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PXC_AddImageFromMemory returning S_OK but _PXCImage* is

Post by Tracker Supp-Stefan »

Hello omascia,

So did you manage to resolve the issue between your two posts?
(I am not too sure if the second one says that the problem is solved)

Regards,
Stefan
omascia
User
Posts: 48
Joined: Thu Mar 11, 2010 7:07 pm

Re: PXC_AddImageFromMemory returning S_OK but _PXCImage* is

Post by omascia »

So did you manage to resolve the issue between your two posts?
(I am not too sure if the second one says that the problem is solved)
Oh yes, this topic is resolved. My terse comment meant that.
I'm making an habit of having some problem, post about it in last resort, then finding the solution within minutes of posting. :(
:D
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17910
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PXC_AddImageFromMemory returning S_OK but _PXCImage* is

Post by Tracker Supp-Stefan »

Hi omascia,

It usually works like this! (to find the solution the moment you ask for help with it!) :D

Glad this one is resolved!
Cheers,
Stefan
Post Reply