Page 1 of 1

Background color with GetBrush

Posted: Wed Sep 15, 2021 4:38 pm
by jPV
According the pdf.GetBrush documentation, if you don't set the page background transparent, it should be white. This doesn't seem to be the case with all PDFs.. with some files you get black background and then texts aren't readable etc (black on black).

Setting bg to transparent seems to work and you can draw the brush over another white brush or something like that, but this work-around slows down things especially on lower spec machines.

So, is there any other work-around, should something be fixed, why is this happening? Can I detect when Polybios fails to show white bg somehow, so that work-arounds could be made only when needed?

Here's an example code... download these example PDF files for it: file 1 and file 1

Code: Select all

@DISPLAY {Width=612, Height=792, Color=#RED}
@REQUIRE "polybios"
f = {
    "PhotoFolioV2.3_Manual.pdf",
    "TVPUserGuide.pdf"
}
For Local i=0 To 1
    pdf.OpenDocument(1, f[i])
    For Local j=0 To 1
        pdf.GetBrush(1, 1, 1, j)
        Cls
        DisplayBrush(1, #CENTER, #CENTER)
        If j Then TextOut(30, 0, "Transparent bg works.") Else TextOut(30, 0, "Background should be white, not black!")
        WaitLeftMouse()
        FreeBrush(1)
    Next
    pdf.CloseDocument(1)
Next

Re: Background color with GetBrush

Posted: Sun Sep 19, 2021 2:46 pm
by airsoftsoftwair

Code: Select all

- Fix: pdf.GetBrush() didn't add a white background for PDFs that didn't have a proper media box setting

Re: Background color with GetBrush

Posted: Sun Dec 15, 2024 2:56 pm
by James
Any news on when this fix will be released? It will make a lot of difference to many old PDFs.

Re: Background color with GetBrush

Posted: Mon Dec 16, 2024 10:17 pm
by airsoftsoftwair
Soon hopefully, an update for Polybios definitely has a high priority here because it also needs support for macOS ARM.

Re: Background color with GetBrush

Posted: Tue Dec 17, 2024 1:36 pm
by James
That would be great, thanks. :D