MCPcopy
hub / github.com/ArtifexSoftware/pdf2docx / to_stroke

Method to_stroke

pdf2docx/shape/Shape.py:273–292  ·  view source on GitHub ↗

Convert to Stroke instance based on width criterion. Args: max_border_width (float): Stroke width must less than this value. Returns: Stroke: Stroke instance. .. note:: A Fill from shape point of view may be a Stroke from content

(self, max_border_width:float)

Source from the content-addressed store, hash-verified

271 '''
272
273 def to_stroke(self, max_border_width:float):
274 '''Convert to Stroke instance based on width criterion.
275
276 Args:
277 max_border_width (float): Stroke width must less than this value.
278
279 Returns:
280 Stroke: Stroke instance.
281
282 .. note::
283 A Fill from shape point of view may be a Stroke from content point of view.
284 The criterion here is whether the width is smaller than defined ``max_border_width``.
285 '''
286 w = min(self.bbox.width, self.bbox.height)
287
288 # not a stroke if exceed max border width
289 if w > max_border_width:
290 return None
291 else:
292 return Stroke({'width': w, 'color': self.color}).update_bbox(self.bbox)
293
294
295 @property

Callers 1

clean_upMethod · 0.45

Calls 2

StrokeClass · 0.85
update_bboxMethod · 0.45

Tested by

no test coverage detected