Java/PDF RTF/Chunk Skew

Материал из Java эксперт
Версия от 18:01, 31 мая 2010; (обсуждение)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Chunk Skew(0, 12)

import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
public class Skew012 {
  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter.getInstance(document, new FileOutputStream("Skew012.pdf"));
      document.open();
      Chunk italic = new Chunk("This is a chunk.");
      italic.setSkew(0f, 12f);
      document.add(italic);
      
    } catch (Exception e) {
      System.err.println(e.getMessage());
    } 
    document.close();
  }
}





Set Chunk Skew (45,0)

import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
public class Skew450 {
  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter.getInstance(document, new FileOutputStream("Skew450.pdf"));
      document.open();
      Chunk chunk = new Chunk("This is a chunk.");
      chunk.setSkew(45f, 0f);
      document.add(chunk);
      
    } catch (Exception e) {
      System.err.println(e.getMessage());
    } 
    document.close();
  }
}





Setting Chunk Skew (-45, 0)

import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
public class Skew_450 {
  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter.getInstance(document, new FileOutputStream("Skew_450.pdf"));
      document.open();
      Chunk chunk = new Chunk("This is a chunk.");
      chunk.setSkew(-45f, 0f);
      document.add(chunk);
      
    } catch (Exception e) {
      System.err.println(e.getMessage());
    } 
    document.close();
  }
}