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

Image not handled when converting a word document to pdf #1956

Open
Mouke opened this issue Oct 26, 2020 · 2 comments
Open

Image not handled when converting a word document to pdf #1956

Mouke opened this issue Oct 26, 2020 · 2 comments

Comments

@Mouke
Copy link

Mouke commented Oct 26, 2020

Describe the Bug

I am trying to convert a word file to PDF in order to process it afterwards (it has to be processed as a PDF), but if I include an image to my word, the lib wil crash.

Steps to Reproduce

<?php
require __DIR__ . '/vendor/autoload.php';

        $reader = IOFactory::createReader();
        //$document is a Symfony\Component\HttpFoundation\File\UploadedFile object.
        $word = $reader->load($document->getPathname());
        $word->save($document->getPathname(), 'PDF');

### Expected Behavior

Should convert my word file into a pdf file of the same name, erasing the word file in the process.

### Current Behavior

When I execute this code snippet, i get the error `Warning: fopen(): Filename cannot be empty`, coming from PhpOffice\PhpWord\Element\Image line 377.

### Context

- PHP Version: 7.4
- PHPWord Version: 0.17.0

You'll find the docx file i use attached.

[test.docx](https://github.com/PHPOffice/PHPWord/files/5437779/test.docx)
@romandots
Copy link

Having the same issue when trying to convert .doc file to .pdf.

@RayhanYulanda
Copy link

Having the same issue when trying to convert .doc file to .pdf. +1

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

No branches or pull requests

3 participants