Skip to content

WIP: SVG Image Type Support #2778

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

Closed
wants to merge 0 commits into from
Closed

Conversation

prog-klk1
Copy link

@prog-klk1 prog-klk1 commented May 15, 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 mostly 🟢
  • 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 May 19, 2025

Coverage Status

coverage: 96.024% (-0.7%) from 96.767%
when pulling d888771 on prog-klk1:master
into 6ca8c9f on PHPOffice:master.

# 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
2 participants