Error [Pdf Structure Library]: Invalid object structure.

PDF-XChange Editor SDK for Developers

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi Team,
I got a scanned document (PDF/A 1b, see attachment), which I open from stream. It is shown properly in the AxPXV_Control.
The document is not modified, but when it is saved (IPXV_Document.Save), the failure 'Error [Pdf Structure Library]: Invalid object structure.' occurs.

Other documents are working.

Would you please check this document?

ScannedDocument.pdf
(2.46 MiB) Downloaded 111 times
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19750
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Stefan - PDF-XChange »

Hello khho,

You seem to be using the Editor SDK.
With your permission I will move this topic to the correct Editor SDK forum.

Can you please confirm the exact build of the SDK that you are using?
As the end user Editor (build 386) does not seem to have any issues with saving that file.
However the End user Editor does not show this file to being a PDF/A one either.
Or are you trying to take this as source, and save it as PDF/A 1b file?

Kind regards,
Stefan
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi,
sorry, yes I'm using the PDF-XChange Editor SDK, so please move it to right forum.

The DLL-Files we use are 381. I tried it with 386 - same problem.

Kind regards,
k.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2442
Joined: Thu Jun 30, 2005 4:11 pm

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Vasyl - PDF-XChange »

Hi khho.

We cannot reproduce that error with the latest 10.3.0.386 build. The test app saves the doc successfully.

Can you provide simple codesnippet to reproduce the problem on our side?

Cheers.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi Vasyl,
the code is very 'distributed' - that will take a while.

Can you delete page 2 and save? And when you reload that saved document, is there a hint that problems where found?

Best regards
k.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19750
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Stefan - PDF-XChange »

Hello khho,

Just tested with the end user Editor - deleting page 2 and saving the file afterwards worked without any errors or warnings!

Kind regards,
Stefan
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi,
can you do it via the AxPXV_Control, too?

k.
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi,
here's some C# code:

pdfView is the AxPXV_Control

the document is loaded from a stream

Code: Select all

var comStreamWrapper = new COMStreamWrapper(binaryData);
pdfView.OpenDocFrom(comStreamWrapper, null);
when delete pages is called document restrictions are removed

Code: Select all

var pdfDocument = pdfView.Doc;
if (pdfDocument != null)
{
    pdfDocument.CoreDoc.SetRestrictedPermissions(0);
}
cmd.document.deletePages is called

Code: Select all

DeletePagesEventMonitor myDeletePagesMonitor = new DeletePagesEventMonitor(pdfView.Inst.Str2ID("DlgDeletePages"), this);
var uiInst = (IUIX_Inst)pdfView.Inst.GetExtension("UIX");
uiInst.CurrentThreadCtx.RegisterEventMonitor(myDeletePagesMonitor);
pdfView.Inst.ExecUICmd(commandName, pdfView.Doc.ActiveView.Obj);
uiInst.CurrentThreadCtx.UnregisterEventMonitor(myDeletePagesMonitor);
Marshal.ReleaseComObject(uiInst);
if the dialogue wasn't canceled save the document

Code: Select all

var doc = pdfView.Doc;
if (doc != null)
{
    try
    {
        doc.Save();
        Marshal.ReleaseComObject(doc);
    }
    catch (Exception exp)
    {
        HandlePdfXChangeException(exp);
    }
}
Then (often) the error occurs on doc.Save().

We use the x86 Version of the AxPXV_Control.

Is there a way to check if the structure is right by the SDK? And a way to try to repair?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2442
Joined: Thu Jun 30, 2005 4:11 pm

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Vasyl - PDF-XChange »

I suppose something can be wrong in the 'COMStreamWrapper<->binaryData' bound. Can you provide the implementation of your COMStreamWrapper? Seems it isn't a standard type from the .NET framework...

OR/AND - can you reproduce the same issue with the normal local file?

And what kind of container for binaryData do you use?
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi Vasyl,
thank you for your post. Due to a public holiday my reply is delayed.

I can't reproduce the issue if I load the pdf file with AxPXV_Control.OpenDocFromPath.

Find the COMStreamWrapper class attached. 'binaryData' is a Stream (usually a MemoryStream).

Kind regards
k.


COMStreamWrapper.zip
(1.43 KiB) Downloaded 178 times
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi,
sometimes the program chrashes with an unhandled exception:
Exception at 0x2DD35532 (PDFXEditCore.x86.dll) in dmp: 0xC0000005: Access violation while reading at position 0x00000020

k.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2442
Joined: Thu Jun 30, 2005 4:11 pm

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Vasyl - PDF-XChange »

Finally, we found an issue with saving documents on our side, especially when saving to the same source stream. We will fix it soon. Also, later, I will provide you the fixed COMStreamWrapper.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi Vasyl,
thank you for your answer!

Keep me up to date.
k.
User avatar
Dimitar - PDF-XChange
Site Admin
Posts: 2187
Joined: Mon Jan 15, 2018 9:01 am

Error [Pdf Structure Library]: Invalid object structure.

Post by Dimitar - PDF-XChange »

:)
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hello Tracker team,
can you already estimate when the fix will be available?

Kind regards
k.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10745
Joined: Wed Jan 03, 2018 6:52 pm

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Daniel - PDF-XChange »

Hello, khho

With our very small dev team (some of whom are located in Ukraine, and may need to pack up on short notice), all reports, requests, and otherwise are unfortunately not something we can offer solid timelines on at this time.

From Vasyl's reply above, I can infer that he "hopes" to have this resolved in time for the next release, whenever that is.
Build 386 was released less than a month ago. It is possible we will see a smaller (10.3.1) bugfixing release in the next few weeks. However, this build has widely been very stable, so it is also possible the next release will be a larger (10.4.0) feature release. In the latter case, that would put a release estimate somewhere in the ballpark of 1-3 months from now.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hello Team,
is there an updated schedule to this issue?

Thank you!
khho
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19750
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Stefan - PDF-XChange »

Hello khho,

A new build is planned for the coming weeks - so the fix would hopefully be included in that.
We will have a meeting with the devs later today, so I expect to have an exact date for the next release for you by tomorrow.

Kind regards,
Stefan
intus
User
Posts: 1
Joined: Tue Jun 11, 2024 9:44 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by intus »

Hello,

we're also having this issue.

Is the fix included in the new release (10.3.1.387)?

Kind regards,
intus
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19750
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Stefan - PDF-XChange »

Hello intus,

The best way to check that would be to download and try out the current build.
We try to include the most important fixes in the version history, however some items might be fixed and not listed in there.

Kind regards,
Stefan
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2442
Joined: Thu Jun 30, 2005 4:11 pm

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Vasyl - PDF-XChange »

We fixed this issue in 387. And yes, we do not include sdk-fixes in our end-user product build history.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi Vasyl,
thanks a lot for the informations!

"Finally, we found an issue with saving documents on our side, especially when saving to the same source stream. We will fix it soon. Also, later, I will provide you the fixed COMStreamWrapper."

Does the COMStreamWrapper still need to be fixed?

Cheers
khho
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19750
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Stefan - PDF-XChange »

Hello khho,

That post was from the first half of May. I presume that message was valid at the time so that you can test before the official release of the new build. If you just download 387 now it should include all the necessary fixes.

Kind regards,
Stefan
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi Stefan,
thanks for the answer.

Antoher Question:
The API has changed from

Code: Select all

var uiInst = (IUIX_Inst)pdfInst.GetExtension("UIX");
var uiCommands = uiInst.CmdManager.Cmds;
to

Code: Select all

var uiInst = (IUIX_Inst)pdfInst.GetExtension("UIX");
var uiCommands = uiInst.get_CmdManager().Cmds;
Does get_CmdManager() delivers the same as CmdManager? (analogue Theme, CurenntThreadCtx)
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Dear Team,
very first tests showed no damaged stream with Version 10.3.1.387.

But we got another issue.
We use C#-code

Code: Select all

            var doc = pdfView.Doc; // where pdfView is the AxPXV_Control
            if (doc != null)
            {
                try
                {
                    doc.Save();
	 	    ...
When I use this code (which has not changed ) with the 64bit-DLL of Interop.PDFXEdit.dll (which we took from "...\Program Files (x86)\Tracker Software\Editor SDK\Samples\PDFEditorSDKExamples.x64\") we run into this error:
System.MissingMethodException
Fehlermeldung:
Methode nicht gefunden: "Void PDFXEdit.IPXV_Document.Save(System.Object, Int32, PDFXEdit.IProgressMon, PDFXEdit.IPXV_ExportConverter, PDFXEdit.ICab, PDFXEdit.IAFS_FileSys, PDFXEdit.ICab, UInt32)".
Do you have any idea what might be the reason?

Cheers
khho
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19750
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Stefan - PDF-XChange »

Hello khho,

I asked a colleague from the dev team to take a look and advise!

Kind regards,
Stefan
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Dear Stefan,
is there anything new from the colleagues?

Thanks in advance
khho
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19750
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Stefan - PDF-XChange »

Hello khho,

I've just asked Vasyl once again to check this topic and advise on any further information he has on this!

Kind regards,
Stefan
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2442
Joined: Thu Jun 30, 2005 4:11 pm

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Vasyl - PDF-XChange »

Hi khho,

The interop-dlls aren't part of our SDK. They are just auxiliary components made by Visual Studio when we added the Editor ActiveX control to the .NET Example projects and build them. Your Visual Studio IDE should be able to create own interops in moment when you build your project with our ActiveX added to the project's References section. Or you may just create a blank WinForms project with the necessary .NET version specified, add our ActiveX control to the Form object (via Toolbox > Choose Items > COM Components > PDF-XChange Editor ActiveX Control). Then build the project for x86 and x64 platforms and then look to the build-folders for new interops. Then you may use such interops in your real project as well.

HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Dear team,
I did it the second way (via a blank WinForms project). The builded interops used in our real project lead to the same issue as described above.

Regards,
khho
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2442
Joined: Thu Jun 30, 2005 4:11 pm

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Vasyl - PDF-XChange »

We couldn't reproduce your trouble on our side. We tested the latest 387 build in the new WinForm app, and everything looks good.

There is attached such WinForm project:
TestWinFormsApp.zip
(876.41 KiB) Downloaded 97 times
Please be sure that the latest version of PDFXEditCore.x64.dll module is registered in your system (387 build). You may run the cmd:

regsvr32 PDFXEditCore.x64.dll

(in cmd-console with admin rights)
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
khho
User
Posts: 51
Joined: Fri Mar 11, 2022 11:02 am

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by khho »

Hi Vasyl,
thank you for the demo app! It works.
PDFXEditCore.x64.dll is registered.

But we still got that problem in our software...

Regards
khho
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19750
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Stefan - PDF-XChange »

Hello khho,

If the sample project works, then please check what your other app and code are doing differently and update it to do it the same way as the sample Vasyl provided and it should start working as well!

Kind regards,
Stefan
MedBooster
User
Posts: 1372
Joined: Mon Nov 15, 2021 8:38 pm

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by MedBooster »

Error [Pdf Structure Library]: Invalid object structure.

I have received this error a few times, now when trying to save to a Google Drive folder, is the error about not finding the folder, or is it the file that is corrupted?
image.png
My wishlist https://forum.pdf-xchange.com/viewtopic.php?p=187394#p187394
Disable SPACE page navigation, fix kb shortcut for highlighting advanced search tool search field, bookmarks with numbers, toolbar small icon size, AltGr/Ctrl+Alt keyboard issues
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19750
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Error [Pdf Structure Library]: Invalid object structure.

Post by Stefan - PDF-XChange »

Hello MedBooster,

That is an error for the internal structure of the PDF file itself. So it is an error about a corrupted document not for a problematic connection.

Kind regards,
Stefan
Post Reply