pdfSetLineDashPattern2
Set (three input forms) or clear the current line-dash pattern
BOOL32 __stdcall pdfResetLineDashPattern(PPDF IPDF);
BOOL32 __stdcall pdfSetLineDashPattern(PPDF IPDF, const char* Dash, int32_t Phase);
BOOL32 __stdcall pdfSetLineDashPattern2(PPDF IPDF, float* Dash, uint32_t NumValues, float Phase);
BOOL32 __stdcall pdfSetLineDashPatternEx(PPDF IPDF, void* Dash, uint32_t NumValues, int32_t Phase);
function pdfResetLineDashPattern(const IPDF: PPDF): LongBool; stdcall;
function pdfSetLineDashPattern(const IPDF: PPDF; const Dash: PAnsiChar; Phase: Integer): LongBool; stdcall;
function pdfSetLineDashPattern2(const IPDF: PPDF; Dash: PSingle; NumValues: Cardinal; Phase: Single): LongBool; stdcall;
function pdfSetLineDashPatternEx(const IPDF: PPDF; Dash: Pointer; NumValues: Cardinal; Phase: Integer): LongBool; stdcall;
Purpose. Set (three input forms) or clear the current line-dash pattern applied to subsequently stroked paths.
Description. All three setters are real and emit a d dash-pattern operator immediately via WriteLineDash; pdfResetLineDashPattern emits an empty dash array (equivalent to a solid line) the same way. pdfSetLineDashPattern takes a human-readable dash spec string (e.g. "3 2" or "4,1", whitespace- or comma-separated) parsed number-by-number via TryStrToFloat with an invariant format — a token that fails to parse as a float is silently skipped rather than failing the whole call. pdfSetLineDashPattern2 and pdfSetLineDashPatternEx are the same operation over a raw NumValues-length array — 2 takes Single floats explicitly typed PSingle, while Ex takes an untyped Pointer that the implementation also reads as PSingle internally (i.e. despite the void*/Pointer signature suggesting a different or a caller-chosen element type, Ex is not actually more general than 2 — both read 32-bit floats).
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Dash | *(plain)* Dash spec string, e.g. "3 2". *(2/Ex)* Pointer to NumValues 32-bit floats — Ex's void* is read as PSingle despite its untyped signature. |
NumValues | *(2/Ex only)* Element count of Dash. |
Phase | Starting offset into the dash pattern. |
Return value. True on success; False if there is no current content stream.
Remarks. An empty dash array (pdfResetLineDashPattern, or any of the setters called with zero elements) means "solid line," per PDF spec.
See also. pdfGetLineWidth.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Setters
pdfSetLineDashPattern2
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.