Paulo,
Below is the small code which is used for REASON_FOR_CHANGE section of PDF. The
code works as below:
1. Create a Document.
2. Open Document.
3. Create Table defining no. of columns
4. Define width of column.
5. Create Phrase (Actual content to be added in PDF).
6. Call setMarkupAttribute() Method to set Property for cell in which
phrase is to be added.
7. Create a cell adding these phrase.
8. Call setCellEvent() method. (get getMarkupAttribute )
9. Add cell to Table.
10. Add Table to Document.
CODE:
float fltWidths[] = {10};
PdfPTable objTable = new PdfPTable(1);
objTable.setWidths(fltWidths);
objTable.setTableEvent(objRFC);
Font fntDesc = FontFactory.getFont(FontFactory.HELVETICA_BOLD, 12, Font.NORMAL,
java.awt.Color.blue);
Font fntFreeTxt = FontFactory.getFont(FontFactory.HELVETICA, 8, Font.NORMAL,
java.awt.Color.black);
Phrase pHead = new Phrase("", fntDesc);
pHead.setMarkupAttribute("ForX", "Cell");
PdfPCell objCell = new PdfPCell(pHead);
objCell.setCellEvent(objRFC);// This method call inturn calls
PdfPCellEvent.cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[]
canvases)
objCell.setBorderWidth(0);
objCell.setHorizontalAlignment(Element.ALIGN_CENTER);
objTable.addCell(objCell);
parent_document.add(objTable);
PdfPCellEvent.cellLayout
In this method we define the properties of cell. Below is the example with
implementation for REASON_FOR_CHANGE Section.
if ("REASON_FOR_CHANGE".equals(strCurrentTab)) {
String strCellPhrase_Main = objPhr.getMarkupAttribute("ForX");
if (("Cell".equals(strCellPhrase_Main))) {
fltLeftXOfTable = objRect.left();
fltRightXOfTable = objRect.right();
}
String strCellPhrase = objPhr.getMarkupAttribute("CellNo");
if ("NewSize".equals(strCellPhrase)) {
fltRFCHorLineForFreeText = objRect.bottom();
objPdfCb.moveTo(fltLeftXOfTable, fltRFCHorLineForFreeText);
objPdfCb.lineTo(fltRightXOfTable, fltRFCHorLineForFreeText);
objPdfCb.stroke();
}
}
Mark
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paulo Soares
Sent: Tuesday, September 09, 2008 1:44 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] com.lowagie.text.Phrase.getMarkupAttribute not
available in version 2.1.3
There's no replacement. Why do you need it, considering that XmlWriter was
removed and HtmlWriter is not supported?
Paulo
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Campbell, Mark
> Sent: Tuesday, September 09, 2008 6:27 PM
> To: [email protected]
> Subject: [iText-questions]
> com.lowagie.text.Phrase.getMarkupAttribute not available in version
> 2.1.3
>
> All,
>
>
>
> I am attempting to get information on the replacement methods for:
>
>
>
> com.lowagie.text.Phrase.getMarkupAttribute
> <file:///D:\Rajendra\APIs\itext-docs-1.3\com\lowagie\text\Mark
upAttributes.html#getMarkupAttribute(java.lang.Stri> ng)> (String
> <http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html> name)
>
> com.lowagie.text.Phrase.setMarkupAttribute
> <file:///D:\Rajendra\APIs\itext-docs-1.3\com\lowagie\text\Mark
upAttributes.html#setMarkupAttribute(java.lang.Stri> ng, java.lang.String)>
(String
> <http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html>
> name, String
> <http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html> value)
>
>
>
> Both have been removed from the latest version of itext. Any help on
> finding the right replacement classes would be appreciated.
>
>
>
> Thanks,
>
>
>
> Mark
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php