Search in sources :

Example 76 with COSDictionary

use of com.tom_roush.pdfbox.cos.COSDictionary in project PdfBox-Android by TomRoush.

the class PDCIDFontType2Embedder method toCIDSystemInfo.

private COSDictionary toCIDSystemInfo(String registry, String ordering, int supplement) {
    COSDictionary info = new COSDictionary();
    info.setString(COSName.REGISTRY, registry);
    info.setString(COSName.ORDERING, ordering);
    info.setInt(COSName.SUPPLEMENT, supplement);
    return info;
}
Also used : COSDictionary(com.tom_roush.pdfbox.cos.COSDictionary)

Example 77 with COSDictionary

use of com.tom_roush.pdfbox.cos.COSDictionary in project PdfBox-Android by TomRoush.

the class PDCIDFontType2Embedder method createCIDFont.

private COSDictionary createCIDFont() throws IOException {
    COSDictionary cidFont = new COSDictionary();
    // Type, Subtype
    cidFont.setItem(COSName.TYPE, COSName.FONT);
    cidFont.setItem(COSName.SUBTYPE, COSName.CID_FONT_TYPE2);
    // BaseFont
    cidFont.setName(COSName.BASE_FONT, fontDescriptor.getFontName());
    // CIDSystemInfo
    COSDictionary info = toCIDSystemInfo("Adobe", "Identity", 0);
    cidFont.setItem(COSName.CIDSYSTEMINFO, info);
    // FontDescriptor
    cidFont.setItem(COSName.FONT_DESC, fontDescriptor.getCOSObject());
    // W - widths
    buildWidths(cidFont);
    // Vertical metrics
    if (vertical) {
        buildVerticalMetrics(cidFont);
    }
    // CIDToGIDMap
    cidFont.setItem(COSName.CID_TO_GID_MAP, COSName.IDENTITY);
    return cidFont;
}
Also used : COSDictionary(com.tom_roush.pdfbox.cos.COSDictionary)

Example 78 with COSDictionary

use of com.tom_roush.pdfbox.cos.COSDictionary in project PdfBox-Android by TomRoush.

the class FDFField method getKids.

/**
 * This will get the list of kids. This will return a list of FDFField objects. This will return null if the
 * underlying list is null.
 *
 * @return The list of kids.
 */
public List<FDFField> getKids() {
    COSArray kids = (COSArray) field.getDictionaryObject(COSName.KIDS);
    List<FDFField> retval = null;
    if (kids != null) {
        List<FDFField> actuals = new ArrayList<FDFField>();
        for (int i = 0; i < kids.size(); i++) {
            actuals.add(new FDFField((COSDictionary) kids.getObject(i)));
        }
        retval = new COSArrayList<FDFField>(actuals, kids);
    }
    return retval;
}
Also used : COSArray(com.tom_roush.pdfbox.cos.COSArray) COSDictionary(com.tom_roush.pdfbox.cos.COSDictionary) ArrayList(java.util.ArrayList) COSArrayList(com.tom_roush.pdfbox.pdmodel.common.COSArrayList)

Example 79 with COSDictionary

use of com.tom_roush.pdfbox.cos.COSDictionary in project PdfBox-Android by TomRoush.

the class FDFField method getAdditionalActions.

/**
 * This will get a list of additional actions that will get executed based on events.
 *
 * @return The AA entry in this field dictionary.
 */
public PDAdditionalActions getAdditionalActions() {
    PDAdditionalActions retval = null;
    COSDictionary dict = (COSDictionary) field.getDictionaryObject(COSName.AA);
    if (dict != null) {
        retval = new PDAdditionalActions(dict);
    }
    return retval;
}
Also used : PDAdditionalActions(com.tom_roush.pdfbox.pdmodel.interactive.action.PDAdditionalActions) COSDictionary(com.tom_roush.pdfbox.cos.COSDictionary)

Example 80 with COSDictionary

use of com.tom_roush.pdfbox.cos.COSDictionary in project PdfBox-Android by TomRoush.

the class FDFPage method getPageInfo.

/**
 * This will get the FDF page info object.
 *
 * @return The Page info.
 */
public FDFPageInfo getPageInfo() {
    FDFPageInfo retval = null;
    COSDictionary dict = page.getCOSDictionary(COSName.INFO);
    if (dict != null) {
        retval = new FDFPageInfo(dict);
    }
    return retval;
}
Also used : COSDictionary(com.tom_roush.pdfbox.cos.COSDictionary)

Aggregations

COSDictionary (com.tom_roush.pdfbox.cos.COSDictionary)221 COSArray (com.tom_roush.pdfbox.cos.COSArray)68 COSBase (com.tom_roush.pdfbox.cos.COSBase)68 IOException (java.io.IOException)25 ArrayList (java.util.ArrayList)24 COSName (com.tom_roush.pdfbox.cos.COSName)23 COSObject (com.tom_roush.pdfbox.cos.COSObject)22 COSArrayList (com.tom_roush.pdfbox.pdmodel.common.COSArrayList)15 HashMap (java.util.HashMap)14 COSStream (com.tom_roush.pdfbox.cos.COSStream)13 Map (java.util.Map)12 PDPage (com.tom_roush.pdfbox.pdmodel.PDPage)10 COSString (com.tom_roush.pdfbox.cos.COSString)7 PDDocument (com.tom_roush.pdfbox.pdmodel.PDDocument)6 PDResources (com.tom_roush.pdfbox.pdmodel.PDResources)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 List (java.util.List)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 File (java.io.File)5 Test (org.junit.Test)5