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

docx file not converting to pdf give error "DOMDocument::loadXML(): Namespace prefix m on oMath is not defined in Entity, line: 1" #2670

Open
1 of 2 tasks
rajaafrajanjua opened this issue Sep 6, 2024 · 2 comments
Labels

Comments

@rajaafrajanjua
Copy link

rajaafrajanjua commented Sep 6, 2024

Describe the bug and add attachments

I want to convert docx file to pdf in laravel i got error "DOMDocument::loadXML(): Namespace prefix m on oMath is not defined in Entity, line: 1" my code is

Expected behavior

I just want want to convert the docx file to pdf.

Steps to reproduce

 private function convertToPDF($file){
    $pdfPath = tempnam(sys_get_temp_dir(), 'phpword_') . '.pdf';
    Settings::setPdfRendererName(Settings::PDF_RENDERER_DOMPDF);
    Settings::setPdfRendererPath(base_path('vendor/dompdf/dompdf'));

    $phpWord = IOFactory::load($file);
    $phpWordString = print_r($phpWord, true);
    Log::error("phpWord: {$phpWordString}");

    $xmlWriter = IOFactory::createWriter($phpWord, 'PDF');
    Log::error("xmlWriter: " . $xmlWriter);

    $xmlWriter->save($pdfPath);

    return $pdfPath;
}

PHPWord version(s) where the bug happened

1.2

PHP version(s) where the bug happened

8.2

Priority

  • I want to crowdfund the bug fix (with @algora-io) and fund a community developer.
  • I want to pay the bug fix and fund a maintainer for that. (Contact @Progi1984)
@Progi1984
Copy link
Member

@tayyabjanjua Hi, Could you send the file for reproducing the issue ?

You Can crowdfund by following this link : https://docs.algora.io/bounties/workflow

@Progi1984 Progi1984 added Open XML (Word 2007+) Portable Document (PDF) Status: Waiting for feedback Question has been asked, waiting for response from PR author labels Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants
@Progi1984 @rajaafrajanjua and others