mapbox / maki

A POI Icon Set
http://labs.mapbox.com/maki-icons/
Creative Commons Zero v1.0 Universal
1.5k stars 213 forks source link

Support PDFs for iOS, OS X, etc. #268

Open 1ec5 opened 8 years ago

1ec5 commented 8 years ago

Would it be within the scope of this project to provide bundles of PDFs for use in iOS and Mac applications?

PDF is the vector artwork format of choice on Apple platforms. Developers typically place these assets in an asset catalog, which gets compiled down to a single, compact binary file at build time. On OS X, it’s also common to have standalone PDFs in resource folders in the build product.

Depending on the situation, a developer might represent a single image with different PDFs at different resolutions, a single PDF for all resolutions, or a PDF with overrides for specific resolutions. Silhouette-style images like those in this project are typically rendered in black; the platform’s UI toolkit takes care of colorizing template images.

For an internal testbed application, I’ve been using this shell script to transform Maki icons into PDFs using Inkscape:

find * -name "*-24.svg" -exec inkscape /path/to/src/{} --export-pdf=/path/to/maki/.../{}
for f in `ls /path/to/maki/*-24.svg.pdf`; do mv $f ${f/-24.svg/}; done

/ref #247 /cc @samanpwbb @friedbunny @zugaldia

1ec5 commented 8 years ago

It might also be possible to distribute the PDFs via a package manager like CocoaPods.

samanpwbb commented 8 years ago

It might also be possible to distribute the PDFs via a package manager like CocoaPods.

I think that would be a better solution. I'd prefer to preserve SVG as the only output of this project. Maki can be used with NPM though – so you could create another project called maki-pdf that pulls in maki and creates PDFs

1ec5 commented 8 years ago

CocoaPods requires files to be hosted somewhere, ideally a GitHub repo. So maki-pdf (or maki-xcassets, as it were) could work.

zugaldia commented 8 years ago

@1ec5 How about a maki-mobile where we combine both iOS' PDFs and Android's vector drawables?

rmnblm commented 7 years ago

The script provided by @1ec5 is a little bit outdated. This should work:

  1. Download this repository and navigate into the icons folder.
  2. Create a script file

    $ touch export.sh
    $ nano export.sh
  3. Paste the following code inside

    #!/bin/bash
    mkdir $PWD/pdf
    for file in $PWD/*-15.svg
    do
     filename=$(basename $file)
     inkscape "$file" --export-pdf $PWD/pdf/"${filename%-15.svg}.pdf"
    done
  4. Now make this script executable

    $ sudo chmod +x export.sh
  5. Run the script

    $ ./export.sh

I'm still interested in a CocoaPods version of Maki 👍