Friday, December 30, 2011

Video in Xpage

With the use of embed tag and object tag we can import video or flash file into our

xpage...
Example for embedtag: Put the following tag into our xpage source
embed src="somefilename.swf" width="550" height="400"
embed

similarly for , But this is for flash file only...
object

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.c

ab#version=9,0,115,0" data="C:\Documents and Settings\maarga_trainees\My

Documents\choudanse7.swf"
type="application/x-shockwave-flash"

How to find the running environment of X-pages

Here I am going to tell that current X-page is running Whether in notes or client. Using that information we can visible or disable a control depend upon running environment.

Her i give a simple example that if running environment is notes means that label shows "Notes " else it shows "WEB"
xp:label id="label1"
[CDATA[#{javascript:
if( context.isRunningContext('Notes') ){
return "Notes ";
}
return "WEB ";
}]]> /xp:this.value

/xp:label

Java pdfwriter and Document

With the use of Java Document class, We can easily create pdf file in a efficient manner.

And also we can use to Lotus notes Java Agent.,

Sample Code for Header and Footer is in below,

If we want to put a logo in all pages, In headerfooter class's objects are helping us...

Image img1=Image.getInstance("C:\\Documents and Settings\\maarga_trainees\\Desktop\\test\\maarga_logo.jpg");
HeaderFooter header= new HeaderFooter(new Phrase(new Chunk((Image) img1,0,0)), false);
HeaderFooter footer = new HeaderFooter(new Phrase("Footer"), new Phrase("."));
docpdf.setHeader(header);
docpdf.setFooter(footer);

Here we have header and footer. And also we can add a new table in header and footer for proper order.

Table in header and footer of PDF file...

Using Java Agent...

We can make a table in HeaderFooter class for a proper alignment of PDF generation.

We can manipulate the header and footer section using that Table.,

There we can put our Lotus notes document also.,

Table t=new Table(1,1);
t.addCell("Hai It is Header...|");
t.setBackgroundColor(Color.blue);
ph.add(t);
HeaderFooter header= new HeaderFooter(ph, true);
header.setBorder(100);
header.setTop(500);
HeaderFooter footer = new HeaderFooter(new Phrase("Footer"), new Phrase("."));
docpdf.setHeader(header);
docpdf.setFooter(footer);

Anchor link page-citation in iText

We can give the link and page citation for or PDF file using itext....

For instead of generating pdf via xml and xslt, We can get from itext,

here also we can give link and page citation use of following classes.,

Font font = new Font();
font.setColor(Color.GREEN);
font.setStyle(Font.UNDERLINE);
docpdf.add(new Chunk("Chapter 1"));
docpdf.add(new Paragraph(new Chunk("Press here to go chapter 2", font).setLocalGoto("2")));// Code 2
docpdf.newPage();
docpdf.add(new Chunk("Chapter 2").setLocalDestination("2"));
docpdf.add(new Paragraph(new Chunk("http://www.maargasystems.com", font).setAnchor("http://www.maargasystems.com")));//Code 3
docpdf.add(new Paragraph( new Chunk("Open CreatePDFInlotus.pdf chapter 3", font).setRemoteGoto("D:\\Ram\\CreatePDFInlotus.pdf", "3")));//Code 4