Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question using exported PDF files with transparency #25

Closed
trailblazr opened this issue Sep 22, 2014 · 6 comments
Closed

Question using exported PDF files with transparency #25

trailblazr opened this issue Sep 22, 2014 · 6 comments

Comments

@trailblazr
Copy link

Is there any magic trick how actually preserve transparency in vector-files exported to PDF?

I was trying to make this work for my vector shapes I exported with PS as a PDF and nearly tried every preset & combination of options available, also deleted all other layers with only the vector shape remaining and exporting... still no success. Tried already using ImageMagick and other applications including ShrinkIt and Preview to re-export the PDF because in ImageMagick the background is actually transparent when loading the PDF there... but all my tried ended with the image still rendering with an opaque white background.

Is that a known issue or is there a special workflow/trick/hack I have to use to get transparency?
Or is there any hint how to change the workflow for exporting vector shapes to get a PDF rendered correctly that uses transparency?

Update: The only imaginable workaround I can think of right now is to produce an exact same image mask using a black & white image and apply this image mask to the PDFImage's CALayer. This actually works to stencil out the real graphic, but it produces sharp edges, and e.g. drop shadows which use alpha blending don't work anymore.

@skela
Copy link
Contributor

skela commented Sep 23, 2014

I generate PDFs using Inkscape via Print File and I can tell you I have no problems with this library to show transparency. Did you make sure the ImageView you stick the PDF image into has a clear background?

@trailblazr
Copy link
Author

Yep, basically applied opaque = NO and applied renderingmodeOriginal to the UIImage and backgroundColor = [UIColor clearColor] to the UIImageView, no change in result yet. I will try the "Print from Inkscape" process... thx for that hint. I will report as soon as I have a result.

@trailblazr
Copy link
Author

Okay, I tried to fix my issue… and finally succeeded… but it is a PITA in the process. I had to reopen (aka import) every "Saved as..."-EPS-File from Photoshop (PDF-Files did not work because InkScape could not ungroup the icon-vector-shape from the white background there) in InkScape. Manually ungroup the vector shape from the background (white box), then remove the background, then "Print as File..." from InkScape to the volume again. This removed the white box and really optimized the pdf to a very small size. I will try to document this process soon in my blog and then put a last comment on this issue to close it.

As said... it is a clumsy process, that makes keeping exporting 3 different PNG's rather fine if those 3 different sizes were okay for you. I needed more than 3, so it is economically worth it and saves some binary bytes in the deployed app in the end.

Cheers, all.

@skela
Copy link
Contributor

skela commented Sep 24, 2014

Sorry to hear that, but it certainly seems like your having a problem with your tools there ;) I've got 1 PDF that I can scale up and down without any issues, and this library works well for that, best one I've seen (Although I wish I could use SVG files directly (But all the svg libraries out there are horrible)).

@trailblazr
Copy link
Author

@skela Yep, without a doubt it is a really nice and clean Category. I love to use it and now it works great. It opens up new possibilities to auto adjust icons depending on the device orientation and the device resolution which is a great thing. I am really happy I found this piece of art here. It helps with the transition to the new way of iOS fragmentation-space made up by lots of different screen-scales and screen-sizes now.

@trailblazr
Copy link
Author

I actually wrote down my experiences and a short How-to how I fixed the alpha blending / transparency issue in a blogpost.

See here for more: http://www.thetawelle.de/?p=4234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants