title: How to set a constant transparency in a pdf for a radial gradient
body: <p>I am using javascript to create pdfs with gradients and transparency. I am using Firefox as my browser. It works with a linear gradient, but fails with a radial gradient. The only difference is these lines, with the linear coming first:</p>
  
  <pre><code>/linear0 scn
  /radial0 scn
  
  /ShadingType 2
  /ShadingType 3
  
  /Coords [300.000 301.000 350.000 350.000]
  /Coords [350.000 351.000 10.000 352.000 353.000 100.000]
  
  /linear0 5 0 R
  /radial0 5 0 R
  
  /CreationDate (D:20150812164749)
  /CreationDate (D:20150812164144)
  </code></pre>
  
  <p>And the xref is different because the file size is different. You can see the two files at:</p>
  
  <p><a href="http://www.rff.com/poudrepaddlers/linear.pdf" rel="nofollow">http://www.rff.com/poudrepaddlers/linear.pdf</a></p>
  
  <p><a href="http://www.rff.com/poudrepaddlers/radial.pdf" rel="nofollow">http://www.rff.com/poudrepaddlers/radial.pdf</a></p>
  
  <p>There must be some reason why the radial code doesn't use the alpha transparency, but I can't see the problem. Can anyone more familiar with pdf files see the problem?</p>
  
  <p>The linear gradient code is:</p>
  
  <pre><code>%PDF-1.7
  3 0 obj
  &lt;&lt;/Type /Page
  /Parent 1 0 R
  /Resources 2 0 R
  /Contents 4 0 R&gt;&gt;
  endobj
  4 0 obj
  &lt;&lt;/Length 218&gt;&gt;
  stream
  q
  4.000 w
  1.000 1.000 0.000 rg
  100.000 100.000 200.000 300.000 re
  f
  /gs0 gs
  1.000 0.000 0.000 RG
  /Pattern cs
  /linear0 scn
  150.000 500.000 m
  350.000 500.000 l
  350.000 200.000 l
  150.000 200.000 l
  150.000 300.000 l
  h
  B
  Q
  
  endstream
  endobj
  1 0 obj
  &lt;&lt;/Type /Pages
  /Kids [3 0 R ]
  /Count 1
  /MediaBox [0 0 612.00 792.00]
  &gt;&gt;
  endobj
  5 0 obj
  &lt;&lt;
  /Type /Pattern
  /PatternType 2
  /Shading &lt;&lt;
  /ShadingType 2
  /ColorSpace /DeviceRGB
  /Function &lt;&lt; /FunctionType 2 /N 1 /Domain [0 1] /C0 [ 1 0 1 ] /C1 [111]&gt;&gt;
  /Coords [300.000 301.000 350.000 350.000]
  /Extend [true true]
  &gt;&gt;
  &gt;&gt;
  endobj
  2 0 obj
  &lt;&lt;
  /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
  /Font &lt;&lt;
  &gt;&gt;
  /XObject &lt;&lt;
  &gt;&gt;
  /Pattern &lt;&lt;
  /linear0 5 0 R
  &gt;&gt;
  /ExtGState &lt;&lt;
  /gs0 &lt;&lt; /ca 0.500 &gt;&gt;
  &gt;&gt;
  /Shading &lt;&lt;
  &gt;&gt;
  &gt;&gt;
  endobj
  6 0 obj
  &lt;&lt;
  /Creator (rfdraw 1)
  /CreationDate (D:20150812164749)
  &gt;&gt;
  endobj
  7 0 obj
  &lt;&lt;
  /Type /Catalog
  /Pages 1 0 R
  &gt;&gt;
  endobj
  xref
  0 8
  0000000000 65535 f 
  0000000354 00000 n 
  0000000686 00000 n 
  0000000009 00000 n 
  0000000087 00000 n 
  0000000441 00000 n 
  0000000863 00000 n 
  0000000937 00000 n 
  trailer
  &lt;&lt;
  /Size 8
  /Root 7 0 R
  /Info 6 0 R
  &gt;&gt;
  startxref
  986
  %%EOF
  </code></pre>
  
  <p>The radial code is:</p>
  
  <pre><code>%PDF-1.7
  3 0 obj
  &lt;&lt;/Type /Page
  /Parent 1 0 R
  /Resources 2 0 R
  /Contents 4 0 R&gt;&gt;
  endobj
  4 0 obj
  &lt;&lt;/Length 218&gt;&gt;
  stream
  q
  4.000 w
  1.000 1.000 0.000 rg
  100.000 100.000 200.000 300.000 re
  f
  /gs0 gs
  1.000 0.000 0.000 RG
  /Pattern cs
  /radial0 scn
  150.000 500.000 m
  350.000 500.000 l
  350.000 200.000 l
  150.000 200.000 l
  150.000 300.000 l
  h
  B
  Q
  
  endstream
  endobj
  1 0 obj
  &lt;&lt;/Type /Pages
  /Kids [3 0 R ]
  /Count 1
  /MediaBox [0 0 612.00 792.00]
  &gt;&gt;
  endobj
  5 0 obj
  &lt;&lt;
  /Type /Pattern
  /PatternType 2
  /Shading &lt;&lt;
  /ShadingType 3
  /ColorSpace /DeviceRGB
  /Function &lt;&lt; /FunctionType 2 /N 1 /Domain [0 1] /C0 [ 1 0 1 ] /C1 [ 1 1 1 ] &gt;&gt;
  /Coords [350.000 351.000 10.000 352.000 353.000 100.000]
  /Extend [true true]
  &gt;&gt;
  &gt;&gt;
  endobj
  2 0 obj
  &lt;&lt;
  /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
  /Font &lt;&lt;
  &gt;&gt;
  /XObject &lt;&lt;
  &gt;&gt;
  /Pattern &lt;&lt;
  /radial0 5 0 R
  &gt;&gt;
  /ExtGState &lt;&lt;
  /gs0 &lt;&lt; /ca 0.500 &gt;&gt;
  &gt;&gt;
  /Shading &lt;&lt;
  &gt;&gt;
  &gt;&gt;
  endobj
  6 0 obj
  &lt;&lt;
  /Creator (rfdraw 1)
  /CreationDate (D:20150812171658)
  &gt;&gt;
  endobj
  7 0 obj
  &lt;&lt;
  /Type /Catalog
  /Pages 1 0 R
  &gt;&gt;
  endobj
  xref
  0 8
  0000000000 65535 f 
  0000000354 00000 n 
  0000000701 00000 n 
  0000000009 00000 n 
  0000000087 00000 n 
  0000000441 00000 n 
  0000000878 00000 n 
  0000000952 00000 n 
  trailer
  &lt;&lt;
  /Size 8
  /Root 7 0 R
  /Info 6 0 R
  &gt;&gt;
  startxref
  1001
  %%EOF
  </code></pre>