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 => pdf styles missing #1139

Open
robov opened this issue Sep 12, 2017 · 11 comments
Open

DocX => pdf styles missing #1139

robov opened this issue Sep 12, 2017 · 11 comments

Comments

@robov
Copy link

robov commented Sep 12, 2017

When I convert my docx at least the following styles are missing

  • headers
  • footers
  • bullets
  • bold
  • custom style definitions in work (ie I had a TITLE style.. big center... but this was rendered in pdf as a normal style

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@robov
Copy link
Author

robov commented Sep 12, 2017

And the styles are not there when I use TCPDF and not when I use DOMPDF
Both render the pdf in the same style-less matter

@robov
Copy link
Author

robov commented Sep 12, 2017

When I save the original file as a word97 file..the styling is even worse...

        $filename = "interview97.doc";
        $source = $path . $filename;
        $phpWord = \PhpOffice\PhpWord\IOFactory::load($source,  'MsDoc'); 
        
        $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'PDF');
        $objWriter->save($path . "interview97.pdf" );  

@FBnil
Copy link

FBnil commented Oct 3, 2017

What I am using is OpenOffice (yum install libreoffice-writer)

$cmd = "export HOME=/tmp && /bin/oowriter --headless --convert-to pdf --outdir '" . $path . "' '" . $fqn . "' 2>&1" ;
$output = shell_exec($cmd);

The installation size is enormous, but the results are quite good. :( Sorry PHPWord!

@robov
Copy link
Author

robov commented Oct 3, 2017

Yes I switched to...as the results are horrible in phpword and great in libre

@Sarke
Copy link

Sarke commented Oct 17, 2017

This seems related to the HTML issue: #1047

The PDF writers being used are taking in the HTML output, which also lacks the styling. The classes are being defined in the <style> tag, but they are just not being used.

@chrisribe
Copy link

This still seems to be an issue. html and pdf outputs do not replicate the some styles in docx (header / footers).

@SenDesignRO
Copy link

Issue still present on 0.16.0

@TheKeymaster
Copy link

If you have libreoffice installed you can use:

exec('libreoffice --headless --convert-to pdf path/to/some.docx path/to')

I wouldn't say it is a good solution but it is deffinetely a reliable one.

@alexmanotas
Copy link

can someone tell me please, how I can install libreoffice on my server or how to include it in my files to call it in my php file.

@downwater
Copy link

downwater commented Nov 16, 2019

For information, there is an answered question in StackOverflow about this issue.

@xeemoon
Copy link

xeemoon commented Dec 7, 2021

I have the same that Issue, Kindly helps me, someone. Thanks, @alexmanotas can you do it?

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

No branches or pull requests

9 participants