TakeVirtualFile

Workflow data tools, Virtual files, ActiveX, DLL

Description

Removes a virtual file from the registry and returns its bytes

Syntax

ActiveX

Function PDFlib::TakeVirtualFile(FileName As String) As Variant

DLL

const char* DLTakeVirtualFile(int InstanceID, const wchar_t* FileName);
const char* DLTakeVirtualFileA(int InstanceID, const char* FileName);

Parameters

InstanceIDLibrary instance returned by DLCreateLibrary
FileNameRegistered file name

Return values

Returns borrowed binary data; read its length with DLAnsiStringResultLength and copy it before another call. Nil means the file was not registered

Remarks

Only one caller can take a file, which makes it suitable for handing a result to exactly one consumer

The data may contain zero bytes, so never treat it as a zero-terminated string

The virtual file registry is shared by every library instance in the process and is used by every mem:// path and by registered file names; scope workflow resources under a unique prefix

ActiveX exposes this method on IPDFlibrary24; obtain it with CoPDFlibrary.CreateEditionTools24 or query the default interface of PDFlibAX 4.74 or later. ActiveX returns a byte array Variant (an empty array for an empty file) or Empty when the file is not registered

All editions include these functions. Failed ActiveX calls return an empty string, 0 or Empty and record the reason for GetWorkflowToolsError. The C#, VB.NET and Visual C++ WorkflowTools examples in the DLL and ActiveX demo folders show a complete request, page plan and rollback workflow

See also

Workflow data tools · Virtual file registry · GetWorkflowToolsError