UnembedFontPdfSmartCopy.java

1
package com.lowagie.text.pdf;
2
3
import java.io.IOException;
4
import java.io.OutputStream;
5
6
import com.lowagie.text.Document;
7
import com.lowagie.text.DocumentException;
8
9
/**
10
 * Makes a copy of a PDF, unembedding all embedded fonts. All font headers and descriptors are preserved and only the font file is removed.
11
 */
12
public class UnembedFontPdfSmartCopy extends PdfSmartCopy {
13
    
14
    public UnembedFontPdfSmartCopy(Document document, OutputStream os)
15
            throws DocumentException {
16
        super(document, os);
17
    }
18
19
    protected PdfDictionary copyDictionary(PdfDictionary in)
20
        throws IOException, BadPdfFormatException {
21
22
        PdfDictionary out = new PdfDictionary();
23
        PdfObject type = PdfReader.getPdfObjectRelease(in.get(PdfName.TYPE));
24
25
        for (PdfName key : in.getKeys()) {
26
            PdfObject value = in.get(key);
27
28 1 1. copyDictionary : negated conditional → NO_COVERAGE
            if ((PdfName.FONTFILE.equals(key)
29 1 1. copyDictionary : negated conditional → NO_COVERAGE
                    || PdfName.FONTFILE2.equals(key)
30 1 1. copyDictionary : negated conditional → NO_COVERAGE
                    || PdfName.FONTFILE3.equals(key))
31 1 1. copyDictionary : negated conditional → NO_COVERAGE
                    && !PdfReader.isFontSubset(PdfReader.getFontNameFromDescriptor(in))) {
32
                continue;
33
            } else {
34 1 1. copyDictionary : removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE
                out.put(key, copyObject(value));
35
            }
36
        }
37
38 1 1. copyDictionary : mutated return of Object value for com/lowagie/text/pdf/UnembedFontPdfSmartCopy::copyDictionary to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return out;
39
    }
40
}

Mutations

28

1.1
Location : copyDictionary
Killed by : none
negated conditional → NO_COVERAGE

29

1.1
Location : copyDictionary
Killed by : none
negated conditional → NO_COVERAGE

30

1.1
Location : copyDictionary
Killed by : none
negated conditional → NO_COVERAGE

31

1.1
Location : copyDictionary
Killed by : none
negated conditional → NO_COVERAGE

34

1.1
Location : copyDictionary
Killed by : none
removed call to com/lowagie/text/pdf/PdfDictionary::put → NO_COVERAGE

38

1.1
Location : copyDictionary
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/UnembedFontPdfSmartCopy::copyDictionary to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.4.2