PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.21k stars 2.68k forks source link

Section Setting MarginTop Inneffective on DomPDF PDF #343

Open soupwell opened 10 years ago

soupwell commented 10 years ago

As far as I can tell, the marginTop section setting has no effect when generating a pdf through DomPDF.

I've never submitted a bug on a community project before. I apologize if I have failed to use best practices. Please feel free to educate me.

<?php

require_once 'vendor/phpoffice/phpword/src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();

$phpWord = new \PhpOffice\PhpWord\PhpWord();

$section = $phpWord->addSection();

$section->getSettings()->setMarginTop(5440);

$textrun = $section->addTextRun();

$textrun->addText('Test');

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('test.docx');

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'PDF');
$objWriter->save('test.pdf');

Word Format:

docx_capture

PDF Format:

pdf_capture

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/3988939-section-setting-margintop-inneffective-on-dompdf-pdf?utm_campaign=plugin&utm_content=tracker%2F323108&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F323108&utm_medium=issues&utm_source=github).
ghost commented 9 years ago

Hi @soupwell, You see the described behaviour because of lack of feature. We use intermediary conversion into HTML to get PDF document. Currently our HTML writer implements only basic functionality and doesn't support so called "Sections". Don't panic, it's not a bug.

Thanks for the feedback. :+1:

bryanrsebastian commented 8 years ago

can I ask why marginTop and marginLeft is not working on addImage, I use 0.13.* version of PHPWord.

eyobofficial commented 8 years ago

Sorry pal, I think you contacted the wrong person. I am not one of the developers of PHPWord.

On Fri, Sep 16, 2016 at 10:56 AM, policarpio-menopolo < notifications@github.com> wrote:

can I ask why marginTop and marginLeft is not working on addImage, I use 0.13.* version of PHPWord.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PHPOffice/PHPWord/issues/343#issuecomment-247540608, or mute the thread https://github.com/notifications/unsubscribe-auth/ALpW-jpPK9O6nBgbt7n1nsMroja-zqgAks5qqkubgaJpZM4CaMcn .