I need to crop pdf and create word document of that cropped png image by pasting that in word document.
I am using Firemonkey Platform
this is code :
procedure TForm2.Button1Click(Sender: TObject);
begin
ShellExecute(FormToHWND(Self),'open',PChar(GetCurrentDir+'\cairo.exe')
,PWideChar('-opw '+Edit1.Text+
' -cropbox -png -x 64 -y 215 -W 144 -H 375 -r 167 '+
PdfFile+' tools/card'),'',SW_Hide);
Sleep(500);
Image1.Bitmap.LoadFromFile(Output);
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
ClipBoard.Assign(Image1.Bitmap);
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
Output:= GetCurrentDir+'\tools\card-1.png';
end;
Clicking on button2 pops the error Cannot assign TBitmapOfItem to TClipBoard.
How to copy the image to clipboard and create word document (don't know much about it) ?
Simple example how you can copy some Image to Clipboard in FMX:
uses
FMX.Platform;
...
procedure TForm1.Button1Click(Sender: TObject);
var
VClipboard: IFMXClipboardService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXClipboardService, VClipboard) then begin
Image1.Bitmap.LoadFromFile('c:\image_1.png');
VClipboard.SetClipboard(Image1.Bitmap);
end;
end;
More information about using Clipboard in FMX apps here: Multi-Device Apps and Clipboard Support