Knowledgebase

Back to Articles List

I have a problem with PXC_GetPage, application crashed when using with existing document.

Problem:

I have a problem with PXC_GetPage application crashing when using with existing document.

I want to extract a page from an existing document and change the scale of the page. The application crashed on the PXC_GetPage function (which is Ok if I used a variable created with PXC_NewDocument)

var
res : HRESULT;
page: PXCPage;
pcnt : dword ;
newdoc : HPDF ;
begin
if FormMainMenu.hDocument <> 0 then
res := PXC_GetPage(FormMainMenu.hDocument, 0, @page) ; => Crashed
res := PXC_CS_Scale(page, 0.5, 0.5); // change the scale

Resolution:

This is expected behavior - because all of our DLL's do not allow "mixed" usage: all handles (documents, pages, etc) can be operable only within the same library from which you get them. So a document handle, created using xcpro40.dll, cannot be used in functions from pxclib40.dll and vice versa. It is the same for pxcview.dll. There is only one exception, Image-XChange, page handles can be used in functions from another DLL, where it is declared.

If you need to add some content to existing page you should create new document with this content, save it to disk, read using xcpro40.dll and place over existing using PXCp_PlaceContents.

If you need to place contents on several pages, it is recommended that you do this all at once - this will be faster and the resulting file will be smaller.

Was this article helpful?
Yes No Somewhat