Railo PDF generation issues - coldfusion

I am relatively new on Railo. Trying to set up an application on “Railo” I had encountered a problem with PDF generation. Notice I run the app on Adobe CFML Server with no problem.
The problem: Somewhere in my app I have a button that fetches data from a database and serves a downloadable PDF file. On Railo server the PDF content is returned with “funny characters”. The output language is Greek. Greek language has many accented characters. And that’s where the problem occurs (accented characters returned in a “funny” format e.g. Ÿ for ή or Š for O or OΕ’ for Ά). I think the problem is related to Railo’s fonts collection. The same manifests on openBD server!
I have already tried adding cfprocessingdirective pageEncoding="utf-8" in the cfm file with no results. I have tried to add fonts in the fonts.jar (this is under \WEB-INF\lib folder) with no results also (and the call the fonts in the PDF css).
I don’t want to use Adobe CFML Server anymore.
Is there any solution on this issue?
Many thanks in advance,
Tom
Greece
The cfc just serves data from the database
The code I am using:
<cfprocessingdirective pageEncoding="utf-8">
<cfif not IsDefined("URL.id")>
<cfelseif not IsDefined("URL.model")>
<cfelseif not IsDefined("URL.title")>
<cfelseif not IsDefined("URL.id_tree")>
</cfif>
<cfheader name="Content-Disposition" value="attachment; filename=#URL.id_tree#.pdf">
<cfcontent type="application/unknown; charset=utf-8">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!---<link rel="stylesheet" type="text/css" href="resources/fonts/MinionProRegular/MinionProRegular.css" charset="utf-8" />--->
<title>Print</title>
</head>
<body>
<!---<cfif not IsDefined("URL.id")>
<cfelseif not IsDefined("URL.model")>
</cfif>--->
<!--- Get print details --->
<cfinvoke
component="Print"
method="myPrint"
returnvariable="getContent"
id="#URL.id#"
model="#URL.model#">
<!---<cfdump var="#getMember#">--->
<!--- Output the PDF --->
<cfdocument
format="pdf"
pagetype="a4"
<!---pageheight="5"
pagewidth="6.5"--->
margintop="0.6"
marginbottom="0.8"
marginright="1.3"
marginleft="1"
scale="90"
unit="in"
fontembed="true"
backgroundvisible="true">
<cfoutput query="getContent" >
<style type="text/css">
.logo {
background-image:url(../../images/app-specific/ithemis_logo_NEW.png);
background-repeat: no-repeat;
display: inline-block;
float: left;
clear: right;
}
.name {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
color: ##5a5a5a;
<!---float: left;
clear: right;--->
<!---margin-top: 5px;--->
}
.body {
font-family: "Times New Roman", Times, serif;
<!---font-family: Bodoni;--->
<!---font-family: Didot;--->
<!---font-family: Greek;--->
<!---font-family: Geosanslight;--->
<!---font-family: Minionpro_regular;--->
<!---font-family: Philosopher;--->
<!---font-family: Russian;--->
font-size: 11px;
color: ##323232;
line-height: 17px;
<!---float: left;
clear: right;--->
}
.line {
font-size:1px;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: ##202020;
padding-bottom: 5px;
}
.point {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 11px;
padding: 5px 5px 5px 5px;
color: ##373737;
background-color: ##eeeeee;
/*width: 100% !important;*/
display: block !important;
text-align: justify;
}
</style>
<!---<cfprocessingdirective pageencoding="utf-8">--->
<cfdocumentitem type="header">
<img src="../../images/app-specific/ithemis_logo_print_pdf.png" alt="iThemis logo" width="80" height="30" style="float:left;" border="0"/>
</cfdocumentitem>
<!---Use a footer with current page of totalpages format. --->
<cfdocumentitem type="footer">
<cfoutput><span style="font-family:Georgia, 'Times New Roman', Times, serif;font-size:10px;color: ##5a5a5a;float:right;">Σελίδα #cfdocument.currentpagenumber# από #cfdocument.totalpagecount#</span></cfoutput>
</cfdocumentitem>
<table border="0">
<tr>
<td><span class="name">#Title#</span></td>
</tr>
<tr>
<td><span class="body">#Body#</span></td>
</tr>
</table>
</cfoutput>
</cfdocument>
</body>
</html>

Railo is different in some ways.
It is very important that the CFC / CFM file that is generating the PDF is ALSO saved in unicode format.
I recommend going to File > New in your editor and ensure that the editor allows you to define the BOM and encoding prior to creation of the file.
Then copy / paste the code into the new file and overwrite the file with it.
If you do this, it should work.
It sounds weird... but give it a shot.
It's fixed my UTF-8 apps on Railo many of times.
Dreamweaver, although I no longer use it - allowed for these settings to be defined upon file creation. You can also set them in preferences for all future documents.
On SublimeText 2, you can save a file with encoding and BOM.
In ColdFusion Builder, not sure exactly where BOM settings are located but here is a preferences pain for ensuring Default encoding is set to UTF-8.
I hope this helps you and anyone else having similar issues.
REMEMBER: If you're working with UTF-8 / Railo, you have to ensure EVERY ASPECT of the interactions are also saved with UTF-8 in mind. Including the cfc/cfm files themselves.
Good luck!

Make sure you ALSO add the <cfprocessingdirective pageencoding="utf-8"> immediately after the <cfcomponent> in your CFC.

Related

AWS SES New Virtual Deliverability Manager - Trackinglinks are not replaced in roundrect elements

Today I tried the new "Virtual Deliverability Manager" feature of AWS SES. Here I immediately noticed a problem with our emails.
For Outlook, there is an extra markup element "v:roundrect" in our email template.
The href in this element is not replaced by the tracking link from AWS.
All other links from our template are successfully replaced.
Snippet of our Email-Template:
<div align="center">
<!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="https://MYWEBSITE.com/produkt/#Model.ProductNumber" style="height:40px;v-text-anchor:middle;width:200px;" arcsize="10%" strokecolor="#800500" fillcolor="#da251d">
<w:anchorlock/>
<center style="color:#ffffff;font-family:sans-serif;font-size:13px;font-weight:bold;">Jetzt Bestellen!</center>
</v:roundrect>
<![endif]-->
Jetzt Bestellen!
</div>
Link in other EmailClients (Correct - replaced):
Link in Outlook (Incorrect - Not replaced):
Has anyone had similar experience in this regard?
It looks like AWS SES only replaces the classic a-tag hrefs.
Unfortunately I didn't find anything in their documentation about this.
My temporary workaround:
(No fix!)
I changed the Html of my Template. As a result, the button in Outlook no longer has the desired rounded edges. But now the tracking works.
<div align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="padding: 12px 18px 12px 18px; border-radius:5px; background-color: #da251d;" align="center">
<a rel="noopener" target="_blank" href="https://MYWEBSITE.com/produkt/#Model.ProductNumber" target="_blank" style="font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight: bold; color: #ffffff; text-decoration: none; display: inline-block;">Jetzt Bestellen!</a>
</td>
</tr>
</table>
Currently AWS is scanning only the links that are presented in the email and converting them. There is only possibility to remove the specific links from tracking using additional ses:no-track
Here is an example:
<a ses:no-track href="aws.amazon.com">Amazon Web Services</a>
On the other hand they do not allow(YET, maybe in the future) to provide a field to specifically convert some links in the other elements (as in your case

CFDOCUMENT is not putting page number on first page

I have a page that is pulling data from a table, looping through it, and creating PDF pages with the content. I've declared a footer for displaying the page number, which works on every page but the very first. Any ideas what could be going on? I'm on CF2018, version: 2018,0,10,320417
In the code below, "plusVal" is either 0 or 1 depending on whether the generated report will have a cover page I create later and merge with the PDF.
<cfdocument format="pdf" filename="#tempFilepath#\#fileName#_temp.pdf" overwrite="true" bookmark="true" localurl="false"><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Report</title>
</head>
<body>
<cfoutput query="data">
<cfif len(template.header_logo) AND fileExists("#application.linkMediaRoot#\reports\logo\#template.header_logo#")>
<cfdocumentitem type="header"><img src="#application.mediaLink#/reports/logo/#template.header_logo#" /></cfdocumentitem>
</cfif>
<cfdocumentsection name="#data.page_title#">
<br><br>
<div style="font-family: Arial, Helvetica, sans-serif; !important;">
<h1 style="font-size:16pt;">#data.page_title#</h1>
<p>#page_content#</p>
<cfif len(data.additional_content)>
<p>#data.additional_content#</p>
</cfif>
</div>
</cfdocumentsection>
<cfdocumentitem type="footer" evalAtPrint="true">
<span style="font-family: Arial, Helvetica, sans-serif; font-size:10pt; !important">Page #cfdocument.currentpagenumber+plusVal# of #cfdocument.totalpagecount+plusVal#</span>
</cfdocumentitem>
</cfoutput>
</body>
</html>
</cfdocument>

GATE developer_Requesting for Suggestion

I wanted to post the highlighted annotation of a document [highlighted using GATE developer tool] to new file [either word or Excel]. Can someone help me with any suggestions or this?
Thanks in Advance.
Regards,
Gayatri
Sorry, I can't comment yet...
Similar question here Read annotated data from GATE datastore
The provided answer (By Ian Roberts) has means to store selected annotations in files.
Suggestion: Use GATE embedded (with Java).
Reading annotated documents in html is fairly straight forward. You can follow the instructions for printing which can be executed using a text editor. Remember to select the annotations you wish to display and save the artifact using the ‘Save Preserving Format’. The resulting xml will have the annotation tags you select embedded in the saved document.
You can also visualize in html.
<!DOCTYPE html>
<div id="topContent">
<h1>Report Example</h1>
<p>
This example provide a visualization of a annotated document produced by GATE using ANNIE with defaults. To use with Javascript, the document can be formatted as an xml document using xmlHttpRequest.
</p>
</div>
<div id="pageView">
<div id="legendView">
<h3>Document Legend</h3>
<div>
<table id="annotationTable">
<tr>
<th>Facet</th>
<th>Color</th>
</tr>
<tr>
<td>Date</td>
<td id="dateFill"></td>
</tr>
<tr>
<td>Location</td>
<td id="locationFill"></td>
</tr>
<tr>
<td>Organization</td>
<td id="organizationFill"></td>
</tr>
<tr>
<td>Person</td>
<td id="personFill"></td>
</tr>
</table>
</div>
</div>
<p>..Add GATE XML contents here..</p>
</div>
Once the html is set up, add the css:
body {}
table, th, td {
border: 1px solid black;
text-align: center;
font-family: arial;
}
#annotationTable {
border-collapse: collapse;
width: 10%;
}
#topContent {
font: 18px arial;
}
#pageView {
border: 1px solid black;
font: 14px arial;
}
#legendView {
margin: 10px 10px 10px 10px;
}
#dateFill {background-color: rgb(51, 255, 119)}
#locationFill {background-color: rgb(204, 153, 255)}
#organizationFill {background-color: rgb(102, 255, 255)}
#personFill {background-color: rgb(255, 204, 153)}
Date {background-color: rgb(51, 255, 119)}
Location {background-color: rgb(204, 153, 255)}
Organization {background-color: rgb(102, 255, 255)}
Person {background-color: rgb(255, 204, 153)}
This provides a basic view of the GATE annotations. Of course it can be more complicated depending on what you are trying to express. See the Fiddle
To view in MS Word:
Open the saved annotated xml file in MS Word.
Add the css file to the same directory where the annotated document is stored.
Open the Developer Tab in Word.
Select the Document Template icon.
Select the Linked CSS tab, navigate to the location of the annotated document and css file.
Add the css file to the Linked Style Sheets.
Save the document as a Web Page.
Navigate to where you saved the html page and open in your favorite browser.
Ensure that you have selected Print Background Colors and Images from the Page Setup.
Print for a highlighted document.
Kind of a pain in the butt but it works if you want a printed copy. The document will not present css in Word. I hope this helps.

min-height Vs height

I am currently attempting to get a DIV to expand to 100% of the browser's height. I know that is a commonly asked question and so have read countless forums in order to find the answer but have yet to find something which will work across all browsers.
My CSS file looks something like this:
html{height:100%;}
body {
background: #ffffff;
font-size: 0.8em;
line-height: 1.7;
color: #09123e;
height:100%;
}
#wrapper {
background: #ffffff url(../images/assets/wrapper.bg.gif) repeat-y center center;
margin: 0 auto;
height:100%;
}
This renders as expected in all browsers except later versions of Internet Explorer, most notably IE7 and IE8. I have found that if I use min-height instead of height on #wrapper then I get the desired result in the problematic browsers but this then messes up the rendering in everything else. I have tried using a conditional stylesheet but the #wrapper style specified just seems to get ignored.
Any help would be greatly appreciated.
This works fine in all browsers, make sure you use doctype!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
* {margin: 0px; padding: 0px;} //Reset all margins, use some css reset stylesheet instead...
html {height: 100%;}
body {height: 100%;}
#wrapper {
margin: 0 auto;
height: 100%;
}
</style>
</head>
<body>
<div id="wrapper"></div>
</body>
</html>
The only reliable solution to this problem that I've found is to use javascript/jquery to manually change the height. That is, assuming the visitor has javascript enabled. I have a site that has a colored side-menu bar and a white content area. Both are divs and one is float-right, and the other float-left. The content area is Almost always larger than the side menu bar, so to make the colored side bar as long as the content I use this little jQuery snippet.
<script language="javascript">
<!--
$(document).ready(function() {
var p = $( "#pageContent" ).height();
var m = $( "#menuContent" ).height();
if (m < p) $( "#menuContent" ).height( p );
});
-->
</script>

CKEditor "protects" me from inline stylesheets

I'm trying to integrate CKEditor into Wordpress for a client. I'm not too familiar with it, it's the first time I use it.
The client wants to use CKEditor on a textarea that gets stored into a custom field and is displayed in the sidebar of a page.
I added support for this form of editing by adding meta boxes to the page edit window. I have FCKEditor plugin installed, so I just call CKEditor.replace on the relevant metabox.
The problem is that when the meta box contains THIS: (I trimmed the CSS for convenience. There's actually quite a bit).
<style type="text/css">
<!--
.side-banner .style1 {
font-family: Arial;
font-size: 14px;
}
.side-banner .style2 {
font-family: Helvetica;
font-size: 12px;
-->
</style>
<table width="246" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="246" height="15" colspan="2" scope="col"> </th>
CKEditor turns it into this:
<p><style type="text/css">
<!--{cke_protected}%3C!%2D%2D%0A.side-banner%20.style1%20%7B%0A%09font-family%3A%20Arial%2C.side-banner%20.style2%20%7B%0A%09font-family%3A%20Arial%2C%20Helvetica%2C%20sans-serif%3B-->
</style></p>
<table border="0" cellpadding="0" cellspacing="0" width="246">
<tbody>
<tr>
My client insists on editing the sidebox at the CSS/HTML level rather than just content, and I'd like to provide what is requested rather than spend time educating them (this, perhaps, is a topic for another S.O. question?).
I realise this has to do with CKEDITOR.config.protectedSource but I found very little documentation to help me, and I wouldn't know what kind of RegEx to provide to avoid this.
How do I keep CKEditor from gobbling up the HTML/CSS code in this <textarea> tag?
Remove the HTML comments (<!-- and -->) from the <style>
Edit: It's tracked in this ticket http://dev.fckeditor.net/ticket/4880