コード例 #1
0
ファイル: PdfOutline.java プロジェクト: JstnPwll/DroidText
 /**
  * Returns the PDF representation of this <CODE>PdfOutline</CODE>.
  *
  * @param writer the encryption information
  * @param os
  * @throws IOException
  */
 public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
   if (color != null && !color.equals(Color.black)) {
     put(
         PdfName.C,
         new PdfArray(
             new float[] {
               color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f
             }));
   }
   int flag = 0;
   if ((style & Font.BOLD) != 0) flag |= 2;
   if ((style & Font.ITALIC) != 0) flag |= 1;
   if (flag != 0) put(PdfName.F, new PdfNumber(flag));
   if (parent != null) {
     put(PdfName.PARENT, parent.indirectReference());
   }
   if (destination != null && destination.hasPage()) {
     put(PdfName.DEST, destination);
   }
   if (action != null) put(PdfName.A, action);
   if (count != 0) {
     put(PdfName.COUNT, new PdfNumber(count));
   }
   super.toPdf(writer, os);
 }
コード例 #2
0
ファイル: PdfOutline.java プロジェクト: JstnPwll/DroidText
 /**
  * Helper for the constructors.
  *
  * @param parent the parent outline
  * @param title the title for this outline
  * @param open <CODE>true</CODE> if the children are visible
  */
 void initOutline(PdfOutline parent, String title, boolean open) {
   this.open = open;
   this.parent = parent;
   writer = parent.writer;
   put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE));
   parent.addKid(this);
   if (destination != null && !destination.hasPage()) // bugfix Finn Bock
   setDestinationPage(writer.getCurrentPage());
 }