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

Generated PDF is off center #316

Open
Gio2018 opened this issue Mar 1, 2021 · 2 comments
Open

Generated PDF is off center #316

Gio2018 opened this issue Mar 1, 2021 · 2 comments
Labels

Comments

@Gio2018
Copy link
Contributor

Gio2018 commented Mar 1, 2021

Expected behavior:
Once an icon is approved and grunt has been executed, the generated pdf file should be centered

Actual behavior:
The generated pdf is off-center. As a reference these two pdf were recently auto-generated:

trending icon

recent icon

@Gio2018 Gio2018 added the bug label Mar 1, 2021
@davewhitley
Copy link
Contributor

@folletto just in case you have any ideas here. Probably the pdf generator?

@folletto
Copy link
Contributor

The problem doesn't seem to be in the PDF, but in the SVG. When I regenerate all the PDFs, I get all of them correct but a few specific images, like trending.

Guess: the SVG path is not centered, but drawn as if it's positioned at the origin. For some reason it still works when the SVG with the rectangle is generated, but it doesn't with PDF specs.

Digging a bit:

  • If I export that same trending SVG from Sketch to SVG, it doesn't work.
  • If I export that same trending SVG from Illustrator to SVG, it works.

Sketch export:

<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <title>gridicons-trending</title>
    <g id="gridicons-trending" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <polygon id="Path" fill="#000000" fill-rule="nonzero" points="16 6 18.29 8.29 13.41 13.17 9.41 9.17 2 16.59 3.41 18 9.41 12 13.41 16 19.71 9.71 22 12 22 6"></polygon>
    </g>
</svg>

Illustrator export:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<title>gridicons-trending</title>
<g id="gridicons-trending">
	<polygon id="Path" points="16,6 18.3,8.3 13.4,13.2 9.4,9.2 2,16.6 3.4,18 9.4,12 13.4,16 19.7,9.7 22,12 22,6 	"/>
</g>
</svg>

Digging further:

Removing width="24px" height="24px" from the SVG tag declaration fixes it.

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

No branches or pull requests

3 participants