PDF Creator for typo3
This extension is based on PDF Generator 2. So you can use the PDF Generator 2 documentation to setup this extension. I added functionality to put an icon as a pdf link via content element.
This extension uses wkhtmltopdf as the rendering engine. So, it comes with binary version for linux 32 and 64 OS. If you want to install this extension on Windows, just change the binary to the version for windows in bin directory. The binary for another OS, you can find here. Don't forget to change the permission as executable by typing this command "chmod +x bin/*"
example in the template Constants:
pdf_creator {
size = A4
top = 18
bottom = 20
left = 15
right = 15
cssmedia = print
renderfields = 1
string_search1 = <body>
string_replace1 = <body> <!-- PDF VERSION -->
regexp_search2 = (<a (.*?)>←(.*?)</a>)
regexp_search3 = (<a (.*?)>←(.*?)</a>)
regexp_search4 = (<a (.*?)><-(.*?)</a>)
}
pdf_creator {
If you want to put the PDF Creator link on every page, you can add this sample in the template Setup, please change to comform with your Setup:
temp.PDFT = TEXT
temp.PDFT {
value = pdf
postUserFunc = tx_pdfcreator->makePdfLink
postUserFunc.target = _blank
postUserFunc.no_user_int = 0
}
and have fun..
This extension uses wkhtmltopdf as the rendering engine. So, it comes with binary version for linux 32 and 64 OS. If you want to install this extension on Windows, just change the binary to the version for windows in bin directory. The binary for another OS, you can find here. Don't forget to change the permission as executable by typing this command "chmod +x bin/*"
Because I cannot put this extension on TER, you can download this extension from here.
example in the template Constants:
pdf_creator {
size = A4
top = 18
bottom = 20
left = 15
right = 15
cssmedia = print
renderfields = 1
string_search1 = <body>
string_replace1 = <body> <!-- PDF VERSION -->
regexp_search2 = (<a (.*?)>←(.*?)</a>)
regexp_search3 = (<a (.*?)>←(.*?)</a>)
regexp_search4 = (<a (.*?)><-(.*?)</a>)
}
example in the template Setup:
# Put current page url in the PDF format
temp.linkPDF = TEXT
temp.linkPDF {
stdWrap.postUserFunc = tx_pdfcreator->linkInPdf
stdWrap.postUserFunc.target = _blank
}
# Put the right coloumn as footer in PDF format
temp.linkPDF {
stdWrap.postUserFunc = tx_pdfcreator->linkInPdf
stdWrap.postUserFunc.target = _blank
}
# Put the right coloumn as footer in PDF format
temp.end_note < styles.content.getRight
temp.end_note {
renderObj = COA
renderObj{
10 < tt_content
10.stdWrap.wrap = <div class="end_note"> | </div>
}
}
# Put the page title if not hidden in the PDF format
temp.end_note {
renderObj = COA
renderObj{
10 < tt_content
10.stdWrap.wrap = <div class="end_note"> | </div>
}
}
# Put the page title if not hidden in the PDF format
temp.title = COA
temp.title {
10 = TEXT
10 {
data = field:title
if.isFalse.field = nav_hide
wrap = <h1>|</h1>
}
20 = TEXT
20 {
value =
if.isTrue.field = nav_hide
wrap = <h1>|</h1>
}
temp.title {
10 = TEXT
10 {
data = field:title
if.isFalse.field = nav_hide
wrap = <h1>|</h1>
}
20 = TEXT
20 {
value =
if.isTrue.field = nav_hide
wrap = <h1>|</h1>
}
}
pdf_creator {
# include current page CSS
includeCSS < page.includeCSS
# include custom CSS
includeCSS.pdf = EXT:pdf_creator/res/html2pdf.css
includeCSS.pdf = EXT:pdf_creator/res/html2pdf.css
10 = TEMPLATE
10.template = FILE
10.template.file = EXT:pdf_creator/res/html2pdf.html
10.marks.url < temp.linkPDF
10.marks.TITLE < temp.title
50.stdWrap.wrap = <div id="maincol"> | </div>
60 = COA
60 {
if.isTrue.numRows < styles.content.getRight
10 = TEMPLATE
10 {
template = FILE
template.file = EXT:pdf_creator/res/html2pdf_endnote.html
marks.ENDNOTE < temp.end_note
}
}
}
10.template = FILE
10.template.file = EXT:pdf_creator/res/html2pdf.html
10.marks.url < temp.linkPDF
10.marks.TITLE < temp.title
50.stdWrap.wrap = <div id="maincol"> | </div>
60 = COA
60 {
if.isTrue.numRows < styles.content.getRight
10 = TEMPLATE
10 {
template = FILE
template.file = EXT:pdf_creator/res/html2pdf_endnote.html
marks.ENDNOTE < temp.end_note
}
}
}
If you want to put the PDF Creator link on every page, you can add this sample in the template Setup, please change to comform with your Setup:
temp.PDFT = TEXT
temp.PDFT {
value = pdf
postUserFunc = tx_pdfcreator->makePdfLink
postUserFunc.target = _blank
postUserFunc.no_user_int = 0
}
temp.maincol = COA
temp.maincol {
10 = CONTENT
temp.maincol {
10 = CONTENT
8 < temp.PDFT
10 < styles.content.get
}
}
Comments