Set border properties. Either a dict, or direct arguments width, style, dashes or clouds.
(self, border=None, width=-1, style=None, dashes=None, clouds=-1)
| 1322 | mupdf.pdf_dict_put_name(annot_obj, PDF_NAME('BM'), blend_mode) |
| 1323 | |
| 1324 | def set_border(self, border=None, width=-1, style=None, dashes=None, clouds=-1): |
| 1325 | """Set border properties. |
| 1326 | |
| 1327 | Either a dict, or direct arguments width, style, dashes or clouds.""" |
| 1328 | CheckParent(self) |
| 1329 | atype, atname = self.type[:2] # annotation type |
| 1330 | if atype not in ( |
| 1331 | mupdf.PDF_ANNOT_CIRCLE, |
| 1332 | mupdf.PDF_ANNOT_FREE_TEXT, |
| 1333 | mupdf.PDF_ANNOT_INK, |
| 1334 | mupdf.PDF_ANNOT_LINE, |
| 1335 | mupdf.PDF_ANNOT_POLY_LINE, |
| 1336 | mupdf.PDF_ANNOT_POLYGON, |
| 1337 | mupdf.PDF_ANNOT_SQUARE, |
| 1338 | ): |
| 1339 | message(f"Cannot set border for '{atname}'.") |
| 1340 | return None |
| 1341 | if atype not in ( |
| 1342 | mupdf.PDF_ANNOT_CIRCLE, |
| 1343 | mupdf.PDF_ANNOT_FREE_TEXT, |
| 1344 | mupdf.PDF_ANNOT_POLYGON, |
| 1345 | mupdf.PDF_ANNOT_SQUARE, |
| 1346 | ): |
| 1347 | if clouds > 0: |
| 1348 | message(f"Cannot set cloudy border for '{atname}'.") |
| 1349 | clouds = -1 # do not set border effect |
| 1350 | if type(border) is not dict: |
| 1351 | border = {"width": width, "style": style, "dashes": dashes, "clouds": clouds} |
| 1352 | border.setdefault("width", -1) |
| 1353 | border.setdefault("style", None) |
| 1354 | border.setdefault("dashes", None) |
| 1355 | border.setdefault("clouds", -1) |
| 1356 | if border["width"] is None: |
| 1357 | border["width"] = -1 |
| 1358 | if border["clouds"] is None: |
| 1359 | border["clouds"] = -1 |
| 1360 | if hasattr(border["dashes"], "__getitem__"): # ensure sequence items are integers |
| 1361 | border["dashes"] = tuple(border["dashes"]) |
| 1362 | for item in border["dashes"]: |
| 1363 | if not isinstance(item, int): |
| 1364 | border["dashes"] = None |
| 1365 | break |
| 1366 | annot = self.this |
| 1367 | annot_obj = mupdf.pdf_annot_obj( annot) |
| 1368 | pdf = mupdf.pdf_get_bound_document( annot_obj) |
| 1369 | return JM_annot_set_border( border, pdf, annot_obj) |
| 1370 | |
| 1371 | def set_colors(self, colors=None, stroke=None, fill=None): |
| 1372 | """Set 'stroke' and 'fill' colors. |
nothing calls this directly
no test coverage detected