Skip to main content

glycorender Logo

glycorender

A bespoke SVG to PDF/PNG renderer for the GlycoDraw platform, specialized in accurately rendering glycan structures with support for chemical notations and path-based text positioning.

PyPI version Python Version License

Features

  • Accurate SVG to PDF and PNG conversion for glycan structures
  • Support for text on paths with proper positioning and orientation
  • Special handling for monosaccharide properties like "Df" with proper styling
  • Gradient fills for circles and shapes
  • Precise connection path rendering between glycan elements
  • Support for various SVG path commands

Installation

pip install glycorender

Quick Start

from glycorender import convert_svg_to_pdf, convert_svg_to_png

# Convert SVG file to PDF
with open('glycan_structure.svg', 'r') as f:
    svg_data = f.read()
    
convert_svg_to_pdf(svg_data, 'output.pdf')

# Convert SVG file to PNG
convert_svg_to_png(svg_data, 'output.png')

# Or directly from SVG data
svg_data = """..."""
convert_svg_to_pdf(svg_data, 'output.pdf')
convert_svg_to_png(svg_data, 'output.png')

Use Cases

GlycoRender is specifically designed for:

  • Converting glycan structure diagrams from GlycoDraw to publication-quality PDFs or PNGs
  • Preserving the exact layout and styling of complex carbohydrate representations
  • Ensuring chemical notations are properly formatted in the output
  • Maintaining the correct connections between monosaccharide units

API Reference

convert_svg_to_pdf(svg_data, pdf_file_path)

convert_svg_to_png(svg_data, png_file_path)

Converts SVG data to a PDF/PNG file.

Parameters:

  • svg_data (str or bytes): SVG content either as a string or bytes
  • png_file_path (str): Path where the output PNG should be saved

Supported SVG Elements

  • <path>: Full support for path commands (M, L, H, V, Z, etc.)
  • <circle>: Support for basic circles and gradient-filled circles
  • <rect>: Support for rectangles with stroke and fill
  • <text> and <textPath>: Support for text placement along paths with proper orientation
  • <defs>: Support for path and gradient definitions
  • <radialGradient>: Support for radial gradients with stops

Dependencies

  • numpy

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for glycorender 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glycorender 0.4.1
File Size Uploaded
glycorender-0.4.1.tar.gz 152.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for glycorender 0.4.1
File Interpreter ABI Platform
glycorender-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 301.8 kB

Release files / glycorender-0.4.1.tar.gz

Download URL glycorender-0.4.1.tar.gz
Size 152.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b57b511c231fd2ae3bbdf7f4f6810ace23cc1ab257948514900829f364b74717
BLAKE2b-256 checksum
How to use checksums
809a3e132f2b03f801b4cb9eed03d1beb37d9488f487d1672745c28422df8994
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / glycorender-0.4.1-py3-none-any.whl

Download URL glycorender-0.4.1-py3-none-any.whl
Size 149.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59ac32d83f77783cce92f23b3d67660a2270d3cffa1269b90005e2b2f79d7e53
BLAKE2b-256 checksum
How to use checksums
0a1b32ca019621e449459dc55c8feabd317ed3739d62fc64164a2ff564ddbfbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.2

2 release files

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page