How to use the xhtml2pdf.util.getBorderStyle function in xhtml2pdf

To help you get started, we’ve selected a few xhtml2pdf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xhtml2pdf / xhtml2pdf / tests / test_utils.py View on Github external
def test_will_return_value_if_passed_value_is_not_none_or_hidden(self):
        style = getBorderStyle("foo", default="blah")
        self.assertEqual(style, "foo")
github xhtml2pdf / xhtml2pdf / tests / test_utils.py View on Github external
def test_will_return_default_if_passed_value_is_non_case_sensitive_none(self):
        style = getBorderStyle("None", default="blah")
        self.assertEqual(style, "blah")
github xhtml2pdf / xhtml2pdf / xhtml2pdf / tables.py View on Github external
c.frag.borderBottomStyle,
                c.frag.borderBottomColor,
                c.frag.borderLeftWidth,
                c.frag.borderLeftStyle,
                c.frag.borderLeftColor,
                c.frag.borderRightWidth,
                c.frag.borderRightStyle,
                c.frag.borderRightColor,
            ))

        if getBorderStyle(c.frag.borderTopStyle) and c.frag.borderTopWidth and c.frag.borderTopColor is not None:
            self.add_style(('LINEABOVE', begin, (end[0], begin[1]),
                            c.frag.borderTopWidth,
                            c.frag.borderTopColor,
                            "squared"))
        if getBorderStyle(c.frag.borderLeftStyle) and c.frag.borderLeftWidth and c.frag.borderLeftColor is not None:
            self.add_style(('LINEBEFORE', begin, (begin[0], end[1]),
                            c.frag.borderLeftWidth,
                            c.frag.borderLeftColor,
                            "squared"))
        if getBorderStyle(c.frag.borderRightStyle) and c.frag.borderRightWidth and c.frag.borderRightColor is not None:
            self.add_style(('LINEAFTER', (end[0], begin[1]), end,
                            c.frag.borderRightWidth,
                            c.frag.borderRightColor,
                            "squared"))
        if getBorderStyle(
                c.frag.borderBottomStyle) and c.frag.borderBottomWidth and c.frag.borderBottomColor is not None:
            self.add_style(('LINEBELOW', (begin[0], end[1]), end,
                            c.frag.borderBottomWidth,
                            c.frag.borderBottomColor,
                            "squared"))
        self.add_style(
github xhtml2pdf / xhtml2pdf / xhtml2pdf / xhtml2pdf_reportlab.py View on Github external
def _drawBorderLine(bstyle, width, color, x1, y1, x2, y2):
            # We need width and border style to be able to draw a border
            if width and getBorderStyle(bstyle):
                # If no color for border is given, the text color is used (like defined by W3C)
                if color is None:
                    color = style.textColor
                    # print "Border", bstyle, width, color
                if color is not None:
                    canvas.setStrokeColor(color)
                    canvas.setLineWidth(width)
                    canvas.line(x1, y1, x2, y2)
github xhtml2pdf / xhtml2pdf / xhtml2pdf / tables.py View on Github external
if getBorderStyle(c.frag.borderTopStyle) and c.frag.borderTopWidth and c.frag.borderTopColor is not None:
            self.add_style(('LINEABOVE', begin, (end[0], begin[1]),
                            c.frag.borderTopWidth,
                            c.frag.borderTopColor,
                            "squared"))
        if getBorderStyle(c.frag.borderLeftStyle) and c.frag.borderLeftWidth and c.frag.borderLeftColor is not None:
            self.add_style(('LINEBEFORE', begin, (begin[0], end[1]),
                            c.frag.borderLeftWidth,
                            c.frag.borderLeftColor,
                            "squared"))
        if getBorderStyle(c.frag.borderRightStyle) and c.frag.borderRightWidth and c.frag.borderRightColor is not None:
            self.add_style(('LINEAFTER', (end[0], begin[1]), end,
                            c.frag.borderRightWidth,
                            c.frag.borderRightColor,
                            "squared"))
        if getBorderStyle(
                c.frag.borderBottomStyle) and c.frag.borderBottomWidth and c.frag.borderBottomColor is not None:
            self.add_style(('LINEBELOW', (begin[0], end[1]), end,
                            c.frag.borderBottomWidth,
                            c.frag.borderBottomColor,
                            "squared"))
        self.add_style(
            ('LEFTPADDING', begin, end, c.frag.paddingLeft or self.padding))
        self.add_style(
            ('RIGHTPADDING', begin, end, c.frag.paddingRight or self.padding))
        self.add_style(
            ('TOPPADDING', begin, end, c.frag.paddingTop or self.padding))
        self.add_style(
            ('BOTTOMPADDING', begin, end, c.frag.paddingBottom or self.padding))
github xhtml2pdf / xhtml2pdf / xhtml2pdf / tables.py View on Github external
end,
                c.frag.borderTopWidth,
                c.frag.borderTopStyle,
                c.frag.borderTopColor,
                c.frag.borderBottomWidth,
                c.frag.borderBottomStyle,
                c.frag.borderBottomColor,
                c.frag.borderLeftWidth,
                c.frag.borderLeftStyle,
                c.frag.borderLeftColor,
                c.frag.borderRightWidth,
                c.frag.borderRightStyle,
                c.frag.borderRightColor,
            ))

        if getBorderStyle(c.frag.borderTopStyle) and c.frag.borderTopWidth and c.frag.borderTopColor is not None:
            self.add_style(('LINEABOVE', begin, (end[0], begin[1]),
                            c.frag.borderTopWidth,
                            c.frag.borderTopColor,
                            "squared"))
        if getBorderStyle(c.frag.borderLeftStyle) and c.frag.borderLeftWidth and c.frag.borderLeftColor is not None:
            self.add_style(('LINEBEFORE', begin, (begin[0], end[1]),
                            c.frag.borderLeftWidth,
                            c.frag.borderLeftColor,
                            "squared"))
        if getBorderStyle(c.frag.borderRightStyle) and c.frag.borderRightWidth and c.frag.borderRightColor is not None:
            self.add_style(('LINEAFTER', (end[0], begin[1]), end,
                            c.frag.borderRightWidth,
                            c.frag.borderRightColor,
                            "squared"))
        if getBorderStyle(
                c.frag.borderBottomStyle) and c.frag.borderBottomWidth and c.frag.borderBottomColor is not None:
github xhtml2pdf / xhtml2pdf / xhtml2pdf / tables.py View on Github external
c.frag.borderRightWidth,
                c.frag.borderRightStyle,
                c.frag.borderRightColor,
            ))

        if getBorderStyle(c.frag.borderTopStyle) and c.frag.borderTopWidth and c.frag.borderTopColor is not None:
            self.add_style(('LINEABOVE', begin, (end[0], begin[1]),
                            c.frag.borderTopWidth,
                            c.frag.borderTopColor,
                            "squared"))
        if getBorderStyle(c.frag.borderLeftStyle) and c.frag.borderLeftWidth and c.frag.borderLeftColor is not None:
            self.add_style(('LINEBEFORE', begin, (begin[0], end[1]),
                            c.frag.borderLeftWidth,
                            c.frag.borderLeftColor,
                            "squared"))
        if getBorderStyle(c.frag.borderRightStyle) and c.frag.borderRightWidth and c.frag.borderRightColor is not None:
            self.add_style(('LINEAFTER', (end[0], begin[1]), end,
                            c.frag.borderRightWidth,
                            c.frag.borderRightColor,
                            "squared"))
        if getBorderStyle(
                c.frag.borderBottomStyle) and c.frag.borderBottomWidth and c.frag.borderBottomColor is not None:
            self.add_style(('LINEBELOW', (begin[0], end[1]), end,
                            c.frag.borderBottomWidth,
                            c.frag.borderBottomColor,
                            "squared"))
        self.add_style(
            ('LEFTPADDING', begin, end, c.frag.paddingLeft or self.padding))
        self.add_style(
            ('RIGHTPADDING', begin, end, c.frag.paddingRight or self.padding))
        self.add_style(
            ('TOPPADDING', begin, end, c.frag.paddingTop or self.padding))