GenerallyHelpfulSoftware / SVGgh

A framework for using SVG artwork in iOS Apps. Includes a UIView and a button class, printing and PDF export.
MIT License
141 stars 38 forks source link

Cannot export following svg to pdf? #19

Closed allen8300 closed 8 years ago

allen8300 commented 8 years ago

Hi man, I really cannot dig out why our code cannot export following svg to pdf? 2-1.svg.zip

grhowes commented 8 years ago

Well it looks as though there is some bug in my library that is preventing it from being rendered as intended. All I'm seeing is the back gradient. I'll look into what the issue is, although that is one big file.

allen8300 commented 8 years ago

Yeah, the same as I thought. Right here waiting for your reply. Thanks so much.

grhowes commented 8 years ago

It looks as though the problems are with these lines: `

    <stop  offset="0.3655" style="stop-color:#FF0000"/>
    <stop  offset="0.7087" style="stop-color:#FF0000"/>
    <stop  offset="1" style="stop-color:#FF7378"/>
</linearGradient>
<rect x="638.838" y="382.103" fill="url(#SVGID_5_)" width="0" height="10.488"/>`

I'm guessing there is some sort of clipping problem with linear gradients.

allen8300 commented 8 years ago

So you mean it's due to the shortcoming of SVG format itself?

grhowes commented 8 years ago

No, I mean that there was a bug in my code that wasn't handling filling a rectangle of width zero with a gradient. I will fix that now. You can see for yourself by looking in the SVG you sent me and where you see a rectangle using SVGID5 changing width to ".01" or some other small number.

grhowes commented 8 years ago

OK, I checked in some code into master to fix this issue. Do you need me to release a new cocoa pod?

allen8300 commented 8 years ago

Thanks so much man, better if you can release a new cocoa pod.

grhowes commented 8 years ago

OK version 1.5.2 is released.

allen8300 commented 8 years ago

Man, much better and nearly there. While, I think we can make it perfect if we can fix the font issue. Just checking the difference between origin svg and output pdf in following zip file. Archive.zip

grhowes commented 8 years ago

Well it looks as though there is no "Impact" font installed on either iOS 8 or iOS 9, so it's falling back to Helvetica.

allen8300 commented 8 years ago

I did further testing with two common fonts in origin svg file, while the result is the same. I also mark the two fonts name in the origin svg file, you can have a look.

Archive.zip

allen8300 commented 8 years ago

How is it, did you have time to check it, man?

grhowes commented 8 years ago

Well, I put in code to handle underlines. But like I said, “Impact” is not installed on iOS.

—glenn

On Jan 25, 2016, at 1:33 AM, allen8300 <notifications@github.com mailto:notifications@github.com> wrote:

How is it, did you have time to check it, man?

— Reply to this email directly or view it on GitHub https://github.com/GenerallyHelpfulSoftware/SVGgh/issues/19#issuecomment-174416332.