<< Click to Display Table of Contents >> Navigation: Programming > Printing and PDF Export > Add PDF Export > Create embedded data objects |
Using WPTools 8 and wPDF V4 ist is possible to add an object to the PDF file which holds embedded data.
Example:
This feature uses the class TWPODataContainer. It is a descendant of TWPOImage and so able to display an image.
The embedded data is loaded by AddDataFile or AddDataStream.
function AddDataFile(Filename: WideString;
fsmode: TPDFEmbeddedFileElementFS = wpembDefault): string;
function AddDataStream(data: TStream;
fsmode: TPDFEmbeddedFileElementFS;
compressmode: TPDFEmbeddedFileElementCompress;
const ext_or_subtype: string): string;
Example code:
var obj : TWPTextObj;
begin
obj := WPRichText1.TextObjects.InsertClass('TWPODataContainer', 360, 360 );
if obj.IsImage then
begin
obj.Mode := obj.Mode + [wpobjSizingDisabled];
// obj.ObjRef.LoadFromFile('c:\a.bmp');
obj.ObjRef.AssignBitmap(Image1.Picture.Graphic);
(obj.ObjRef as TWPODataContainer).AddDataFile(Edit1.Text,wpembDefault);
(obj.ObjRef as TWPODataContainer).Icon := wpemTag; // wpemGraph;
(obj.ObjRef as TWPODataContainer).AddParam('Contents','Dies ist eine Datei');
(obj.ObjRef as TWPODataContainer).AddParam('Title', 'Julian Ziersch');
end;