Load default system font for UIWebview - objective-c

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.

Related

CFDocument PDF not showing Japanese data

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

I am not sure how to open a video on the product page of opencart using their built in colorbox?

I am new to both opencart and colorbox so excuse my ignorance here. I was wanting to add a 'Demo' link on the category pages to open up the colorbox for either video on youtube or local swf files.
It is opening the youtube video up and the swf file but not in the colorbox - here is the code that I have entered in the description area (youtube).
<link href="colorbox.css" rel="stylesheet" />
<script src="jquery.min.js"></script>
<script src="jquery.colorbox-min.js"></script>
<p><a class="colorbox cboxElement" href="http://www.youtube.com/embed/xrwLTvg22VI">Click
Here to see a Demo of Whaikorero Maori.</a></p>
Though it is said only
Supports photos, grouping, slideshow, ajax, inline, and iframed content.
at ColorBox homepage, at examples page we can see section with other content types (Video/Flash), where the code is as follows:
HTML
Flash / Video (Iframe/Direct Link To YouTube)
JS
$(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:390});
I guess the anchor's class cboxElement does the magic (without that class the link opens to new window)...

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.

HTML rendering using NSTextView

I have an HTML with base 64 encoded inline image. I have to display this in an application. I am using NSTextView to display this. Now this works fine in 10.6 but in 10.5 instead of the image I kind of see a placeholder. So I went ahead and tried opening that HTML with Text Edit. The same thing happened. TextEdit on 10.6 is able to render it perfectly but 10.5 TextEdit is just not able to render the image.
Can some one please tell me what could be wrong. The HTML is like -
<html>
<head>..</head>
<body><p>
<img width="213" height="123" src="data:image/jpg;base64,/9j/....."alt="" />
</p>
</body>
</html>
PS: Please dont ask why I am not using WebView. I have to use NSTextView.

dojo dialog background (frame border, close button, etc) not appears

I am facing strange problem with dojo, I am not able to get background of dojo dialog( frame border, close button, etc,.)
I am only getting Title string and Content string, I can able to move the title string along with content string as like dialog, so I confirmed dialog popup is done, but not able to get background things of dialog.
I am using "claro" theme, I am also displaying "Button", it is coming nice with "claro" theme, but dialog is not coming, please help to find out the problem.
Note: I am running dojo from my own server.
You need two things.
1)
You must embed the Claro CSS.
<link rel="stylesheet" type="text/css" href="/path/to/your/dojo/copy/dijit/themes/claro/claro.css"/>
2)
You must add the class claro to your body tag.
<body class="claro">
</body>