Invalid argument using PXCp_ET_GetElement

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, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan

Post Reply
Max SAG
User
Posts: 30
Joined: Thu Oct 30, 2014 8:54 am

Invalid argument using PXCp_ET_GetElement

Post by Max SAG » Fri Jan 15, 2016 4:07 pm

Hi,

I'm using the PDF-Tools SDK and I encounter an issue with the XCPro40 library (4.0.311.0) in a WPF project (C#/XAML) in Visual Studio 2012.

Using the "ExtractTextToOtherPDFDocument" sample of the PXCp_ET_AnalyzePageContent documentation page, the PXCp_ET_GetElement method always returns the code -2113404927 ("Invalid argument").

I first call PXCp_ET_Prepare, then PXCp_ET_AnalyzePageContent, then the PXCp_ET_GetElementCount (which returns a positive number of elements) and then PXCp_ET_GetElement:

Code: Select all

XCPro40.PXP_TextElement element;
var result = XCPro40.PXCp_ET_GetElement(_pdfId, i, out element, 1);

Code: Select all

[DllImport("xcpro40")]
public static extern int PXCp_ET_GetElement(int pDocument, int index, out PXP_TextElement pElement, int flags);

Code: Select all

[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct PXP_TextElement
{
    public int cbSize;
    public int mask;
    public short[] Characters;
    public double[] Offsets;
    public int Count;
    public int FontIndex;
    public double FontSize;
    public PXC_Matrix Matrix;
    public double CharSpace;
    public double WordSpace;
    public double Th;
    public double Leading;
    public double Rise;
    public int FillColor;
    public int StrokeColor;
    public PXC_TextRenderingMode RenderingMode;
};
The _pdfId is the right one, i is always inferior to the GetElementCount, I tried 0, 1, 2 and 4 for the flag parameter. The last thing which could be problematic is my declaration of PXP_TextElement.
Am I missing something?

EDIT: I've just found that PXCp_ET_AnalyzePageContent returns the warning code 1108289444 ("End of data while parsing") for all the pdf files I've tried, maybe it's not a good thing.

Regards,

Max

User avatar
Sasha - Tracker Dev Team
User
Posts: 4218
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Invalid argument using PXCp_ET_GetElement

Post by Sasha - Tracker Dev Team » Thu Jan 21, 2016 9:01 am

Hello Max SAG,

We are updating the sample for C# and will post it for you when we'll finish.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Max SAG
User
Posts: 30
Joined: Thu Oct 30, 2014 8:54 am

Re: Invalid argument using PXCp_ET_GetElement

Post by Max SAG » Thu Jan 21, 2016 11:19 am

Hi,

Ok, thanks for your time, I'll wait for your sample.

Regards,

Max

User avatar
Sasha - Tracker Dev Team
User
Posts: 4218
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Invalid argument using PXCp_ET_GetElement

Post by Sasha - Tracker Dev Team » Tue Jan 26, 2016 3:43 pm

Hello Max SAG,

We updated the sample. Here you go :wink:
Attachments
PXCProDemo.zip
(663.19 KiB) Downloaded 81 times
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Max SAG
User
Posts: 30
Joined: Thu Oct 30, 2014 8:54 am

Re: Invalid argument using PXCp_ET_GetElement

Post by Max SAG » Wed Jan 27, 2016 3:21 pm

Hi,

Awesome, works like a charm, thanks a lot.
It's very similar to the C++ example after all...
My PXCp_ET_GetElement and PXP_TextElement declarations were wrong, my bad.

Regards,

Max

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13424
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Invalid argument using PXCp_ET_GetElement

Post by Tracker Supp-Stefan » Wed Jan 27, 2016 4:06 pm

Glad to hear it's working properly for you Max!

Cheers,
Stefan

Post Reply