PDFPAGE_SetDash
IPDFDocument3 :: PDF page methods

See Also Example
Collapse All

This method provides pattern control of dashes and gaps.

Examples of line dash patterns:

Dash string

Patterns

Description

"[] 0"

No dash, solid line.

"[3] 0"

3 units on, 3 off, ...

"[2] 1"

1 on, 2 off, 2 on, 2 off, …

"[2 1] 0"

2 on, 1 off, 2 on, 1 off, …

"[3 5] 6"

2 off, 3 on, 5 off, 3 on, 5 off, …

"[2 3] 11"

1 on, 3 off, 2 on, 3 off, 2 on, …

Syntax

HRESULT PDFPAGE_SetDash (
BSTR dashString
)
Parameters
dashString
The line dash pattern string.

Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.

Remarks

The line dash pattern controls the pattern of dashes and gaps used to stroke paths. Before beginning to stroke a path, the dash array is cycled through, adding up the lengths of dashes and gaps. When the accumulated length equals the value specified by the dash phase, stroking of the path begins, using the dash array in a cycle from that point forward.

Use PDFPAGE_NoDash to reset the dash pattern; that is, to discontinue drawing with dashes.

Equivalent in new interface: IPDFDocument4::SetLineDash.

Example

Setting the Line-Dash Style

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
PDF.PDFPAGE_SetLineWidth(2);
PDF.PDFPAGE_SetDash('[8 5 11 3] 7');
PDF.PDFPAGE_MoveTo(10, 10);
PDF.PDFPAGE_LineTo(110, 10);
PDF.PDFPAGE_Stroke;
PDF.PDFPAGE_NoDash;
PDF.PDFPAGE_MoveTo(10, 15);
PDF.PDFPAGE_LineTo(110, 15);
PDF.PDFPAGE_Stroke;
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
PDF->PDFPAGE_SetLineWidth(2);
PDF->PDFPAGE_SetDash("[8 5 11 3] 7");
PDF->PDFPAGE_MoveTo(10, 10);
PDF->PDFPAGE_LineTo(110, 10);
PDF->PDFPAGE_Stroke();
PDF->PDFPAGE_NoDash();
PDF->PDFPAGE_MoveTo(10, 15);
PDF->PDFPAGE_LineTo(110, 15);
PDF->PDFPAGE_Stroke();
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
PDF.PDFPAGE_SetLineWidth(2);
PDF.PDFPAGE_SetDash("[8 5 11 3] 7");
PDF.PDFPAGE_MoveTo(10, 10);
PDF.PDFPAGE_LineTo(110, 10);
PDF.PDFPAGE_Stroke();
PDF.PDFPAGE_NoDash();
PDF.PDFPAGE_MoveTo(10, 15);
PDF.PDFPAGE_LineTo(110, 15);
PDF.PDFPAGE_Stroke();
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
PDF.PDFPAGE_SetLineWidth 2
PDF.PDFPAGE_SetDash "[8 5 11 3] 7"
PDF.PDFPAGE_MoveTo 10, 10
PDF.PDFPAGE_LineTo 110, 10
PDF.PDFPAGE_Stroke
PDF.PDFPAGE_NoDash
PDF.PDFPAGE_MoveTo 10, 15
PDF.PDFPAGE_LineTo 110, 15
PDF.PDFPAGE_Stroke
PDF.EndDoc

See Also

Reference