incubator-odf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r795158 - /websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo8.html
Date Fri, 02 Sep 2011 09:12:32 GMT
Author: buildbot
Date: Fri Sep  2 09:12:31 2011
New Revision: 795158

Log:
Staging update by buildbot

Modified:
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo8.html

Modified: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo8.html
==============================================================================
--- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo8.html (original)
+++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo8.html Fri Sep  2
09:12:31 2011
@@ -78,225 +78,70 @@
   <div id="contenta">
   
     
-    <!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" href="../images/style.css" type="text/css" />
-
-<link type="text/css" rel="stylesheet" href="styles/shCoreEclipse.css"/>
-
-<title>Demos - SimpleODF</title>
-
-<style type="text/css">
-
-<!--
-
-.STYLE1 {
-
-color: #FFFFFF;
-
-font-size: 24px;
-
-}
-
-.STYLE2 {font-size: 32px}
-
-.STYLE3 {font-size: 16px}
-
-.STYLE4 {font-size: 36px}
-
--->
-
-</style>
-
-<script type="text/javascript" src="scripts/shCore.js"></script>
-
-<script type="text/javascript" src="scripts/shBrushJava.js"></script>
-
-<script type="text/javascript"> SyntaxHighlighter.all();</script>
-
-<script type="text/javascript">
-
-var _gaq = _gaq || [];
-
-_gaq.push(['_setAccount', 'UA-22366020-1']);
-
-_gaq.push(['_trackPageview']);
-
-(function() {
-
-var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-
-ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-
-var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-
-})();
-
-</script>
-
-</head>
-
-<body>
-
-<div id="page" align="center">
-
-<div id="content" style="width:920px" class="contentpanel">
-
-<div id="topheader">
-
-<div class="topright"> </div>
-
-</div>
-
-<div id="menu">
-
-<div align="left" class="smallwhitetext"> <a href="../index.html" class="home">
</a> <a href="../downloads.html" class="download"></a> <a href="../documents.html"
class="document"></a> <a href="../demo/index.html" class="sample"> </a>
</div>
-
-</div>
-
-<div id="subcontent" align ="left">
-
-<div align="left" class="titletext"> <span >
-        <a href="index.html">Simple Demos<a> >
-
-<a href="demo8.html">Demo 7: Add 2D barcode image to a slide<a>
-
-</span>
-
-</div>
-
-<!---------------------------------------------------------------------------------------------------->
-
-<div class="contenttitle">
-
-<a name="overview">Overview</a>
-
-</div>
-
-<div class="bodytext">
-
-<p>This demo shows the power of image and metadata support in Simple ODF.<br /><br/>
-
-A 2D bar code is a special image that can be scanned by a smart phone or a dedicated scanner.
It could contain a URL, a books ISBN number a vCard for a person's contact, information, etc.
It makes it easy to transfer information into a smartphone from a physical object, like a
printed document, or a newspaper or magazine.<br /><br/>
-    In this demo, the contact information of a document's author has been put in the metadata
of a presentation document, with an ODF editor, such as IBM Lotus Symphony. The contact information
in the metadata is extracted with the Simple ODF API, and wrapped into JSON object. Then a
RESTful web service is called to generate a 2D bar code image based on this JSON object. 
-    The bar code image is then added to the first slide of this presentation using the Simple
ODF API.<br /><br/>
-
-This picture shows how the contact information is added to the metadata of this document.<br
/><br/>
-
-<img src="image/demo8_metadata.bmp" ></img><br/>
-<br />This picture shows the 2D bar code image added to the first slide of this presentation
document.<br /><br/> 
-<img src="image/demo8_slide.bmp" ></img><br/>
+    <p><a href="index.html"><strong>Demos</strong></a> &gt;
<b>Add 2D barcode image to a slide</b> <br />
 </p>
-
-</div>
-
-<hr/>
-
-<div class="contenttitle">
-
-<a name="codeintroduction">Code Introduction</a>
-
-</div>
-
-<div class="bodytext">
-
-<p>
-
-There code of this demo is very simple. First, we load the presentation document, and extract
the metadata with Simple ODF API. Second, we invoke the web service to generate the bar code
image and get the URI of this image.
-
-Finally, we get the subtitle text box in the first slide, add an image just below of this
subtitle text box. Please note how FrameRectangle is used to specify the image position.<br
/><br/>
-
-<!--java code-->
-
-<pre class="brush:java;">
-
-public static void main(String[] args) {
-
-try {
-            //load the presentation
-            PresentationDocument presentation = PresentationDocument.loadDocument("Demotemplate.odp");
-            //get the metadata
-            Meta metaData = new Meta(presentation.getMetaDom());
-            String creator = metaData.getCreator();
-            String mailto = metaData.getUserDefinedDataValue("Email");
-            String phoneno = metaData.getUserDefinedDataValue("Phone");
-
-//invoke the 2D barcode service, and get the url
-            BarcodeImageGeneration demo = new BarcodeImageGeneration();
-            String url = demo.invokepost(creator,mailto,phoneno);
-
-//Add the image to the first slide
-            Slide slide = presentation.getSlideByIndex(0);
-            Textbox subtitleBox = slide.getTextboxByUsage(PresentationClass.SUBTITLE).get(0);
-            FrameRectangle subtitleRect = subtitleBox.getRectangle();
-            Image image = Image.newImage(slide, new URI(url));
-            FrameRectangle imageRect = image.getRectangle();
-            imageRect.setX(subtitleRect.getX()+(subtitleRect.getWidth()-imageRect.getWidth())/2);
-            imageRect.setY(subtitleRect.getY()+subtitleRect.getHeight());
-            image.setRectangle(imageRect);
-
-presentation.save("output.odp");
-
-} catch (Exception e) {
-            e.printStackTrace();
-        }
-
-}
-
-</pre>
-
+<p><strong>Overview</strong>  <br />
 </p>
-
-</div>
-
-<hr/>
-
-<div class="contenttitle">
-
-<a name="download">Download</a>
-
-</div>
-
-<div class="bodytext">
-
-<p>
-
-Powered by the Simple Java API for ODF version  <a target="_new" href="../downloads.html"><img
src="../images/link.png"></img>0.5.5</a>.
-
+<p>This demo shows the power of image and metadata support in Simple API.<br />
 </p>
-
-<p>
-
-You can download the code of this demo from <a href="TwoDBarcodeDemo.zip"><img src="../images/link.png"></img>here</a>.
-
+<p>A 2D bar code is a special image that can be scanned by a smart phone or a dedicated
scanner. It could contain a URL, a books ISBN number a vCard for a person's contact, information,
etc. It makes it easy to transfer information into a smartphone from a physical object, like
a printed document, or a newspaper or magazine. <br />
 </p>
-
-<p>
-
-The dependent library jslib.zip can be downloaded from <a href="http://puzzle.dl.sourceforge.net/sourceforge/xulmaker/jslib.zip"><img
src="../images/link.png"></img>here</a>.
-
+<p>In this demo, the contact information of a document's author has been put in the
metadata of a presentation document, with an ODF editor, such as IBM Lotus Symphony. The contact
information in the metadata is extracted with the Simple ODF API, and wrapped into JSON object.
Then a RESTful web service is called to generate a 2D bar code image based on this JSON object.
 <br />
 </p>
-</div>
-
-<!---------------------------------------------------------------------------------------------------->
-
-</div>
-
-<div id="footer" class="smallgraytext"> <a href="#">Home</a> | <a href="#">About
Us</a> | <a href="#">Contact Us</a> </div>
+<p>The bar code image is then added to the first slide of this presentation using the
Simple API. <br />
+</p>
+<p>This picture shows how the contact information is added to the metadata of this
document.  <br />
+</p>
+<p><img alt="image1" src="image/demo8_metadata.bmp" /></p>
+<p>This picture shows the 2D bar code image added to the first slide of this presentation
document.<br /><br/> 
+<img alt="image2" src="image/demo8_slide.bmp" /> <br />
+</p>
+<p><strong>Code Introduction</strong><br />
+</p>
+<p>There code of this demo is very simple. First, we load the presentation document,
and extract the metadata with Simple ODF API. Second, we invoke the web service to generate
the bar code image and get the URI of this image.  <br />
+</p>
+<p>Finally, we get the subtitle text box in the first slide, add an image just below
of this subtitle text box. Please note how FrameRectangle is used to specify the image position.
 <br />
+</p>
+<div class="codehilite"><pre><span class="n">public</span> <span
class="n">static</span> <span class="n">void</span> <span class="n">main</span><span
class="p">(</span><span class="n">String</span><span class="o">[]</span>
<span class="n">args</span><span class="p">)</span> <span class="p">{</span>
 
-</div>
+    <span class="n">try</span> <span class="p">{</span>
+        <span class="sr">//</span><span class="n">load</span> <span
class="n">the</span> <span class="n">presentation</span>
+        <span class="n">PresentationDocument</span> <span class="n">presentation</span>
<span class="o">=</span> <span class="n">PresentationDocument</span><span
class="o">.</span><span class="n">loadDocument</span><span class="p">(</span><span
class="s">&quot;Demotemplate.odp&quot;</span><span class="p">);</span>
+        <span class="sr">//g</span><span class="n">et</span> <span
class="n">the</span> <span class="n">metadata</span>
+        <span class="n">Meta</span> <span class="n">metaData</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">Meta</span><span
class="p">(</span><span class="n">presentation</span><span class="o">.</span><span
class="n">getMetaDom</span><span class="p">());</span>
+        <span class="n">String</span> <span class="n">creator</span>
<span class="o">=</span> <span class="n">metaData</span><span class="o">.</span><span
class="n">getCreator</span><span class="p">();</span>
+        <span class="n">String</span> <span class="n">mailto</span>
<span class="o">=</span> <span class="n">metaData</span><span class="o">.</span><span
class="n">getUserDefinedDataValue</span><span class="p">(</span><span
class="s">&quot;Email&quot;</span><span class="p">);</span>
+        <span class="n">String</span> <span class="n">phoneno</span>
<span class="o">=</span> <span class="n">metaData</span><span class="o">.</span><span
class="n">getUserDefinedDataValue</span><span class="p">(</span><span
class="s">&quot;Phone&quot;</span><span class="p">);</span>
+
+        <span class="sr">//i</span><span class="n">nvoke</span> <span
class="n">the</span> <span class="mi">2</span><span class="n">D</span>
<span class="n">barcode</span> <span class="n">service</span><span
class="p">,</span> <span class="ow">and</span> <span class="n">get</span>
<span class="n">the</span> <span class="n">url</span>
+        <span class="n">BarcodeImageGeneration</span> <span class="n">demo</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">BarcodeImageGeneration</span><span
class="p">();</span>
+        <span class="n">String</span> <span class="n">url</span>
<span class="o">=</span> <span class="n">demo</span><span class="o">.</span><span
class="n">invokepost</span><span class="p">(</span><span class="n">creator</span><span
class="p">,</span><span class="n">mailto</span><span class="p">,</span><span
class="n">phoneno</span><span class="p">);</span>
+
+        <span class="sr">//</span><span class="n">Add</span> <span
class="n">the</span> <span class="n">image</span> <span class="n">to</span>
<span class="n">the</span> <span class="n">first</span> <span class="n">slide</span>
+        <span class="n">Slide</span> <span class="n">slide</span>
<span class="o">=</span> <span class="n">presentation</span><span
class="o">.</span><span class="n">getSlideByIndex</span><span class="p">(</span><span
class="mi">0</span><span class="p">);</span>
+        <span class="n">Textbox</span> <span class="n">subtitleBox</span>
<span class="o">=</span> <span class="n">slide</span><span class="o">.</span><span
class="n">getTextboxByUsage</span><span class="p">(</span><span class="n">PresentationClass</span><span
class="o">.</span><span class="n">SUBTITLE</span><span class="p">)</span><span
class="o">.</span><span class="n">get</span><span class="p">(</span><span
class="mi">0</span><span class="p">);</span>
+        <span class="n">FrameRectangle</span> <span class="n">subtitleRect</span>
<span class="o">=</span> <span class="n">subtitleBox</span><span
class="o">.</span><span class="n">getRectangle</span><span class="p">();</span>
+        <span class="n">Image</span> <span class="n">image</span>
<span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span
class="n">newImage</span><span class="p">(</span><span class="n">slide</span><span
class="p">,</span> <span class="k">new</span> <span class="n">URI</span><span
class="p">(</span><span class="n">url</span><span class="p">));</span>
+        <span class="n">FrameRectangle</span> <span class="n">imageRect</span>
<span class="o">=</span> <span class="n">image</span><span class="o">.</span><span
class="n">getRectangle</span><span class="p">();</span>
+        <span class="n">imageRect</span><span class="o">.</span><span
class="n">setX</span><span class="p">(</span><span class="n">subtitleRect</span><span
class="o">.</span><span class="n">getX</span><span class="p">()</span><span
class="o">+</span><span class="p">(</span><span class="n">subtitleRect</span><span
class="o">.</span><span class="n">getWidth</span><span class="p">()</span><span
class="o">-</span><span class="n">imageRect</span><span class="o">.</span><span
class="n">getWidth</span><span class="p">())</span><span class="o">/</span><span
class="mi">2</span><span class="p">);</span>
+        <span class="n">imageRect</span><span class="o">.</span><span
class="n">setY</span><span class="p">(</span><span class="n">subtitleRect</span><span
class="o">.</span><span class="n">getY</span><span class="p">()</span><span
class="o">+</span><span class="n">subtitleRect</span><span class="o">.</span><span
class="n">getHeight</span><span class="p">());</span>
+        <span class="n">image</span><span class="o">.</span><span
class="n">setRectangle</span><span class="p">(</span><span class="n">imageRect</span><span
class="p">);</span>
+
+        <span class="n">presentation</span><span class="o">.</span><span
class="n">save</span><span class="p">(</span><span class="s">&quot;output.odp&quot;</span><span
class="p">);</span>
+
+    <span class="p">}</span> <span class="n">catch</span> <span
class="p">(</span><span class="n">Exception</span> <span class="n">e</span><span
class="p">)</span> <span class="p">{</span>
+        <span class="n">e</span><span class="o">.</span><span
class="n">printStackTrace</span><span class="p">();</span>
+    <span class="p">}</span>
 
-</div>
+<span class="p">}</span>
+</pre></div>
 
-</body>
 
-</html>
+<p><strong>Download</strong><br />
+</p>
+<p>Powered by the Simple Java API for ODF version <a href="../downloads.html">0.5.5</a>.
<br />
+You can download the code of this demo from <a href="TwoDBarcodeDemo.zip">here</a>.<br
/>
+The dependent library jslib.zip can be downloaded from <a href="http://puzzle.dl.sourceforge.net/sourceforge/xulmaker/jslib.zip">here</a>.</p>
   </div>
 
   <div id="footera">



Mime
View raw message