For now, my pattern is just trying to draw a line:
59 0 obj
<<
/Type /Pattern /PatternType 1 /PaintType 1 /TilingType 2 /BBox [0 0
100 100] /XStep 100 /YStep 100 /Resources 58 0 R /Length 57
>>
stream
0.2 0.2 0.8 rg 0.2 0.8 0.2 RG 5 w 1 J 0 0 m 100 100 l S
endstream
endobj
The pattern doesn't need any resources:
58 0 obj
<<
>>
endobj
The pattern appears inside the page's resources object:
2 0 obj
<<
/ProcSet [/PDF/Text/ImageC/ImageB]
/Font <<
/F0 8 0 R
/F1 11 0 R
>>
/XObject <<
/img0 31 0 R
/img1 32 0 R
>>
/Pattern <<
/P1 59 0 R
>>
/ExtGState << /SRCAND << /Type /ExtGState /BM /Darken >> /SSMULT << /
Type /ExtGState /BM /Multiply >> /SSDIFF << /Type /ExtGState /BM /
Difference >> /SRCPAINT << /Type /ExtGState /BM /Lighten >> >>
>>
endobj
And I draw it like this:
q
0.0 G
1.0 1.0 0.0 rg
0.0 0.0 1.0 RG
/Pattern cs
/P1 scn
/P1 SCN
148.00 -148.00 20.00 -20.00 re B
Q
When I load this into Adobe Acrobat, it says "Invalid ColorSpace".
Any suggestions? I've been looking at every byte in my PDF streams,
comparing them against the example in the PDF reference and the
descriptions of the PDF operators, and everything looks correct to me,
but clearly it ain't.
Any help appreciated!
Thanks,
Chris
I have not worked with patterns, but from a quick glance at your code, I
think I see the problem.
The default colorspace is grayscale. You seem to be trying to define RGB
colors in the grayscale colorspace. I don't see anywhere where you
define a different colorspace (unless I am missing something. I only
work in grayscale.)
I found the problem ... I was doing a "stroke and fill" (B) but my
pattern apparently only knows how to fill. When I replaced the 'B'
with an 'f' it started working.
Chris