|
|
|
|
@ -8,12 +8,51 @@ import com.lowagie.text.*;
|
|
|
|
|
import com.lowagie.text.pdf.*;
|
|
|
|
|
|
|
|
|
|
public class ExamePDF {
|
|
|
|
|
private static final Font FONT_BOLD = FontFactory.getFont( "Arial", 8, Font.BOLD );
|
|
|
|
|
private static final Font FONT_NORMAL = FontFactory.getFont( "Arial", 8, Font.NORMAL );
|
|
|
|
|
private static final Font FONT_ZAPFDINGBATS = new Font( Font.ZAPFDINGBATS , 12, Font.NORMAL, new Color( 0, 0, 0 ) );
|
|
|
|
|
private final Font FONT_BOLD = FontFactory.getFont( "Arial", 8, Font.BOLD );
|
|
|
|
|
private final Font FONT_NORMAL = FontFactory.getFont( "Arial", 8, Font.NORMAL );
|
|
|
|
|
private final Font FONT_ZAPFDINGBATS = new Font( Font.ZAPFDINGBATS , 12, Font.NORMAL, new Color( 0, 0, 0 ) );
|
|
|
|
|
|
|
|
|
|
private BaseFont BASE_WINGDINGS;
|
|
|
|
|
private Font FONT_WINGDINGS;
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
|
// {
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// //BASE_WINGDINGS = BaseFont.createFont("C:\\WINNT\\Fonts\\WINGDING.TTF", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
|
|
|
|
|
// BASE_WINGDINGS = BaseFont.createFont("WingDings", BaseFont.CP1252, BaseFont.EMBEDDED);
|
|
|
|
|
// InputStream stream = BaseFont.getResourceStream( "WING", ClassLoader loader)
|
|
|
|
|
// BASE_WINGDINGS = BaseFont.createFont("WingDings", BaseFont.CP1252, BaseFont.EMBEDDED,
|
|
|
|
|
// true, byte[] ttfAfm, null );
|
|
|
|
|
// FONT_WINGDINGS = new Font(BASE_WINGDINGS, 12);
|
|
|
|
|
// }
|
|
|
|
|
// catch( Exception ex )
|
|
|
|
|
// {
|
|
|
|
|
// FONT_WINGDINGS = FONT_NORMAL;
|
|
|
|
|
// System.out.println( "NO FONT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" );
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
public ExamePDF()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//BASE_WINGDINGS = BaseFont.createFont("C:\\WINNT\\Fonts\\WINGDING.TTF", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
|
|
|
|
|
//BASE_WINGDINGS = BaseFont.createFont("WingDings", BaseFont.CP1252, BaseFont.EMBEDDED);
|
|
|
|
|
InputStream stream = BaseFont.getResourceStream( "WINGDING.TTF", getClass().getClassLoader() );
|
|
|
|
|
byte []bytes = new byte[ stream.available() ];
|
|
|
|
|
stream.read( bytes );
|
|
|
|
|
BASE_WINGDINGS = BaseFont.createFont("Wingdings", BaseFont.CP1252, BaseFont.EMBEDDED,
|
|
|
|
|
true, bytes, null );
|
|
|
|
|
FONT_WINGDINGS = new Font(BASE_WINGDINGS, 12);
|
|
|
|
|
// FONT_WINGDINGS = FontFactory.getFont( "Wingdings" );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
FONT_WINGDINGS = FONT_NORMAL;
|
|
|
|
|
System.out.println( "NO FONT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" );
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main( String[] args )
|
|
|
|
|
@ -347,7 +386,9 @@ public class ExamePDF {
|
|
|
|
|
private Phrase doCheckedPhrase( String text, boolean checked, boolean indent )
|
|
|
|
|
{
|
|
|
|
|
Phrase p = new Phrase( 12f );
|
|
|
|
|
p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 110: 111) + " ", FONT_ZAPFDINGBATS ) );
|
|
|
|
|
//p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 110: 111) + " ", FONT_ZAPFDINGBATS ) );
|
|
|
|
|
//System.out.println( "FAMILY: " + FONT_WINGDINGS.getFamilyname() );
|
|
|
|
|
p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 0xfe: 0xa8), FONT_WINGDINGS ) );
|
|
|
|
|
p.add( new Chunk( text, FONT_NORMAL ) );
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|