Skip to content

Instantly share code, notes, and snippets.

@stphnwlkr
Created May 18, 2016 16:37
Show Gist options
  • Save stphnwlkr/9590b00cbe852e5570b058c2f04ebb1c to your computer and use it in GitHub Desktop.
Save stphnwlkr/9590b00cbe852e5570b058c2f04ebb1c to your computer and use it in GitHub Desktop.
<cfoutput >
<cfparam name="url.ds" default="" maxlength="50" type="string" >
<cfparam name="url.post" default="0" type="numeric" >
<cfif not isNumeric(url.post)>
<cflocation url="/" addtoken="false">
</cfif>
<cfset p = application.utils.getWPPost(url.ds, url.post)>
<cfif p.recordcount neq 1>
<cflocation url="/" addtoken="false">
</cfif>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>#p.post_title#</title>
</head>
<cfset variables.body = ReReplace('#p.post_content#','|\[(.+?)\](.+?\[/\\1\])?|','','All')>
<cfhtmltopdf
saveasname="#ReReplace(p.post_name,'-','_','All')#.pdf"
pagetype="letter" marginbottom=".75" margintop=".75" marginleft=".5" marginright=".5"
>
<style >
body {
font: 12pt sans-serif;
}
h1 {
font: 28pt serif;
}
h2, h3, h4, h5 {
font-family: sans-serif;
}
a {
padding: 4px;
color: ##112e51;
background-color: ##dce4ef;
text-decoration: underline;
}
.no-print, .no-print * {
display: none !important;
}
pre ul {
list-style-type: square;
list-style-position: inside;
}
pre ul li {
padding: 1px;
line-height: 14px;
}
@media print {
a.no-print, a.no-print * {
display: none !important;
}
}
</style>
<h1>#p.post_title#</h1>
<pre style="font:12pt sans-serif;line-height:24px;">#variables.body#</pre>
<cfhtmltopdfitem type="footer">
<p style="font:10pt Arial, sans-serif bold;text-align:right;">Published on: #p.post_date.dateFormat('long')#</p>
</cfhtmltopdfitem>
</cfhtmltopdf >
</body></html>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment