Foxit PDF SDK
fsdk.Line Class Reference

Public Member Functions

def EnableCaption (cap)
 Set the flag which is used to decide whether the content of current line annotation should be replicated as a caption in the appearance or not.
More...
 
def GetCaptionOffset ()
 Get caption offset values.
More...
 
def GetCaptionPositionType ()
 Get the position type of caption.
More...
 
def GetEndPoint ()
 Get the end point.
More...
 
def GetLeaderLineExtensionLength ()
 Get the length of leader line extension.
More...
 
def GetLeaderLineLength ()
 Get the length of leader line.
More...
 
def GetLeaderLineOffset ()
 Get the length of leader line offset.
More...
 
def GetLineEndStyle ()
 Get line ending style of the end point.
More...
 
def GetLineStartStyle ()
 Get line ending style of the start point.
More...
 
def GetMeasureConversionFactor (measure_type)
 Get the conversion factor for measuring.
More...
 
def GetMeasureRatio ()
 Get the scale ratio string for measuring.
More...
 
def GetMeasureRatioW ()
 Get the scale ratio Unicode string for measuring.
More...
 
def GetMeasureUnit (measure_type)
 Get the label for displaying the units for measuring.
More...
 
def GetMeasureUnitW (measure_type)
 Get the label (in Unicode string) for displaying the units for measuring.
More...
 
def GetStartPoint ()
 Get the start point.
More...
 
def GetStyleFillColor ()
 Get fill color for ending styles.
More...
 
def HasCaption ()
 Check whether the content of current line annotation should be replicated as a caption in the appearance or not.
More...
 
def SetCaptionOffset (offset)
 Set caption offset values.
More...
 
def SetCaptionPositionType (cap_position)
 Set the position type of caption.
More...
 
def SetEndPoint (point)
 Set the end point.
More...
 
def SetLeaderLineExtensionLength (extension_length)
 Set the length of leader line extension.
More...
 
def SetLeaderLineLength (length)
 Set the length of leader line.
More...
 
def SetLeaderLineOffset (offset)
 Set the length of leader line offset.
More...
 
def SetLineEndStyle (ending_style)
 Set line ending style of the end point.
More...
 
def SetLineStartStyle (ending_style)
 Set line ending style of the start point.
More...
 
def SetMeasureConversionFactor (measure_type, factor)
 Set the conversion factor for measuring.
More...
 
def SetMeasureRatio (ratio)
 Set the scale ratio string for measuring.
More...
 
def SetMeasureUnit (measure_type, unit)
 Set the label for displaying the units for measuring.
More...
 
def SetStartPoint (point)
 Set the start point.
More...
 
def SetStyleFillColor (color)
 Set fill color for ending styles.
More...
 

Detailed Description

A line annotation displays a single straight line on the page.
Line annotation is a kind of markup annotation, so class Line is derived from class Markup , and also offers functions to get/set line annotation's properties and reset appearance stream of a line annotation.
For a line annotation, start point and end point are required. So please ensure that a line annotation has valid start point and end point before resetting its appearance stream; otherwise the line annotation cannot be reset appearance stream.

Note
For a newly created line annotation, if user calls function fsdk.Annot.ResetAppearanceStream directly after setting required start point and end point property and not setting any other properties, the default appearance will be used:
border width = 2.0, border style = fsdk.BorderInfoE_Solid , border color = 0xFFFF0000 (red), opacity = 1, line starting/ending styles = "None", no caption is enabled.
See also
Markup

Member Function Documentation

◆ EnableCaption()

def fsdk.Line.EnableCaption (   cap)

Set the flag which is used to decide whether the content of current line annotation should be replicated as a caption in the appearance or not.

This property has effect on line annotation's appearance. If user wants the effect to be shown in annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after this function.

Parameters
[in]captrue means the content should be replicated as a caption in the appearance of current line annotation, while false means not.
Returns
None.

◆ GetCaptionOffset()

def fsdk.Line.GetCaptionOffset ( )

Get caption offset values.

Caption offset is the offset of caption from its normal position.
Only when current line annotation have a caption, this property is meaningful and has effect on line's annotation's appearance. Function fsdk.Line.HasCaption can be used to check if current line annotation should have a caption, and function fsdk.Line.EnableCaption can be used to change the status.

Returns
A Offset object that receives horizontal offset and vertical offset for caption.
A Offset object with value (0, 0) may also mean that no caption offset values can be found.

◆ GetCaptionPositionType()

def fsdk.Line.GetCaptionPositionType ( )

Get the position type of caption.

Only when current line annotation have a caption, this property is meaningful and has effect on line's annotation's appearance. Function fsdk.Line.HasCaption can be used to check if current line annotation should have a caption, and function fsdk.Line.EnableCaption can be used to change the status.

Returns
The position type of caption. Please refer to values starting from fsdk.LineE_CapPosInline and this would be one of these values.

◆ GetEndPoint()

def fsdk.Line.GetEndPoint ( )

Get the end point.

Start point and end point are required for a line annotation. They have effect on line annotation's appearance.

Returns
The end point. A point with value (0, 0) may also mean that no start point is found.

◆ GetLeaderLineExtensionLength()

def fsdk.Line.GetLeaderLineExtensionLength ( )

Get the length of leader line extension.

Leader line extensions extend from the line proper 180 degrees from the leader lines.
For more details, please refer to "Line Annotations" in Section 8.4.5 "Annotation Types" of <PDF reference 1.7> .

Returns
The length of leader line extension.

◆ GetLeaderLineLength()

def fsdk.Line.GetLeaderLineLength ( )

Get the length of leader line.

Leader lines extend from each endpoint of a line perpendicular to the line itself. A positive value means that the leader lines appear in the direction that is clockwise when traversing the line from its start point to its end point; a negative value indicates the opposite direction. Specially, even the length of leader line is 0, the line annotation can still have leader line extension and leader line offset. For this case, the direction of leader line is same as positive length value in order that the direction or position of leader line extension and offset can still be judged.
For more details, please refer to "Line Annotations" in Section 8.4.5 "Annotation Types" of <PDF reference 1.7> .

Returns
The length of leader line.

◆ GetLeaderLineOffset()

def fsdk.Line.GetLeaderLineOffset ( )

Get the length of leader line offset.

Leader line offset is the amount of empty space between the endpoints of the line annotation and the beginning of the leader lines.
For more details, please refer to "Line Annotations" in Section 8.4.5 "Annotation Types" of <PDF reference 1.7> .

Returns
The length of leader line offset.

◆ GetLineEndStyle()

def fsdk.Line.GetLineEndStyle ( )

Get line ending style of the end point.

This property has effect on line annotation's appearance.

Returns
The line ending style of the end point. Please refer to values starting from fsdk.MarkupE_EndingStyleNone and this would be one of these values.

◆ GetLineStartStyle()

def fsdk.Line.GetLineStartStyle ( )

Get line ending style of the start point.

This property has effect on line annotation's appearance.

Returns
The line ending style of the start point. Please refer to values starting from fsdk.MarkupE_EndingStyleNone and this would be one of these values.

◆ GetMeasureConversionFactor()

def fsdk.Line.GetMeasureConversionFactor (   measure_type)

Get the conversion factor for measuring.

A line annotation may have a measure dictionary that specifies an alternate coordinate system for a region of a page. Please refer to P745 in <PDF Reference 1.7> for more details.

Parameters
[in]measure_typeMeasure type. Please refer to values starting from fsdk.MarkupE_MeasureTypeX and this would be one of these values.
Returns
The conversion factor.

◆ GetMeasureRatio()

def fsdk.Line.GetMeasureRatio ( )

Get the scale ratio string for measuring.

A line annotation may have a measure dictionary that specifies an alternate coordinate system for a region of a page. Scale ratio string expresses the scale ratio of the drawing in the region. Please refer to P745 in <PDF Reference 1.7> for more details.

Returns
A UTF-8 byte string that expresses the scale ratio.

◆ GetMeasureRatioW()

def fsdk.Line.GetMeasureRatioW ( )

Get the scale ratio Unicode string for measuring.

A line annotation may have a measure dictionary that specifies an alternate coordinate system for a region of a page. Scale ratio string expresses the scale ratio of the drawing in the region. Please refer to P745 in <PDF Reference 1.7> for more details.

Returns
A Unicode string that expresses the scale ratio.

◆ GetMeasureUnit()

def fsdk.Line.GetMeasureUnit (   measure_type)

Get the label for displaying the units for measuring.

A line annotation may have a measure dictionary that specifies an alternate coordinate system for a region of a page. Please refer to P745 in <PDF Reference 1.7> for more details.

Parameters
[in]measure_typeMeasure type. Please refer to values starting from fsdk.MarkupE_MeasureTypeX and this should be one of these values.
Returns
A UTF-8 text string that represents a label for displaying the units.

◆ GetMeasureUnitW()

def fsdk.Line.GetMeasureUnitW (   measure_type)

Get the label (in Unicode string) for displaying the units for measuring.

A line annotation may have a measure dictionary that specifies an alternate coordinate system for a region of a page. Please refer to P745 in <PDF Reference 1.7> for more details.

Parameters
[in]measure_typeMeasure type. Please refer to values starting from fsdk.MarkupE_MeasureTypeX and this should be one of these values.
Returns
A Unicode string that represents a label for displaying the units.

◆ GetStartPoint()

def fsdk.Line.GetStartPoint ( )

Get the start point.

Start point and end point are required for a line annotation. They have effect on line annotation's appearance.

Returns
The start point. A point with value (0, 0) may also mean that no start point is found.

◆ GetStyleFillColor()

def fsdk.Line.GetStyleFillColor ( )

Get fill color for ending styles.

This property has effect on line annotation's appearance. Fill color is used for some line ending styles:
"Square", "Circle", "Diamond", "ClosedArrow", "RClosedArrow".

Returns
The fill color of ending styles. Format: 0xRRGGBB. If no fill color can be found, 0x000000 will be returned.

◆ HasCaption()

def fsdk.Line.HasCaption ( )

Check whether the content of current line annotation should be replicated as a caption in the appearance or not.

Returns
true means the content should be replicated as a caption in the appearance of current line annotation. false means not to replicate the content as a caption in the appearance of current line annotation.

◆ SetCaptionOffset()

def fsdk.Line.SetCaptionOffset (   offset)

Set caption offset values.

Caption offset is the offset of caption from its normal position.
Only when current line annotation have a caption, this property is meaningful and has effect on line's annotation's appearance. Function fsdk.Line.HasCaption can be used to check if current line annotation should have a caption, and function fsdk.Line.EnableCaption can be used to change the status.
If user wants the effect to be shown in annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after this function.

Parameters
[in]offsetNew offset values .
Returns
None.

◆ SetCaptionPositionType()

def fsdk.Line.SetCaptionPositionType (   cap_position)

Set the position type of caption.

Only when current line annotation have a caption, this property is meaningful and has effect on line's annotation's appearance. Function fsdk.Line.HasCaption can be used to check if current line annotation should have a caption, and function fsdk.Line.EnableCaption can be used to change the status.
If user wants the effect to be shown in annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after this function.

Parameters
[in]cap_positionThe position type of caption. Please refer to values starting from fsdk.LineE_CapPosInline and this should be one of these values.
Returns
None.

◆ SetEndPoint()

def fsdk.Line.SetEndPoint (   point)

Set the end point.

Start point and end point are required for a line annotation. They have effect on line annotation's appearance.
If user wants the new end point has effect on annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after setting new end point.

Parameters
[in]pointNew point that specifies the end point.
Returns
None.

◆ SetLeaderLineExtensionLength()

def fsdk.Line.SetLeaderLineExtensionLength (   extension_length)

Set the length of leader line extension.

Leader line extensions extend from the line proper 180 degrees from the leader lines.
For more details, please refer to "Line Annotations" in Section 8.4.5 "Annotation Types" of <PDF reference 1.7> .

Parameters
[in]extension_lengthThe length of leader line extension. It should be a non-negative value. 0 means no leader line extension.
Returns
None.

◆ SetLeaderLineLength()

def fsdk.Line.SetLeaderLineLength (   length)

Set the length of leader line.

Leader lines extend from each endpoint of a line perpendicular to the line itself. A positive value means that the leader lines appear in the direction that is clockwise when traversing the line from its start point to its end point; a negative value indicates the opposite direction. Specially, even the length of leader line is 0, the line annotation can still have leader line extension and leader line offset. For this case, the direction of leader line is same as positive length value in order that the direction or position of leader line extension and offset can still be judged.
For more details, please refer to "Line Annotations" in Section 8.4.5 "Annotation Types" of <PDF reference 1.7> .

Parameters
[in]lengthThe length of leader lines. See details part for more details. 0 means no leader line.
Returns
None.

◆ SetLeaderLineOffset()

def fsdk.Line.SetLeaderLineOffset (   offset)

Set the length of leader line offset.

Leader line offset is the amount of empty space between the endpoints of the line annotation and the beginning of the leader lines.
For more details, please refer to "Line Annotations" in Section 8.4.5 "Annotation Types" of <PDF reference 1.7> .

Parameters
[in]offsetThe length of leader line offset. It should be a non-negative value. 0 means no leader line extension.
Returns
None.

◆ SetLineEndStyle()

def fsdk.Line.SetLineEndStyle (   ending_style)

Set line ending style of the end point.

This property has effect on line annotation's appearance. If user wants the new line ending style has effect on annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after setting new line ending style.

Parameters
[in]ending_styleThe line ending style for the end point to be set. Please refer to values starting from fsdk.MarkupE_EndingStyleNone and this should be one of these values.
Returns
None.

◆ SetLineStartStyle()

def fsdk.Line.SetLineStartStyle (   ending_style)

Set line ending style of the start point.

This property has effect on line annotation's appearance. If user wants the new line ending style has effect on annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after setting new line ending style.

Parameters
[in]ending_styleThe line ending style for the start point to be set. Please refer to values starting from fsdk.MarkupE_EndingStyleNone and this should be one of these values.
Returns
None.

◆ SetMeasureConversionFactor()

def fsdk.Line.SetMeasureConversionFactor (   measure_type,
  factor 
)

Set the conversion factor for measuring.

A line annotation may have a measure dictionary that specifies an alternate coordinate system for a region of a page. Please refer to P745 in <PDF Reference 1.7> for more details.

Parameters
[in]measure_typeMeasure type. Please refer to values starting from fsdk.MarkupE_MeasureTypeX and this would be one of these values.
[in]factorThe conversion factor.
Returns
None.

◆ SetMeasureRatio()

def fsdk.Line.SetMeasureRatio (   ratio)

Set the scale ratio string for measuring.

A line annotation may have a measure dictionary that specifies an alternate coordinate system for a region of a page. Scale ratio string expresses the scale ratio of the drawing in the region. Please refer to P745 in <PDF Reference 1.7> for more details.

Parameters
[in]ratioA UTF-8 byte string expressing the scale ratio. The string should be like: "1/4 in = 1 ft", indicating that 1/4 inches in default user space is equivalent to 1 foot in real-world measurements.
Returns
None.

◆ SetMeasureUnit()

def fsdk.Line.SetMeasureUnit (   measure_type,
  unit 
)

Set the label for displaying the units for measuring.

A line annotation may have a measure dictionary that specifies an alternate coordinate system for a region of a page. Please refer to P745 in <PDF Reference 1.7> for more details.

Parameters
[in]measure_typeMeasure type. Please refer to values starting from fsdk.MarkupE_MeasureTypeX and this should be one of these values.
[in]unitA UTF-8 text string that specifies a label for displaying the units.
Returns
None.

◆ SetStartPoint()

def fsdk.Line.SetStartPoint (   point)

Set the start point.

Start point and end point are required for a line annotation. They have effect on line annotation's appearance.
If user wants the new start point has effect on annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after setting new start point.

Parameters
[in]pointNew point that specifies the start point.
Returns
None.

◆ SetStyleFillColor()

def fsdk.Line.SetStyleFillColor (   color)

Set fill color for ending styles.

This property has effect on line annotation's appearance. Fill color is used for some line ending styles:
"Square", "Circle", "Diamond", "ClosedArrow", "RClosedArrow".
If user wants the new fill color has effect on annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after setting new fill color.

Parameters
[in]colorNew fill color of ending style. Format: 0xRRGGBB.
Returns
None.