I'm porting PDFium to Lazarus (again). There's an older port, but it's windows only, and doesn't do some things I wanted. And it's not in Git. So:
https://github.com/grahamegrieve/PdfiumLibIt compiles for Windows, Linux and OSX, and the example works fine on Windows. But on linux, I get an exception rendering the PDF. The source of the exception is in gtk2widgetset.inc, line 4285:
if SrcDevContext.Drawable = nil then RaiseSrcDrawableNil;
SrcDevContext is indeed nil. I don't know why - should it be? or what should I do to make it not nil? The code that sets up the error is in PDFiumCtrl (line 750):
PageDC := CreateCompatibleDC(DC);
OldPageBmp := SelectObject(PageDC, FPageBitmap);
try
if FRenderedPageIndex <> PageIndex then
begin
FRenderedPageIndex := PageIndex;
Draw(PageDC, 0, 0, Page);
end;
BitBlt(DC, FDrawX, FDrawY, FDrawWidth, FDrawHeight, PageDC, 0, 0, SRCCOPY);
There's a whole set of things going on here that I'm not familar with around DCs and bitmaps, and it all works on windows, but not linux. is it me doing something wrong?
Lazarus Version: 2.3.0, trunk 25th Oct, revision = main-2_3-520-gcff7d7fdb8. To reproduce,
https://github.com/bblanchon/pdfium-binaries tag c854f3e80a81e0999b68596d40c6b1f99a34ee1a , compile the example and open any PDF (I think)