Skip to content

Feat: SVG Image Type Support + CI #2790

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

prog-klk1
Copy link

@prog-klk1 prog-klk1 commented Jun 9, 2025

Description

Summary

This PR introduces support for embedding SVG images in Word documents using PHPWord.

Svg Handling in \PhpWord\Element\Image

Added a bypass for SVG images to prevent default handling that is incompatible with the format.

New SVG Rendering Support in \PhpWord\Writer\Word2007\Element\Image

Implemented a dedicated method to process and insert SVG images correctly when generating Word 2007 documents.

Sample Usage

Added a new sample file Sample_47_SVG.php that demonstrates adding SVG images with and without styling (e.g., size, alignment, wrapping).

Resources

Included a sample SVG file (sample.svg) to support testing and documentation of this feature.

Fixes #1746

I'm looking for help setting up proper unit tests for this new SVG handling behavior. Any suggestions would be greatly appreciated.

Actively looking for feedback.

Checklist:

  • My CI is 🟢
  • I have covered by unit tests my new code (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes
  • I have updated the changelog

@coveralls
Copy link

coveralls commented Jun 9, 2025

Coverage Status

coverage: 96.029% (-0.7%) from 96.757%
when pulling 58a81f8 on prog-klk1:master
into 0ab0b49 on PHPOffice:master.

@anandmainali5
Copy link

anandmainali5 commented Jun 12, 2025

i'm having the same issue on SVG image.. when will this be released?

same issue occurs with .ico extention as well.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

SVG image type support
3 participants