如何在pdf中为径向渐变设置恒定透明度

时间:2015-08-13 14:56:04

标签: javascript pdf transparency gradient

我正在使用javascript来创建具有渐变和透明度的pdf。我使用Firefox作为我的浏览器。它适用于线性渐变,但失败时带有径向渐变。唯一的区别是这些线,首先是线性的:

/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)

外部参照不同,因为文件大小不同。您可以在以下位置查看这两个文件:

http://www.rff.com/poudrepaddlers/linear.pdf

http://www.rff.com/poudrepaddlers/radial.pdf

径向代码不能使用alpha透明度必须有一些原因,但我无法看到问题。任何更熟悉pdf文件的人都能看到问题吗?

线性渐变代码为:

%PDF-1.7
3 0 obj
<</Type /Page
/Parent 1 0 R
/Resources 2 0 R
/Contents 4 0 R>>
endobj
4 0 obj
<</Length 218>>
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
<</Type /Pages
/Kids [3 0 R ]
/Count 1
/MediaBox [0 0 612.00 792.00]
>>
endobj
5 0 obj
<<
/Type /Pattern
/PatternType 2
/Shading <<
/ShadingType 2
/ColorSpace /DeviceRGB
/Function << /FunctionType 2 /N 1 /Domain [0 1] /C0 [ 1 0 1 ] /C1 [111]>>
/Coords [300.000 301.000 350.000 350.000]
/Extend [true true]
>>
>>
endobj
2 0 obj
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
/Font <<
>>
/XObject <<
>>
/Pattern <<
/linear0 5 0 R
>>
/ExtGState <<
/gs0 << /ca 0.500 >>
>>
/Shading <<
>>
>>
endobj
6 0 obj
<<
/Creator (rfdraw 1)
/CreationDate (D:20150812164749)
>>
endobj
7 0 obj
<<
/Type /Catalog
/Pages 1 0 R
>>
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
<<
/Size 8
/Root 7 0 R
/Info 6 0 R
>>
startxref
986
%%EOF

径向代码是:

%PDF-1.7
3 0 obj
<</Type /Page
/Parent 1 0 R
/Resources 2 0 R
/Contents 4 0 R>>
endobj
4 0 obj
<</Length 218>>
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
<</Type /Pages
/Kids [3 0 R ]
/Count 1
/MediaBox [0 0 612.00 792.00]
>>
endobj
5 0 obj
<<
/Type /Pattern
/PatternType 2
/Shading <<
/ShadingType 3
/ColorSpace /DeviceRGB
/Function << /FunctionType 2 /N 1 /Domain [0 1] /C0 [ 1 0 1 ] /C1 [ 1 1 1 ] >>
/Coords [350.000 351.000 10.000 352.000 353.000 100.000]
/Extend [true true]
>>
>>
endobj
2 0 obj
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
/Font <<
>>
/XObject <<
>>
/Pattern <<
/radial0 5 0 R
>>
/ExtGState <<
/gs0 << /ca 0.500 >>
>>
/Shading <<
>>
>>
endobj
6 0 obj
<<
/Creator (rfdraw 1)
/CreationDate (D:20150812171658)
>>
endobj
7 0 obj
<<
/Type /Catalog
/Pages 1 0 R
>>
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
<<
/Size 8
/Root 7 0 R
/Info 6 0 R
>>
startxref
1001
%%EOF

1 个答案:

答案 0 :(得分:0)

它适用于Adobe Reader,因此它可能是Firefox PDF阅读器中的一个错误。我将与Mozilla核实。