Skip to content

Add DomPDF to composer.json and enable archived image source #205

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

Merged
merged 10 commits into from
Apr 16, 2014
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ before_script:
## Composer
# - curl -s http://getcomposer.org/installer | php
# - php composer.phar install --prefer-source
- composer self-update
- composer require dompdf/dompdf:0.6.*
- composer install --prefer-source
- composer selfupdate --quiet
## PHP_CodeSniffer
- pyrus install pear/PHP_CodeSniffer
- phpenv rehash
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ This release marked heavy refactorings on internal code structure with the creat
- Object: Ability to add object in header, footer, textrun, and footnote - @ivanlanin GH-187
- Media: Add `Media::resetElements()` to reset all media data - @juzi GH-19
- General: Add `Style::resetStyles()`, `Footnote::resetElements()`, and `TOC::resetTitles()` - @ivanlanin GH-187
- Reader: Ability to read header, footer, footnotes, link, preservetext, textbreak, pagebreak, table, and list - @ivanlanin
- DOCX Reader: Ability to read header, footer, footnotes, link, preservetext, textbreak, pagebreak, table, list, image - @ivanlanin
- Endnote: Ability to add endnotes - @ivanlanin
- ListItem: Ability to create custom list and reset list number - @ivanlanin GH-10 GH-198
- ODT Writer: Basic table writing support - @ivanlanin
- Image: Keep image aspect ratio if only 1 dimension styled - @japonicus GH-194
- HTML Writer: Basic HTML writer initiated - @ivanlanin GH-203 GH-67 GH-147
- PDF Writer: Basic PDF writer initiated using DomPDF - @ivanlanin GH-68
- HTML Writer: Basic HTML writer: text, textrun, link, title, textbreak, table, image (as Base64), footnote, endnote - @ivanlanin GH-203 GH-67 GH-147
- PDF Writer: Basic PDF writer using DomPDF: All HTML element except image - @ivanlanin GH-68

### Bugfixes

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
"phpunit/phpunit": "3.7.*"
},
"suggest": {
"ext-gd2": "*",
"ext-xmlwriter": "*",
"ext-xsl": "*"
"ext-gd2": "Required to add images",
"ext-xmlwriter": "Required to write DOCX and ODT",
"ext-xsl": "Required to apply XSL style sheet to template part",
"dompdf/dompdf": "Required to write PDF"
},
"autoload": {
"psr-4": {
Expand Down
114 changes: 57 additions & 57 deletions docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,63 +62,63 @@ Below are the supported features for each file formats.
Writers
~~~~~~~

+-------------------------------------------------+--------+-------+-------+
| Features | DOCX | ODT | RTF |
+=========================+=======================+========+=======+=======+
| **Document Properties** | Standard | | | |
+ +-----------------------+--------+-------+-------+
| | Extended | | | |
+ +-----------------------+--------+-------+-------+
| | UserDefined | | | |
+-------------------------+-----------------------+--------+-------+-------+
| **Element Type** | Text | ✓ | ✓ | ✓ |
+ +-----------------------+--------+-------+-------+
| | Text Run | ✓ | ✓ | ✓ |
+ +-----------------------+--------+-------+-------+
| | Title | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Link | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Preserve Text | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Text Break | ✓ | ✓ | ✓ |
+ +-----------------------+--------+-------+-------+
| | Page Break | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | List | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Table | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Image | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Object | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Watermark | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Table of Contents | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Header | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Footer | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Footnote | ✓ | | |
+ +-----------------------+--------+-------+-------+
| | Endnote | ✓ | | |
+-------------------------+-----------------------+--------+-------+-------+
| **Graphs** | 2D basic graphs | | | |
+ +-----------------------+--------+-------+-------+
| | 2D advanced graphs | | | |
+ +-----------------------+--------+-------+-------+
| | 3D graphs | | | |
+-------------------------+-----------------------+--------+-------+-------+
| **Math** | OMML support | | | |
+ +-----------------------+--------+-------+-------+
| | MathML support | | | |
+-------------------------+-----------------------+--------+-------+-------+
| **Bonus** | Encryption | | | |
+ +-----------------------+--------+-------+-------+
| | Protection | | | |
+-------------------------+-----------------------+--------+-------+-------+
+-------------------------------------------------+--------+-------+-------+-------+-------+
| Features | DOCX | ODT | RTF | HTML | PDF |
+=========================+=======================+========+=======+=======+=======+=======+
| **Document Properties** | Standard | ✓ | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Extended | ✓ | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | UserDefined | ✓ | | | | |
+-------------------------+-----------------------+--------+-------+-------+-------+-------+
| **Element Type** | Text | ✓ | ✓ | ✓ | ✓ | ✓ |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Text Run | ✓ | ✓ | ✓ | ✓ | ✓ |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Title | ✓ | | | ✓ | ✓ |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Link | ✓ | | | ✓ | ✓ |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Preserve Text | ✓ | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Text Break | ✓ | ✓ | ✓ | ✓ | ✓ |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Page Break | ✓ | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | List | ✓ | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Table | ✓ | | | ✓ | ✓ |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Image | ✓ | | | ✓ | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Object | ✓ | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Watermark | ✓ | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Table of Contents | ✓ | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Header | ✓ | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Footer | ✓ | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Footnote | ✓ | | | ✓ | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Endnote | ✓ | | | ✓ | |
+-------------------------+-----------------------+--------+-------+-------+-------+-------+
| **Graphs** | 2D basic graphs | | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | 2D advanced graphs | | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | 3D graphs | | | | | |
+-------------------------+-----------------------+--------+-------+-------+-------+-------+
| **Math** | OMML support | | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | MathML support | | | | | |
+-------------------------+-----------------------+--------+-------+-------+-------+-------+
| **Bonus** | Encryption | | | | | |
+ +-----------------------+--------+-------+-------+-------+-------+
| | Protection | | | | | |
+-------------------------+-----------------------+--------+-------+-------+-------+-------+


Readers
Expand Down
6 changes: 5 additions & 1 deletion samples/Sample_07_TemplateCloneRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@
$document->saveAs($name);
rename($name, "results/{$name}");

include_once 'Sample_Footer.php';
$writers = array('Word2007' => 'docx');
echo getEndingNotes($writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}
6 changes: 5 additions & 1 deletion samples/Sample_23_TemplateBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
$document->saveAs($name);
rename($name, "results/{$name}");

include_once 'Sample_Footer.php';
$writers = array('Word2007' => 'docx');
echo getEndingNotes($writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}
27 changes: 21 additions & 6 deletions samples/Sample_Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,17 @@
}

/**
* Get results
* Write documents
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @param string $filename
* @param array $writers
* @return string
*/
function write($phpWord, $filename, $writers)
{
$result = '';

// Write
// Write documents
foreach ($writers as $writer => $extension) {
$result .= date('H:i:s') . " Write to {$writer} format";
if (!is_null($extension)) {
Expand All @@ -70,6 +69,20 @@ function write($phpWord, $filename, $writers)
$result .= EOL;
}

$result .= getEndingNotes($writers);

return $result;
}

/**
* Get ending notes
*
* @param array $writers
*/
function getEndingNotes($writers)
{
$result = '';

// Do not show execution time for index
if (!IS_INDEX) {
$result .= date('H:i:s') . " Done writing file(s)" . EOL;
Expand All @@ -85,9 +98,11 @@ function write($phpWord, $filename, $writers)
$result .= '<p>&nbsp;</p>';
$result .= '<p>Results: ';
foreach ($types as $type) {
$resultFile = 'results/' . SCRIPT_FILENAME . '.' . $type;
if (file_exists($resultFile)) {
$result .= "<a href='{$resultFile}' class='btn btn-primary'>{$type}</a> ";
if (!is_null($type)) {
$resultFile = 'results/' . SCRIPT_FILENAME . '.' . $type;
if (file_exists($resultFile)) {
$result .= "<a href='{$resultFile}' class='btn btn-primary'>{$type}</a> ";
}
}
}
$result .= '</p>';
Expand Down
Loading