Beyond line width: Extensive analysis of line objects (10.0)

Beginning with pdfToolbox 10, extensive options to analyze "lines" on a page have been added.

In "PDF speak", lines are "stroked paths" – vector based descriptions of lines and curves, that – when a stroking operation is applied to them – look like lines. There are limitless ways to make use of stroked paths, that often will look like lines, but also in some cases may look like something else. For example, a line that is 10 pt long and 10 pt wide will not look like a line but rather like a filled square. Also, a line of length zero, but with round line endings, will look like a circle whose diameter is the same as the line width of that line.

Furthermore, a "stroked path" could be open or closed. It is closed if the start point and end point of a path (or sub-path) coincide. (and a closing operation has been applied). A stroked path could consist of only one or of several sub-paths, each looking like its own line object, but painted as if it were one object. All sub-paths in a stroked path will share the same graphical properties, such as color, overprint or transparency settings, form of line endings, or line width. For any stroked path that consists of two or more sub-paths, two or more stroked paths each with just one sub-path could be used to create the apparently same lines.

As lines can come in so  many flavors, and as requirements in print production have evolved a lot recently, additional analysis capabilities have been introduced with pdfToolbox 10. The remainder of this article gives an overview of the new properties that can be used for analyzing lines.

The following properties have been added to the "Page description" group:

  • Stroked but not filled:
    Determines whether a path object is stroked but not filled
  • Filled but not stroked:
    Determines whether a path object is filled but not stroked
  • Filled and stroked:
    Determines whether a path object is filled and stroked
  • Number of sub-paths:
    Returns the number of sub-paths in a path object
  • Number of open sub-paths:
    Returns the number of open sub-paths in a path object
  • Number of closed sub-paths:
    Returns the number of closed sub-paths in a path object
  • Number of points in path object:
    Returns the total number of points of all sub-paths in a path object
  • Smallest number of points in sub-path:
    Returns the smallest number of points in a sub-path in a path object
  • Largest number of points in sub-path:
    Returns the largest number of points in a sub-path in a path object
  • Number of straight lines in path object:
    Returns the total number of straight lines in all sub-paths in a path object
  • Number of curved lines in path object:
    Returns the total number of curved lines in all sub-paths in a path object
  • Number of rectangles in path object:
    Returns the total number of rectangles in all sub-paths in a path object

The following properties have been added to the  "Graphic state properties for stroke" group:

  • Stroked path object is solid line:
    Determines whether a stroked path object is a solid line
  • Stroked path object is dashed line:
    Determines whether a stroked path object is a dashed line
  • Stroked path object is dotted line:
    Determines whether a stroked path object is a dotted line
  • Stroked path object is line with dashes and dots:
    Determines whether a stroked path object is a line using a combination of dots and dashes
  • Dash array of a stroked path object:
    Returns the the dash array of a stroked path object as a string
  • Effective length of shortest dash in stroked path object:
    Returns the effective length – taking the line cap shape into account – of the shortest dash in a dashed and/or dotted stroked path object
  • Effective length of longest dash in stroked path object:
    Returns the effective length – taking the line cap shape into account – of the longest dash in a dashed and/or dotted stroked path object
  • Effective average length of dashes in stroked path object:
    Returns the effective average length – taking the line cap shape into account – of the dashes in a dashed and/or dotted stroked path object
  • Effective length of shortest gap in stroked path object:
    Returns the effective length – taking the line cap shape into account – of the shortest gap in a dashed and/or dotted stroked path object
  • Effective length of longest gap in stroked path object:
    Returns the effective length – taking the line cap shape into account – of the longest gap in a dashed and/or dotted stroked path object
  • Effective average length of gaps in stroked path object:
    Returns the effective average length – taking the line cap shape into account – of the gaps in a dashed and/or dotted stroked path object

0 Comments

Send Your Comment

E-Mail me when someone replies to this comment