bithost-gmbh / pdfviewhelpers Goto Github PK
View Code? Open in Web Editor NEWTYPO3 CMS extension that provides various Fluid ViewHelpers to generate PDF documents.
License: GNU General Public License v3.0
TYPO3 CMS extension that provides various Fluid ViewHelpers to generate PDF documents.
License: GNU General Public License v3.0
Hi,
great extension. thank you fort that.
I am having a little issue that the posX and posY attribute is being ignored for every element. I think I already found the issue. posX and posY gets set every time even the attribute for it exists:
diff --git a/Classes/ViewHelpers/AbstractContentElementViewHelper.php b/Classes/ViewHelpers/AbstractContentElementViewHelper.php
index 7ee5572..5fb3fbc 100644
--- a/Classes/ViewHelpers/AbstractContentElementViewHelper.php
+++ b/Classes/ViewHelpers/AbstractContentElementViewHelper.php
@@ -59,8 +59,13 @@ abstract class AbstractContentElementViewHelper extends AbstractPDFViewHelper {
$this->isValidHeight($this->arguments['height']);
}
- $this->arguments['posX'] = $this->getPDF()->GetX();
- $this->arguments['posY'] = $this->getPDF()->GetY();
+ if (is_null($this->arguments['posX'])) {
+ $this->arguments['posX'] = $this->getPDF()->GetX();
+ }
+
+ if (is_null($this->arguments['posY'])) {
+ $this->arguments['posY'] = $this->getPDF()->GetY();
+ }
}
/**
This way a user can put information in the footer without creating a new template file. Is it possible for you to add this fix to your repo? thank you in advance.
best regards
Peter
At least all default fonts from TCPDF should be documented.
e.g.
<pdf:includeCss src="typo3conf/ext/pdfviewhelpers/Resources/Public/Css/pdf_styles.css" />
or
<pdf:html styles="typo3conf/ext/pdfviewhelpers/Resources/Public/Css/pdf_styles.css">
<h1>styled html content</h1>
</pdf:html>
Could you please list the package on packagist.org? This would make the handling alot easier and I don't have to use the "old" TYPO3-Repostiory (https://composer.typo3.org/) in my composer.json as an additional repostiory. ;)
any chance to get ride of this?
From the log:
PHP Warning: Cannot modify header information - headers already sent by output started at .../typo3conf/ext/pdfviewhelpers/Classes/ViewHelpers/DocumentViewHelper.php:106) in .../typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php line 3697
TYPO3 Version 7.6.10, PHP Version 7
The configurationManager should be retrieved from the Extbase Object Manager in order to be correctly initialized.
Replace the following line:
with:
$objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
A possible error resulting from that issue could be:
Fatal error: Call to a member function getConfiguration() on null in /usr/share/typo3/typo3_src-7.6.16/typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php on line 128
Add possibility to e.g. only overwrite top
in the template or on the headline padding settings, thus remove the need to always provide a full padding or margin array e.g. {top: 10, right: 0, bottom: 0, left: 0}
Hello,
trying to use an imported custom font doesn't work. The view doesn't load and throws this error:
"TCPDF ERROR: Could not include font definition file: foo"
This is my configuration typoscript:
plugin.tx_pdfviewhelpers.settings.config.fonts {
addTTFFont {
foo {
path = EXT:pdfviewhelpers/Resources/Public/Examples/FullFeatureShowCase/Roboto.ttf
}
}
}
It appears to work, because using a wrong file path will also throw an error.
E.g. useful to position elements relative to current position
I had a very big problem with your Html ViewHelper. When I tried to show some content from my database over a fluid command I got a blank side.
This is my code for the geneartion of the PDF-Document:
{namespace pdf=Bithost\Pdfviewhelpers\ViewHelpers}
<pdf:document outputDestination="I" title="Report">
<pdf:page autoPageBreak="1">
<pdf:html>
<style>
table {
color: #003300;
font-size: 8pt;
border: 1px solid black;
}
th {
font-weight: bold;
font-size: 8px;
text-align: left;
border-bottom: #eee 1px solid;
background-color: #eee;
}
td {
border: none;
}
</style>
<f:for each="{uebersicht.fach}" as="fluid">
<table class="first" cellpadding="2" cellspacing="5">
<tr>
<th>Fachübersicht</th>
</tr>
<tr>
<td>{uebersicht.fachid} {uebersicht.title}</td>
</tr>
</table>
<f:for each="{uebersicht.fach}" as="fach">
<table class="second" cellpadding="2" cellspacing="5">
<tr>
<th>Kurze Info</th>
</tr>
<tr>
<td>{fach.title}</td>
</tr>
<tr>
<th>Vielen dank an:</th>
</tr>
<tr>
<td>{fach.author}</td>
</tr>
<tr>
<th>Datum</th>
</tr>
<tr>
<td>{fach.date}</td>
</tr>
<tr>
<th>Eingaben:</th>
</tr>
<tr>
<th><f:format.htmlentitiesDecode value="{fach.content}" /></th>
</tr>
</table>
</f:for>
</f:for>
</pdf:html>
</pdf:page>
</pdf:document>
I found out, that the f.format.htmlentitiesDecode is never working. When I delete this code I get some times a text and sometimes no text.
When I activate the header, then I see only the header and no html-content.
I hope you can help me.
Best
Behau
Please add the fpdi library and add an example how to use it:
https://www.setasign.com/products/fpdi/downloads/
Related to #46
Hi Markus and Estaban
Markus, do you remember me from Begasoft?
You two have done a cool modern extension to create PDFs, congratulations!
Unfortunately I found an error when creating a PDF String.
In method DocumentViewHelper::render() for outputDestination = "S", the call:
$this->getPDF()->Output($outputPath, $this->arguments['outputDestination']);
should store the result string and return it from the method.
Would be nice to have fixed for the next release :-)
Have fun
Hanspeter
https://packagist.org/packages/typo3fluid/fluid
TODO
I upgraded from version 1.x to version 2.0 and did all of the upgrading changes.
<pdf:document sourceFile="fileadmin/template.pdf" outputPath="typo3temp/registration.pdf">
This statement leads to a registration.pdf equal template.pdf. If I use outputDestination="inline" the result has the content of template.pdf inlcuding all pdf:text statements I've set.
Why does registration.pdf don't carry any content? What could be missing?
Add a ViewHelper to add page breaks, that would allow conditional page breaks within the Fluid template.
<pdf:page>
Lorem
<f:if condition="{var}">
<pdf:pageBreak />
</f:if>
ipsum
</pdf:page>
It should be possible to overwrite settings defined in plugin.tx_pdfviewhelpers.settings.config
within the Fluid template. E.g.
<pdf:document config="{class: 'Vendor\Extension\YourClass'}"></pdf:document>
or
<pdf:config key="class" value="Vendor\Extension\YourClass"></pdf:config>
Add an option to use automatic hyphenation in HtmlViewHelper
. The language needs to be configurable.
https://tcpdf.org/examples/example_046/
https://ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/tex
e.g.
TypoScript
plugin.tx_pdfviewhelpers.settings {
headline1 {
fontSize = 16
padding {
top = 6
right = 0
bottom = 3
left = 0
}
}
headline2 {
fontSize = 12
padding {
top = 4
right = 0
bottom = 1
left = 0
}
}
}
Fluid
<pdf:headline1></headline1>
<pdf:headline2></headline2>
OR
TypoScript
plugin.tx_pdfviewhelpers.settings {
headline {
fontSize = 16
padding {
top = 6
right = 0
bottom = 3
left = 0
}
types {
foo {
fontSize = 20
}
bar {
fontSize = 12
}
}
}
}
Fluid
<pdf:headline type="foo"></headline1>
<pdf:headline type="bar"></headline2>
Since version 1.5.2 the fontsize of text inside of pdf:html is too small.
Example code of my extension:
<pdf:html>
<table style="font-size:9px;><tr><td>Text</td></tr></table>
</pdf:html>
I need to change the fontsize from 9 to more than 20, to get the same size as with version 1.5.1 and older.
Perhaps this is an TCPDF issue?
Disable caching by default because it makes no sense to save the PDF to the frontend cache. And if the PDF is saved to the filesystem there will be an empty cache entry for this page causing the PDF ViewHelpers not to be executed on a second call.
Add a TypoScript configuration to enable caching.
Trying to render content with more than one link in it, runs in a "Illegal string offset 'url'" warning in tcpdf.php, which breaks the PDF rendering. Updating to tecnickcom/TCPDF 6.2.13 solves this problem.
Hi,
The last version of the extension is no more compatible with PHP 5.4 because of this line :
$this->configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
in 5.4 you can use this :
$this->configurationManager = GeneralUtility::makeInstance(\get_class(new \TYPO3\CMS\Extbase\Configuration\ConfigurationManager));
Reagrds,
Florian
Add a ViewHelper that takes HTML as input: https://tcpdf.org/examples/example_061/
Compatibility with PHP 7.2
Allow paths that are prefixed with EXT
, e.g. EXT:pdfviewhelpers/somepath
Use GeneralUtility::getFileAbsFileName
Hello, we are developing on TYPO3 9 for a mid term project that will be released after it will become LTS. We need an extension to generate PDF files on the flay. I wanted to ask if you plan to support TYPO3 9 and if you have a timeline for that.
Thanks for your answer and your work.
Probably we have to add protected $escapeChildren = false; protected $escapeOutput = false;
to AbstractPDFViewHelper in order to disable the unnecessary escaping of the PDF content.
$this->getPDF()->setSRGBmode()
As pointed out by @liayn in 42385a4#r27355212 checking for TSFE
crashes in backend
The fix to this issue should at least be mentioned in the section trouble shooting. Probably we can also include a fix like this for EmptyFPDI
:
class YourPDF extends FPDI {
public function AddPage($orientation = '', $format = '', $rotationOrKeepmargins = false, $tocpage = false)
{
parent::AddPage($orientation, $format, $rotationOrKeepmargins, $tocpage);
if ($this->tpl !== 0) {
$this->useTemplate($this->tpl);
}
}
}
It has to be tested whether this works if different pages are imported in one PDF or not. It should also be possible to not import the template anymore, if the PageViewHelper
is used without the option importPage
. That is not possible with this quick fix. Maybe we could also include an option to make this optional.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.