【问题标题】:How to set a constant transparency in a pdf for a radial gradient如何在 pdf 中为径向渐变设置恒定透明度
【发布时间】:2015-08-13 14:56:04
【问题描述】:

我正在使用 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

radial 代码不使用 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

【问题讨论】:

    标签: javascript pdf transparency gradient


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-24
      • 1970-01-01
      • 2020-11-06
      相关资源
      最近更新 更多