WPCubed Product Support

ReadAttachment

Okay found the problem in the meantime.

between the command COMPDF_Attachment_List and the Command COMPDF_Attachment_GetProp i did a reload of the PDF itself.

I mean i freed the TWPViewPDF and recreated and reloaded it.

If i call both commands within the same TWPViewPDF it works as it should

#3 ♥ 0
2.1k Views 2 users read 1 min
wpsupport

Did you receive a list of entries?
Is the name you of the data you need to extract listed there?
"Index" would be the index in this list.

#2 ♥ 0

Hello i just tried to read an attachment form the PDF File.

The following command returns correct 1 (there is one XML File attached)

count := pdfView.command(COMPDF_Attachment_List);
if count > 0 then Data := ReadAttachment(pdfView, 0);
function ReadAttachment(pdfview : TWPViewPDF; Index : integer) : string
var
    sSize       : integer;
    propIdx     : string;
begin
		propIdx := temp.CommandGetStr( COMPDF_Attachment_GetProp, '', Index);
    sSize   := temp.Command( COMPDF_Attachment_GetData );
		if sSize >= 0 then begin
				setlength(Result, sSize);
				temp.CommandEx( COMPDF_MakeGetMEMORY, Cardinal( @Result[1] ) );        
    end;
end;

But this function doesn't work, the first COMPDF_Attachment_GetProp returns an empty string - i have copied the code from unit WPViewpdfAttachmentlist;

can you point me to the wrong code?

#1 ♥ 0