I have this code, but the results look wrong...
Some part may be because I do not size the webview correctly first... No sure. But the coloring is probably because of the underneath code... Unfortunately. Will post some attachments...
TmpNSDataRef := FWebBrowser.FWebView_Cocoa.dataWithPDFInsideRect(FWebBrowser.FWebView_Cocoa.bounds);
TmpNSImage := NSImage.alloc.initWithData(TmpNSDataRef);
if TmpNSImage.Representations.Count = 0 then
Exit
;
TmpNSDataRef := TmpNSImage.TIFFRepresentation;
TmpTiffImage := TTiffImage.Create;
TmpMemStream := TmsOverlayFixedMemoryStream.Create;
TmpMemStream.SetPointer(TmpNSDataRef.Bytes, TmpNSDataRef.Length);
try
TmpTiffImage.LoadFromStream(TmpMemStream);
Result := TBitmap.Create;
try
Result.Assign(TmpTiffImage);
except
Result.Free;
Result := nil;
end;
finally
TmpTiffImage.free;
TmpMemStream.free;
end;
TmpNSImage.dealloc;
UpdateAbove code does not even work properly... When called a few times in row
TmpNSDataRef := FWebBrowser.FWebView_Cocoa.dataWithPDFInsideRect(FWebBrowser.FWebView_Cocoa.bounds);
causes a bad crash (I think ind the webview widget itself, so not useful callstack)
After a lot trial and error that specific line above seems to be the problem (and not e.g. resizing of the kinda-a offscreen form hosting the webview ... been experimenting quite a bit)
For the screenshots the above does manage to make before crashing they
1) look horrible miscolored (maybe e.g. only red black and white shades)
2) the page is repeated horizontally once (only partially visible but still)