CFDocument PDF not showing Japanese data - pdf

I have created a pdf with Japanese content using CFDocument. But It does not showing the Japanese data. I have used pageEncoding as utf-8. It showing only blank space instead of Japanese data.
I have used the following code,
<cfcontent type="application/pdf">
<cfheader name="Content-Disposition" value="attachment;filename=test.pdf">
<cfprocessingdirective pageencoding="utf-8">
<cfdocument format="PDF" localurl="yes" marginTop=".25" marginLeft=".25" marginRight=".25" marginBottom=".25" pageType="custom" pageWidth="8.5" pageHeight="10.2">
<cfoutput>
<?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>PDF Export Example</title>
<style>
body { font-family: Verdana; }
</style>
</head>
<body>
<h1>PDF Export Example</h1>
<p>担当するクライエントの大半は様々な規模の企業だが、カナダの大学や政府関連の研究機関の担当経験もある。
</p>
<h1>PDF Export English Example</h1>
<p>This is an example.
</p>
</body>
</html>
</cfoutput>
</cfdocument>
Please help!

It seems Verdana's implementation when used in PDF doesn't support Chinese / Japanese. However it looks like MingLiU does. I just changed it to use that font, and everything worked OK via ColdFusion 10. It still didn't work in Railo, but I assume that's a Railo problem, not a PDF / font problem.
So, anyway, just use a font that specifically supports the glyphs you need to render.

Something I ran into years ago.
In order to have the Chinese or Japanese characters rendered up
correctly in PDF using and , you should first check what's your
default locale at ColdFusion Administrator -> Setting Summary -> Java
Default Locale. One would have thought CFML will respect custom
locale using setLocale(), but it doesn't.
If it is "en_US", edit /lib/cffont.properties. Otherwise, create a
/lib/cffont.properties.#locale#(e.g. /lib/cffont.properties.zh_TW )
using cffont.properties as reference.
Replace the font(s) after '=' with system's Chinese font (e.g.
MingLiu) for Chinese or system's Japanese font (e.g. MS UI Gothic) for
Japanese respectively, assuming ColdFusion is installed on Windows,
and client has the respective font(s) installed.
http://henrylearnstorock.blogspot.ca/2010/08/how-to-render-chinese-japanese.html

Related

Custom live template does not show up in xhtml JSF file

I am using IntelliJ 2017.2 ultimate edition and I have created a live template to surround text in xhtml (JSF) by a tag and attribute.
#{myvalue}
should become
<h:outputText value="#{myvalue}" />
I created a live template named "swot" applicable to in XML : XML Text.
<h:outputText value="$SELECTION$" />
Unfortunately, it does not show up when I try to surround a selection in a xhtml file. I only get standard live templates.
Update with solution
As the file in which I want to applicate the template is JSF xhtml file, I just had to applicate it to "JSP"
As the file in which I want to applicate the template is JSF xhtml file, I just had to applicate it to "JSP"
Setting the applicability to HTML should solve your issue. Please see below image:

Load default system font for UIWebview

I've two views on my view one is a UIWebview and other is a UITextView and I want both of them to display system default font. But, I just loaded a plain HTML text on my UIWebview and loaded another plain text on textview with default system font. On UIWebview it looks like Times New Roman and on textview it looks like Helvetica. Does the default system font differs for UIWebview?
This is the HTML page source that I load and below is a textview that uses system font.
<html>
<body>
This is a sample html Page
</body>
</html>
I presume if you didn't specify the Font name in html it will take default Font from OS. The default font may vary based on OS and browsers. In iOS you can specify the default name like given below:
<html>
<head>
<style type=\"text/css\">
body{font-family: '-apple-system','HelveticaNeue'; font-size:17;}
</style>
</head>
<body>
This is a sample html Page
</body>
</html>
In the above code it will take apple default font. If it is not available it will take HelveticaNeue font.
UIWebView is just a Safari component inside your app. So when you put HTML content into it, you're kind of loading a page.
The default fontface for web content is Times New Roman, so if you want to change it you need to style your HTML content to change default fontface, using the same type as the system.

cfchart not printing in PDF

I'm trying to print PDF from HTML using cfdocument. The code works fine when I access it through localhost, but when I use static IP to test it online on the same server it timeouts.
I tried cfhtmltopdf it didn't timeouts but it doesn't generate the chart and shows "image missing icon". nor charts get generated nor images. text gets printed fine. And it takes like 20 to 30 seconds to generated the PDF when an image or chart is used.
I tried this on CF11 32bit and 6bit both having same issue.
Even the simplest codes fails:
<cfhtmltopdf>
<!DOCTYPE html>
<html>
<body>
<div class="pdf_logo" style="margin-bottom: 20px;">
<img src="images/logo.png" width="180">
</div>
</body>
</html>
</cfhtmltopdf>
Your problem is probably with resolution of the path to the image. try an absolute path (http://) Or a file path (file:\) ... try resolving the image from the desktop of the server itself.
Remember that the server internally must resolve your images/logo.png into something like . If (for example) your pdf generating cfm is in a folder that is not the root, the server may resolve it to http://blah.com/some folder/images/logo.png - which naturally won't work because there's no "images" folder in there.
Other possibilities? Your server can't resolve an "internal" natted address, or is trying to use an external non-natted address through the firewall interface.
Fortunately almost all these problems can be easily tested or resolved. You will also save yourself headaches by simply using the file method to include any resources into your PDF file.
For more on resolution issues see my post on Network address resolution and Cfdocument.
Hope this helps! good luck.
I've encountered a similar issue with cfhtmltopdf. In my case, I was using a cfimage tag, and the images were being rendered in the PDF document very sporadically.
I suspect that the rendering of the cfhtmltopdf tag happens asynchronously, in a separate thread from any rendering that may happen inside that tag (for example, cfimage or cfchart). So the cfhtmltopdf tag will finish rendering, and it won't have the results from the rendering of cfimage or cfchart, so it displays the "broken image" icon because it can't find the source.
So this solution based on ColdFusion documentation† might help you:
<!--- 1. Generate the chart as a jpeg image. --->
<cfchart name="myChart" format="jpg">
<cfchartseries type="pie">
<cfchartdata item="New Vehicle Sales" value=500000>
<cfchartdata item="Used Vehicle Sales" value=250000>
<cfchartdata item="Leasing" value=300000>
<cfchartdata item="Service" value=400000>
</cfchartseries>
</cfchart>
<!--- 2. Write the jpeg image to a temporary directory. --->
<cffile
action="write"
file="#ExpandPath('/charts/vehicle.jpg')#"
output="#myChart#" />
<!--- 3. Generate the PDF file. --->
<cfhtmltopdf>
<!DOCTYPE html>
<cfoutput>
<html>
<body>
<div class="chart">
<!--- This image tag refers to the file created by cffile --->
<img src="/charts/vehicle.jpg" />
</div>
</body>
</html>
</cfoutput>
</cfhtmltopdf>
† Based on the example here: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7934.html

landscape fixed layout epub 3 viewing only 1 page at a time starting from indesign file

I am creating an indesign cs6 epub3 fixed layout with landscape only mode, viewing only one page at a time.
I added the meta
<meta property="rendition:layout">pre-paginated</meta>
<meta property="rendition:orientation">landscape</meta>
<meta property="rendition:spread">none</meta>
and I also specified the width and height in css and each xhtml file with
<meta name="viewport" content="width=1024, height=768" />
I want the document to appear as one landscape page only, not as a two sides book. Does anyone know how to achieve that?
Ensure that the package element within the .opf file includes version="3.0" and prefix="rendition: http://www.idpf.org/vocab/rendition/#.
e.g.
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="bookid" version="3.0" prefix="rendition: http://www.idpf.org/vocab/rendition/# ibooks:http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/">
See Liz Castro's blog post on fixed layouts for more info.
http://www.pigsgourdsandwikis.com/2012/05/readium-displays-fixed-layout-epub-on.html

How to refresh automatically on a PDF viewer?

I am editing LaTeX on my Windows Vista systems. Which I am using pdflatex to generate PDF file constantly.
My PDF viewer is Adobe Acrobat Professional 7, I have to close and open the same file each time to get the new look.
Is there any way to keep the PDF viewer refreshing the PDF pages once it changed?
From a question on super user
SumatraPDF is free, for Windows, and plays nicely with LaTeX. It will automatically refresh when the pdf is updated.
It's also portable, which is nice.
The viewer does not regularly check changes on disk, so short answer: no (unfortunately)
You could however, use your browser to see the pdf file, inside your own html 'webpage' that regularly refreshes the page using javascript.
this is how (including buttons for switching between manual and automatic refreshing):
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>my pdf</title>
<script type="text/javascript">
var timer = null;
function refresh(){
var d = document.getElementById("pdf"); // gets pdf-div
d.innerHTML = '<embed src="myPdfFile.pdf" width="700" height="575">';
}
function autoRefresh(){
timer = setTimeout("autoRefresh()", 2000);
refresh();
}
function manualRefresh(){
clearTimeout(timer);
refresh();
}
</script>
</head>
<body>
<button onclick="manualRefresh()">manual refresh</button>
<button onclick="autoRefresh()">auto refresh</button>
<div id="pdf"></div>
</body>
<script type="text/javascript">refresh();</script>
</html>
Just save this code as e.g. 'pdfrefresher.html' in the same folder as your pdf. As src of the embed object you use only the filename, e.g. 'myPdfFile.pdf' (not disk or directory).
In the code, you can adjust the width and height of the embedded object and the timeout (in milliseconds).
Evince pdf viewer auto-refreshes.
It is an extremely light and free (GNU) pdf viewer that is the default on most linux OS. There is a Windows version also. Although, I have used evince only in linux, I am sure it has the same features in Windows.
Adobe Reader and/or Adobe Acrobat are notorious for not supporting auto-refreshing the view of a PDF which changed on disk.
If you need that, you should switch your viewer.
SumatraPDF is available for Windows and does auto-refresh the view. Should it not work at times, you can simply type 'r' to force a refresh...
For Linux desktop systems, xreader does an excellent job in the "auto-refresh capable" category. Small number of dependencies; not heavily dependent on any particular desktop (ex: GNOME, KDE) either.
For user who are on MacOS you have LivePDFViewer that allows you live update of the view and other additional adds like highlighting changes or images zoom.