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

Extend HTML output for pagebreaks for PDF generation #441

Merged
merged 15 commits into from
Dec 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This is the changelog between releases of PHPWord. Releases are listed in reverse chronological order with the latest version listed on top, while additions/changes in each release are listed in chronological order. Changes in each release are divided into three parts: added or change features, bugfixes, and miscellaneous improvements. Each line contains short information about the change made, the person who made it, and the related issue number(s) in GitHub.

## 0.11.2 - 10 December 2014
- Add new-page function for PDF generation. For multiple PDF-backends - @chc88 GH-426

## 0.11.1 - 2 June 2014

This is an immediate bugfix release for HTML reader.
Expand Down
18 changes: 17 additions & 1 deletion docs/elements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -493,4 +493,20 @@ To be completed
Line
------

To be completed
Line elements can be added to sections by using ``addLine``.

.. code-block:: php

$linestyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552);
$section->addLine($lineStyle)

Available line style attributes:

- ``weight`` Line width in twips
- ``color`` Defines the color of stroke
- ``dash`` Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot
- ``beginArrow`` Start type of arrow: block, open, classic, diamond, oval
- ``endArrow`` End type of arrow: block, open, classic, diamond, ovel
- ``width`` Line-object width in pt
- ``height`` Line-object height in pt
- ``flip`` Flip the line element: true, false
14 changes: 14 additions & 0 deletions src/PhpWord/Writer/HTML/Element/PageBreak.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,18 @@
*/
class PageBreak extends TextBreak
{
/**
* Write page break
*
* @return string
*/
public function write()
{
/** @var \PhpOffice\PhpWord\Writer\HTML $parentWriter Type hint */
$parentWriter = $this->parentWriter;
if ($parentWriter->isPdf()) {
return '<pagebreak style="page-break-before: always;" pagebreak="true"></pagebreak>';
}
return "";
}
}