proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentInformation.java | PDDocumentInformation | setTrapped | class PDDocumentInformation implements COSObjectable
{
private final COSDictionary info;
/**
* Default Constructor.
*/
public PDDocumentInformation()
{
info = new COSDictionary();
}
/**
* Constructor that is used for a preexisting dictionary.
*
* @param dic The... |
if( value != null &&
!value.equals( "True" ) &&
!value.equals( "False" ) &&
!value.equals( "Unknown" ) )
{
throw new IllegalArgumentException( "Valid values for trapped are " +
"'True', 'False', or 'Unknown'" );
... | 1,912 | 101 | 2,013 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentNameDestinationDictionary.java | PDDocumentNameDestinationDictionary | getDestination | class PDDocumentNameDestinationDictionary implements COSObjectable
{
private final COSDictionary nameDictionary;
/**
* Constructor.
*
* @param dict The dictionary of names and corresponding destinations.
*/
public PDDocumentNameDestinationDictionary(COSDictionary dict)
{
th... |
COSBase item = nameDictionary.getDictionaryObject(name);
// "The value of this entry shall be a dictionary in which each key is a destination name
// and the corresponding value is either an array defining the destination (...)
// or a dictionary with a D entry whose value is such an ... | 257 | 183 | 440 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentNameDictionary.java | PDDocumentNameDictionary | getDests | class PDDocumentNameDictionary implements COSObjectable
{
private final COSDictionary nameDictionary;
private final PDDocumentCatalog catalog;
/**
* Constructor.
*
* @param cat The document catalog that this dictionary is part of.
*/
public PDDocumentNameDictionary( PDDocumentCatalo... |
COSDictionary dic = nameDictionary.getCOSDictionary(COSName.DESTS);
//The document catalog also contains the Dests entry sometimes
//so check there as well.
if( dic == null )
{
dic = catalog.getCOSObject().getCOSDictionary(COSName.DESTS);
}
return dic... | 1,002 | 108 | 1,110 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDJavascriptNameTreeNode.java | PDJavascriptNameTreeNode | convertCOSToPD | class PDJavascriptNameTreeNode extends PDNameTreeNode<PDActionJavaScript>
{
/**
* Constructor.
*/
public PDJavascriptNameTreeNode()
{
super();
}
/**
* Constructor.
*
* @param dic The COS dictionary.
*/
public PDJavascriptNameTreeNode( COSDictionary dic )
... |
if (!(base instanceof COSDictionary))
{
throw new IOException( "Error creating Javascript object, expected a COSDictionary and not " + base);
}
return (PDActionJavaScript)PDActionFactory.createAction((COSDictionary) base);
| 206 | 67 | 273 | <methods>public org.apache.pdfbox.cos.COSDictionary getCOSObject() ,public List<PDNameTreeNode<org.apache.pdfbox.pdmodel.interactive.action.PDActionJavaScript>> getKids() ,public java.lang.String getLowerLimit() ,public Map<java.lang.String,org.apache.pdfbox.pdmodel.interactive.action.PDActionJavaScript> getNames() thr... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/COSDictionaryMap.java | COSDictionaryMap | remove | class COSDictionaryMap<K,V> implements Map<K,V>
{
private final COSDictionary map;
private final Map<K,V> actuals;
/**
* Constructor for this map.
*
* @param actualsMap The map with standard java objects as values.
* @param dicMap The map with COSBase objects as values.
*/
publ... |
map.removeItem( COSName.getPDFName( (String)key ) );
return actuals.remove( key );
| 1,543 | 34 | 1,577 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDDictionaryWrapper.java | PDDictionaryWrapper | equals | class PDDictionaryWrapper implements COSObjectable
{
private final COSDictionary dictionary;
/**
* Default constructor
*/
public PDDictionaryWrapper()
{
this.dictionary = new COSDictionary();
}
/**
* Creates a new instance with a given COS dictionary.
*
* @pa... |
if (this == obj)
{
return true;
}
if (obj instanceof PDDictionaryWrapper)
{
return this.dictionary.equals(((PDDictionaryWrapper) obj).dictionary);
}
return false;
| 227 | 65 | 292 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabelRange.java | PDPageLabelRange | setStart | class PDPageLabelRange implements COSObjectable
{
private final COSDictionary root;
// Page label dictionary (PDF32000-1:2008 Section 12.4.2, Table 159)
private static final COSName KEY_START = COSName.ST;
private static final COSName KEY_PREFIX = COSName.P;
private static final COSName KEY_STYLE ... |
if (start <= 0)
{
throw new IllegalArgumentException(
"The page numbering start value must be a positive integer");
}
root.setInt(KEY_START, start);
| 1,154 | 52 | 1,206 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java | PDRange | toString | class PDRange implements COSObjectable
{
private final COSArray rangeArray;
private int startingIndex;
/**
* Constructor with an initial range of 0..1.
*/
public PDRange()
{
rangeArray = new COSArray();
rangeArray.add(COSFloat.ZERO);
rangeArray.add(COSFloat.ONE);
... |
return "PDRange{" + getMin() + ", " + getMax() + '}';
| 812 | 26 | 838 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/filespecification/PDEmbeddedFile.java | PDEmbeddedFile | setMacSubtype | class PDEmbeddedFile extends PDStream
{
/**
* {@inheritDoc}
*/
public PDEmbeddedFile( PDDocument document )
{
super( document );
getCOSObject().setItem(COSName.TYPE, COSName.EMBEDDED_FILE);
}
/**
* {@inheritDoc}
*/
public PDEmbeddedFile( COSStream str )
... |
COSDictionary params = getCOSObject().getCOSDictionary(COSName.PARAMS);
if( params == null && macSubtype != null )
{
params = new COSDictionary();
getCOSObject().setItem( COSName.PARAMS, params );
}
if( params != null )
{
params.setEmb... | 1,855 | 119 | 1,974 | <methods>public void <init>(org.apache.pdfbox.pdmodel.PDDocument) ,public void <init>(org.apache.pdfbox.cos.COSDocument) ,public void <init>(org.apache.pdfbox.cos.COSStream) ,public void <init>(org.apache.pdfbox.pdmodel.PDDocument, java.io.InputStream) throws java.io.IOException,public void <init>(org.apache.pdfbox.pdm... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/filespecification/PDFileSpecification.java | PDFileSpecification | createFS | class PDFileSpecification implements COSObjectable
{
/**
* A file specification can either be a COSString or a COSDictionary. This
* will create the file specification either way.
*
* @param base The cos object that describes the fs.
*
* @return The file specification for the COSBase... |
PDFileSpecification retval = null;
if( base == null )
{
//then simply return null
}
else if( base instanceof COSString )
{
retval = new PDSimpleFileSpecification( (COSString)base );
}
else if( base instanceof COSDictionary )
... | 223 | 142 | 365 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java | Rinterpol | getSamples | class Rinterpol
{
// coordinate that is to be interpolated
private final float[] in;
// coordinate of the "ceil" point
private final int[] inPrev;
// coordinate of the "floor" point
private final int[] inNext;
private final int numberOfInputValues;
pri... |
if (samples == null)
{
int arraySize = 1;
int nIn = getNumberOfInputParameters();
int nOut = getNumberOfOutputParameters();
COSArray sizes = getSize();
for (int i = 0; i < nIn; i++)
{
... | 1,161 | 362 | 1,523 | <methods>public void <init>(org.apache.pdfbox.cos.COSBase) ,public static org.apache.pdfbox.pdmodel.common.function.PDFunction create(org.apache.pdfbox.cos.COSBase) throws java.io.IOException,public abstract float[] eval(float[]) throws java.io.IOException,public final org.apache.pdfbox.cos.COSDictionary getCOSObject()... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType2.java | PDFunctionType2 | toString | class PDFunctionType2 extends PDFunction
{
/**
* The C0 values of the exponential function.
*/
private final COSArray c0;
/**
* The C1 values of the exponential function.
*/
private final COSArray c1;
/**
* The exponent value of the exponential function.
*/
private... |
return "FunctionType2{"
+ "C0: " + getC0() + " "
+ "C1: " + getC1() + " "
+ "N: " + getN() + "}";
| 759 | 58 | 817 | <methods>public void <init>(org.apache.pdfbox.cos.COSBase) ,public static org.apache.pdfbox.pdmodel.common.function.PDFunction create(org.apache.pdfbox.cos.COSBase) throws java.io.IOException,public abstract float[] eval(float[]) throws java.io.IOException,public final org.apache.pdfbox.cos.COSDictionary getCOSObject()... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType4.java | PDFunctionType4 | eval | class PDFunctionType4 extends PDFunction
{
private static final Operators OPERATORS = new Operators();
private final InstructionSequence instructions;
/**
* Constructor.
*
* @param functionStream The function stream.
* @throws IOException if an I/O error occurs while reading the funct... |
//Setup the input values
ExecutionContext context = new ExecutionContext(OPERATORS);
for (int i = 0; i < input.length; i++)
{
PDRange domain = getDomainForInput(i);
float value = clipToRange(input[i], domain.getMin(), domain.getMax());
context.getStac... | 252 | 337 | 589 | <methods>public void <init>(org.apache.pdfbox.cos.COSBase) ,public static org.apache.pdfbox.pdmodel.common.function.PDFunction create(org.apache.pdfbox.cos.COSBase) throws java.io.IOException,public abstract float[] eval(float[]) throws java.io.IOException,public final org.apache.pdfbox.cos.COSDictionary getCOSObject()... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionTypeIdentity.java | PDFunctionTypeIdentity | getFunctionType | class PDFunctionTypeIdentity extends PDFunction
{
public PDFunctionTypeIdentity(COSBase function)
{
super(null);
//TODO passing null is not good because getCOSObject() can result in an NPE in the base class
}
@Override
public int getFunctionType()
{<FILL_FUNCTION_BODY>}
@O... |
// shouldn't be called
throw new UnsupportedOperationException();
//TODO this is a violation of the interface segregation principle
| 189 | 36 | 225 | <methods>public void <init>(org.apache.pdfbox.cos.COSBase) ,public static org.apache.pdfbox.pdmodel.common.function.PDFunction create(org.apache.pdfbox.cos.COSBase) throws java.io.IOException,public abstract float[] eval(float[]) throws java.io.IOException,public final org.apache.pdfbox.cos.COSDictionary getCOSObject()... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/type4/ArithmeticOperators.java | Round | execute | class Round implements Operator
{
@Override
public void execute(ExecutionContext context)
{<FILL_FUNCTION_BODY>}
} |
Number num = context.popNumber();
if (num instanceof Integer)
{
context.getStack().push(num.intValue());
}
else
{
context.getStack().push((float)Math.round(num.doubleValue()));
}
| 42 | 70 | 112 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/type4/BitwiseOperators.java | Not | execute | class Not implements Operator
{
@Override
public void execute(ExecutionContext context)
{<FILL_FUNCTION_BODY>}
} |
Stack<Object> stack = context.getStack();
Object op1 = stack.pop();
if (op1 instanceof Boolean)
{
boolean bool1 = (Boolean)op1;
boolean result = !bool1;
stack.push(result);
}
else if (op1 instanceof ... | 42 | 140 | 182 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/type4/ConditionalOperators.java | IfElse | execute | class IfElse implements Operator
{
@Override
public void execute(ExecutionContext context)
{<FILL_FUNCTION_BODY>}
} |
Stack<Object> stack = context.getStack();
InstructionSequence proc2 = (InstructionSequence)stack.pop();
InstructionSequence proc1 = (InstructionSequence)stack.pop();
Boolean condition = (Boolean)stack.pop();
if (condition)
{
proc1.... | 44 | 101 | 145 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/type4/InstructionSequence.java | InstructionSequence | execute | class InstructionSequence
{
private final List<Object> instructions = new java.util.ArrayList<>();
/**
* Add a name (ex. an operator)
* @param name the name
*/
public void addName(String name)
{
this.instructions.add(name);
}
/**
* Adds an int value.
* @param ... |
Stack<Object> stack = context.getStack();
for (Object o : instructions)
{
if (o instanceof String)
{
String name = (String)o;
Operator cmd = context.getOperators().getOperator(name);
if (cmd != null)
{
... | 346 | 205 | 551 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/type4/InstructionSequenceBuilder.java | InstructionSequenceBuilder | token | class InstructionSequenceBuilder extends Parser.AbstractSyntaxHandler
{
private static final Predicate<String> MATCHES_INTEGER = Pattern.compile("[\\+\\-]?\\d+").asMatchPredicate();
private static final Predicate<String> MATCHES_REAL = Pattern.compile("[\\-]?\\d*\\.\\d*([Ee]\\-?\\d+)?").asMatchPredicate();
... |
if ("{".equals(token))
{
InstructionSequence child = new InstructionSequence();
getCurrentSequence().addProc(child);
this.seqStack.push(child);
}
else if ("}".equals(token))
{
this.seqStack.pop();
}
else
{
... | 567 | 209 | 776 | <methods>public non-sealed void <init>() ,public void comment(java.lang.CharSequence) ,public void newLine(java.lang.CharSequence) ,public void whitespace(java.lang.CharSequence) <variables> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/type4/Parser.java | Tokenizer | scanToken | class Tokenizer
{
private static final char NUL = '\u0000'; //NUL
private static final char EOT = '\u0004'; //END OF TRANSMISSION
private static final char TAB = '\u0009'; //TAB CHARACTER
private static final char FF = '\u000C'; //FORM FEED
private static final char CR = '\r... |
assert state == State.TOKEN;
char ch = currentChar();
buffer.append(ch);
switch (ch)
{
case '{':
case '}':
handler.token(buffer);
nextChar();
return;
default:
... | 1,013 | 199 | 1,212 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/type4/RelationalOperators.java | Eq | isEqual | class Eq implements Operator
{
@Override
public void execute(ExecutionContext context)
{
Stack<Object> stack = context.getStack();
Object op2 = stack.pop();
Object op1 = stack.pop();
boolean result = isEqual(op1, op2);
stack.push(re... |
boolean result;
if (op1 instanceof Number && op2 instanceof Number)
{
Number num1 = (Number)op1;
Number num2 = (Number)op2;
result = Float.compare(num1.floatValue(),num2.floatValue()) == 0;
}
else
{
... | 119 | 102 | 221 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/type4/StackOperators.java | Index | execute | class Index implements Operator
{
@Override
public void execute(ExecutionContext context)
{<FILL_FUNCTION_BODY>}
} |
Stack<Object> stack = context.getStack();
int n = ((Number)stack.pop()).intValue();
if (n < 0)
{
throw new IllegalArgumentException("rangecheck: " + n);
}
int size = stack.size();
stack.push(stack.get(size - n - 1));
... | 42 | 85 | 127 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java | PDAttributeObject | isValueChanged | class PDAttributeObject extends PDDictionaryWrapper
{
/**
* Default constructor.
*/
public PDAttributeObject()
{
}
/**
* Creates a new attribute object with a given dictionary.
*
* @param dictionary the dictionary
*/
public PDAttributeObject(COSDictionary diction... |
if (oldValue == null)
{
return newValue != null;
}
return !oldValue.equals(newValue);
| 1,483 | 39 | 1,522 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public boolean equals(java.lang.Object) ,public org.apache.pdfbox.cos.COSDictionary getCOSObject() ,public int hashCode() <variables>private final non-sealed org.apache.pdfbox.cos.COSDictionary dictionary |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDDefaultAttributeObject.java | PDDefaultAttributeObject | toString | class PDDefaultAttributeObject extends PDAttributeObject
{
/**
* Default constructor.
*/
public PDDefaultAttributeObject()
{
}
/**
* Creates a default attribute object with a given dictionary.
*
* @param dictionary the dictionary
*/
public PDDefaultAttributeObjec... |
StringBuilder sb = new StringBuilder().append(super.toString())
.append(", attributes={");
Iterator<String> it = this.getAttributeNames().iterator();
while (it.hasNext())
{
String name = it.next();
sb.append(name).append('=').append(this.getAttributeV... | 579 | 126 | 705 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public static org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDAttributeObject create(org.apache.pdfbox.cos.COSDictionary) ,public java.lang.String getOwner() ,public boolean isEmpty() ,public java.lang.String toStri... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDObjectReference.java | PDObjectReference | getReferencedObject | class PDObjectReference implements COSObjectable
{
/**
* Log instance.
*/
private static final Logger LOG = LogManager.getLogger(PDObjectReference.class);
/**
* TYPE of this object.
*/
public static final String TYPE = "OBJR";
private final COSDictionary dictionary;... |
COSDictionary objDictionary = getCOSObject().getCOSDictionary(COSName.OBJ);
if (objDictionary == null)
{
return null;
}
try
{
if (objDictionary instanceof COSStream)
{
PDXObject xobject = PDXObject.createXObje... | 584 | 358 | 942 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureTreeRoot.java | PDStructureTreeRoot | getClassMap | class PDStructureTreeRoot extends PDStructureNode
{
/**
* Log instance.
*/
private static final Logger LOG = LogManager.getLogger(PDStructureTreeRoot.class);
private static final String TYPE = "StructTreeRoot";
/**
* Default Constructor.
*
*/
public PDStructureTreeRoot()... |
Map<String, Object> classMap = new HashMap<>();
COSDictionary classMapDictionary = this.getCOSObject().getCOSDictionary(COSName.CLASS_MAP);
if (classMapDictionary == null)
{
return classMap;
}
classMapDictionary.forEach((name, base) ->
{
i... | 1,429 | 299 | 1,728 | <methods>public void appendKid(org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureElement) ,public static org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureNode create(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.cos.COSDictionary getCOSObject() ,public L... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserAttributeObject.java | PDUserAttributeObject | removeUserProperty | class PDUserAttributeObject extends PDAttributeObject
{
/**
* Attribute owner for user properties
*/
public static final String OWNER_USER_PROPERTIES = "UserProperties";
/**
* Default constructor
*/
public PDUserAttributeObject()
{
this.setOwner(OWNER_USER_PROPERTIES);... |
if (userProperty == null)
{
return;
}
COSArray p = getCOSObject().getCOSArray(COSName.P);
if (p.remove(userProperty.getCOSObject()))
{
this.notifyChanged();
}
| 627 | 74 | 701 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public static org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDAttributeObject create(org.apache.pdfbox.cos.COSDictionary) ,public java.lang.String getOwner() ,public boolean isEmpty() ,public java.lang.String toStri... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java | PDUserProperty | toString | class PDUserProperty extends PDDictionaryWrapper
{
private final PDUserAttributeObject userAttributeObject;
/**
* Creates a new user property.
*
* @param userAttributeObject the user attribute object
*/
public PDUserProperty(PDUserAttributeObject userAttributeObject)
{
thi... |
return "Name=" + this.getName() +
", Value=" + this.getValue() +
", FormattedValue=" + this.getFormattedValue() +
", Hidden=" + this.isHidden();
| 1,337 | 59 | 1,396 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public boolean equals(java.lang.Object) ,public org.apache.pdfbox.cos.COSDictionary getCOSObject() ,public int hashCode() <variables>private final non-sealed org.apache.pdfbox.cos.COSDictionary dictionary |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/Revisions.java | Revisions | setRevisionNumber | class Revisions<T>
{
private List<T> objects;
private List<Integer> revisionNumbers;
/**
* Constructor.
*/
public Revisions()
{
}
private List<T> getObjects()
{
if (this.objects == null)
{
this.objects = new ArrayList<>();
}
return ... |
int index = this.getObjects().indexOf(object);
if (index > -1)
{
this.getRevisionNumbers().set(index, revisionNumber);
}
| 686 | 49 | 735 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/markedcontent/PDMarkedContent.java | PDMarkedContent | toString | class PDMarkedContent
{
/**
* Creates a marked-content sequence.
*
* @param tag the tag
* @param properties the properties
* @return the marked-content sequence
*/
public static PDMarkedContent create(COSName tag, COSDictionary properties)
{
if (COSName.AR... |
return "tag=" + this.tag +
", properties=" + this.properties +
", contents=" + this.contents;
| 1,249 | 41 | 1,290 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/markedcontent/PDPropertyList.java | PDPropertyList | create | class PDPropertyList implements COSObjectable
{
protected final COSDictionary dict;
/**
* Creates a property list from the given dictionary.
*
* @param dict COS dictionary
* @return a new instance of a PDPropertyList using the given dictionary
*/
public static PDPropertyList creat... |
COSBase item = dict.getItem(COSName.TYPE);
if (COSName.OCG.equals(item))
{
return new PDOptionalContentGroup(dict);
}
else if (COSName.OCMD.equals(item))
{
return new PDOptionalContentMembershipDictionary(dict);
}
else
{
... | 240 | 120 | 360 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/prepress/PDBoxStyle.java | PDBoxStyle | setLineDashPattern | class PDBoxStyle implements COSObjectable
{
/**
* Style for guideline.
*/
public static final String GUIDELINE_STYLE_SOLID = "S";
/**
* Style for guideline.
*/
public static final String GUIDELINE_STYLE_DASHED = "D";
private final COSDictionary dictionary;
/**
* Defaul... |
COSArray array = null;
if( dashArray != null )
{
array = dashArray;
}
dictionary.setItem(COSName.D, array);
| 1,233 | 50 | 1,283 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDArtifactMarkedContent.java | PDArtifactMarkedContent | isAttached | class PDArtifactMarkedContent extends PDMarkedContent
{
public PDArtifactMarkedContent(COSDictionary properties)
{
super(COSName.ARTIFACT, properties);
}
/**
* Gets the type (Type).
*
* @return the type
*/
public String getType()
{
return this.getPropertie... |
COSArray a = getProperties().getCOSArray(COSName.ATTACHED);
if (a != null)
{
for (int i = 0; i < a.size(); i++)
{
if (edge.equals(a.getName(i)))
{
return true;
}
}
}
return fa... | 706 | 96 | 802 | <methods>public void <init>(org.apache.pdfbox.cos.COSName, org.apache.pdfbox.cos.COSDictionary) ,public void addMarkedContent(org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDMarkedContent) ,public void addText(org.apache.pdfbox.text.TextPosition) ,public void addXObject(org.apache.pdfbox.pdmodel.graphics.... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDFourColours.java | PDFourColours | setColourByIndex | class PDFourColours implements COSObjectable
{
private final COSArray array;
public PDFourColours()
{
this.array = new COSArray(List.of(
COSNull.NULL,
COSNull.NULL,
COSNull.NULL,
COSNull.NULL
));
}
public PDFourColours(COSArray array... |
COSBase base;
if (colour == null)
{
base = COSNull.NULL;
}
else
{
base = colour.getCOSArray();
}
this.array.set(index, base);
| 950 | 67 | 1,017 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDListAttributeObject.java | PDListAttributeObject | toString | class PDListAttributeObject extends PDStandardAttributeObject
{
/**
* standard attribute owner: List
*/
public static final String OWNER_LIST = "List";
protected static final String LIST_NUMBERING = "ListNumbering";
/**
* ListNumbering: Circle: Open circular bullet
*/
public s... |
StringBuilder sb = new StringBuilder().append(super.toString());
if (this.isSpecified(LIST_NUMBERING))
{
sb.append(", ListNumbering=").append(this.getListNumbering());
}
return sb.toString();
| 1,078 | 69 | 1,147 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public boolean isSpecified(java.lang.String) <variables>protected static final float UNSPECIFIED |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDPrintFieldAttributeObject.java | PDPrintFieldAttributeObject | toString | class PDPrintFieldAttributeObject extends PDStandardAttributeObject
{
/**
* standard attribute owner: PrintField
*/
public static final String OWNER_PRINT_FIELD = "PrintField";
private static final String ROLE = "Role";
private static final String CHECKED = "checked";
private static fina... |
StringBuilder sb = new StringBuilder().append(super.toString());
if (this.isSpecified(ROLE))
{
sb.append(", Role=").append(this.getRole());
}
if (this.isSpecified(CHECKED))
{
sb.append(", Checked=").append(this.getCheckedState());
}
... | 1,000 | 140 | 1,140 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public boolean isSpecified(java.lang.String) <variables>protected static final float UNSPECIFIED |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDTableAttributeObject.java | PDTableAttributeObject | toString | class PDTableAttributeObject extends PDStandardAttributeObject
{
/**
* standard attribute owner: Table
*/
public static final String OWNER_TABLE = "Table";
protected static final String ROW_SPAN = "RowSpan";
protected static final String COL_SPAN = "ColSpan";
protected static final Stri... |
StringBuilder sb = new StringBuilder().append(super.toString());
if (this.isSpecified(ROW_SPAN))
{
sb.append(", RowSpan=").append(this.getRowSpan());
}
if (this.isSpecified(COL_SPAN))
{
sb.append(", ColSpan=").append(this.getColSpan());
}
... | 1,338 | 221 | 1,559 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public boolean isSpecified(java.lang.String) <variables>protected static final float UNSPECIFIED |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/MessageDigests.java | MessageDigests | getSHA256 | class MessageDigests
{
private MessageDigests()
{
}
/**
* @return MD5 message digest
*/
static MessageDigest getMD5()
{
try
{
return MessageDigest.getInstance("MD5");
}
catch (NoSuchAlgorithmException e)
{
// should n... |
try
{
return MessageDigest.getInstance("SHA-256");
}
catch (NoSuchAlgorithmException e)
{
// should never happen
throw new RuntimeException(e);
}
| 246 | 60 | 306 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDCryptFilterDictionary.java | PDCryptFilterDictionary | isEncryptMetaData | class PDCryptFilterDictionary implements COSObjectable
{
/**
* COS crypt filter dictionary.
*/
protected COSDictionary cryptFilterDictionary = null;
/**
* creates a new empty crypt filter dictionary.
*/
public PDCryptFilterDictionary()
{
cryptFilterDictionary = new COSD... |
COSBase value = getCOSObject().getDictionaryObject(COSName.ENCRYPT_META_DATA);
if (value instanceof COSBoolean)
{
return ((COSBoolean) value).getValue();
}
// default is true (see 7.6.3.2 Standard Encryption Dictionary PDF 32000-1:2008)
return true;
| 764 | 102 | 866 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/ProtectionPolicy.java | ProtectionPolicy | setEncryptionKeyLength | class ProtectionPolicy
{
private static final short DEFAULT_KEY_LENGTH = 40;
private short encryptionKeyLength = DEFAULT_KEY_LENGTH;
private boolean preferAES = false;
/**
* set the length in (bits) of the secret key that will be
* used to encrypt document data.
* The default value is ... |
if(l!=40 && l!=128 && l!=256)
{
throw new IllegalArgumentException("Invalid key length '" + l + "' value must be 40, 128 or 256!");
}
encryptionKeyLength = (short) l;
| 453 | 77 | 530 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeyDecryptionMaterial.java | PublicKeyDecryptionMaterial | getPrivateKey | class PublicKeyDecryptionMaterial extends DecryptionMaterial
{
private final String password;
private final KeyStore keyStore;
private final String alias;
/**
* Create a new public key decryption material.
*
* @param keystore The keystore were the private key and the certificate are
... |
try
{
if(keyStore.size() == 1)
{
Enumeration<String> aliases = keyStore.aliases();
String keyStoreAlias = aliases.nextElement();
return keyStore.getKey(keyStoreAlias, password.toCharArray());
}
else
... | 551 | 219 | 770 | <methods>public non-sealed void <init>() <variables> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/RC4Cipher.java | RC4Cipher | setKey | class RC4Cipher
{
private final int[] salt;
private int b;
private int c;
/**
* Constructor.
*/
RC4Cipher()
{
salt = new int[256];
}
/**
* This will reset the key to be used.
*
* @param key The RC4 key used during encryption.
*/
public void set... |
b = 0;
c = 0;
if(key.length < 1 || key.length > 32)
{
throw new IllegalArgumentException("number of bytes must be between 1 and 32");
}
for(int i = 0; i < salt.length; i++)
{
salt[i] = i;
}
int keyIndex = 0;
int s... | 951 | 190 | 1,141 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandlerFactory.java | SecurityHandlerFactory | newSecurityHandler | class SecurityHandlerFactory
{
/** Singleton instance */
public static final SecurityHandlerFactory INSTANCE = new SecurityHandlerFactory();
private final Map<String, Class<? extends SecurityHandler>> nameToHandler = new HashMap<>();
private final Map<Class<? extends ProtectionPolicy>,
... |
try
{
Constructor<? extends SecurityHandler> ctor =
handlerClass.getDeclaredConstructor(argsClasses);
return ctor.newInstance(args);
}
catch(NoSuchMethodException | IllegalAccessException | InstantiationException |
InvocationTa... | 850 | 99 | 949 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityProvider.java | SecurityProvider | getProvider | class SecurityProvider
{
private static Provider provider = null;
private SecurityProvider()
{
}
/**
* Returns the provider to be used for advanced encrypting/decrypting. Default is the BouncyCastleProvider.
*
* @return the security provider
*/
public static Provider getPr... |
// TODO synchronize access
if (provider == null)
{
provider = new BouncyCastleProvider();
}
return provider;
| 168 | 41 | 209 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationCaret.java | FDFAnnotationCaret | initFringe | class FDFAnnotationCaret extends FDFAnnotation
{
/**
* COS Model value for SubType entry.
*/
public static final String SUBTYPE = "Caret";
/**
* Default constructor.
*/
public FDFAnnotationCaret()
{
super();
annot.setName(COSName.SUBTYPE, SUBTYPE);
}
/**... |
String fringe = element.getAttribute("fringe");
if (fringe != null && !fringe.isEmpty())
{
String[] fringeValues = fringe.split(",");
if (fringeValues.length != 4)
{
throw new IOException("Error: wrong amount of numbers in attribute 'fringe'")... | 689 | 204 | 893 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public void <init>(org.w3c.dom.Element) throws java.io.IOException,public static org.apache.pdfbox.pdmodel.fdf.FDFAnnotation create(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDBord... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationCircle.java | FDFAnnotationCircle | initFringe | class FDFAnnotationCircle extends FDFAnnotation
{
/**
* COS Model value for SubType entry.
*/
public static final String SUBTYPE = "Circle";
/**
* Default constructor.
*/
public FDFAnnotationCircle()
{
super();
annot.setName(COSName.SUBTYPE, SUBTYPE);
}
... |
String fringe = element.getAttribute("fringe");
if (fringe != null && !fringe.isEmpty())
{
String[] fringeValues = fringe.split(",");
if (fringeValues.length != 4)
{
throw new IOException("Error: wrong amount of numbers in attribute 'fringe'")... | 868 | 204 | 1,072 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public void <init>(org.w3c.dom.Element) throws java.io.IOException,public static org.apache.pdfbox.pdmodel.fdf.FDFAnnotation create(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDBord... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationInk.java | FDFAnnotationInk | setInkList | class FDFAnnotationInk extends FDFAnnotation
{
private static final Logger LOG = LogManager.getLogger(FDFAnnotationInk.class);
/**
* COS Model value for SubType entry.
*/
public static final String SUBTYPE = "Ink";
/**
* Default constructor.
*/
public FDFAnnotationInk()
{
... |
COSArray newInklist = new COSArray();
for (float[] array : inklist)
{
newInklist.add(COSArray.of(array));
}
annot.setItem(COSName.INKLIST, newInklist);
| 886 | 72 | 958 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public void <init>(org.w3c.dom.Element) throws java.io.IOException,public static org.apache.pdfbox.pdmodel.fdf.FDFAnnotation create(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDBord... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolygon.java | FDFAnnotationPolygon | initVertices | class FDFAnnotationPolygon extends FDFAnnotation
{
private static final Logger LOG = LogManager.getLogger(FDFAnnotationPolygon.class);
/**
* COS Model value for SubType entry.
*/
public static final String SUBTYPE = "Polygon";
/**
* Default constructor.
*/
public FDFAnnotationPo... |
XPath xpath = XPathFactory.newInstance().newXPath();
try
{
String vertices = xpath.evaluate("vertices", element);
if (vertices == null || vertices.isEmpty())
{
throw new IOException("Error: missing element 'vertices'");
}
... | 862 | 196 | 1,058 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public void <init>(org.w3c.dom.Element) throws java.io.IOException,public static org.apache.pdfbox.pdmodel.fdf.FDFAnnotation create(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDBord... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolyline.java | FDFAnnotationPolyline | setStartPointEndingStyle | class FDFAnnotationPolyline extends FDFAnnotation
{
private static final Logger LOG = LogManager.getLogger(FDFAnnotationPolyline.class);
/**
* COS Model value for SubType entry.
*/
public static final String SUBTYPE = "Polyline";
/**
* Default constructor.
*/
public FDFAnnotatio... |
String actualStyle = style == null ? PDAnnotationLine.LE_NONE : style;
COSArray array = annot.getCOSArray(COSName.LE);
if (array == null)
{
array = new COSArray();
array.add(COSName.getPDFName(actualStyle));
array.add(COSName.getPDFName(PDAnnotationLi... | 1,691 | 144 | 1,835 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public void <init>(org.w3c.dom.Element) throws java.io.IOException,public static org.apache.pdfbox.pdmodel.fdf.FDFAnnotation create(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDBord... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationSquare.java | FDFAnnotationSquare | getInteriorColor | class FDFAnnotationSquare extends FDFAnnotation
{
/**
* COS Model value for SubType entry.
*/
public static final String SUBTYPE = "Square";
/**
* Default constructor.
*/
public FDFAnnotationSquare()
{
super();
annot.setName(COSName.SUBTYPE, SUBTYPE);
}
... |
Color retval = null;
COSArray array = annot.getCOSArray(COSName.IC);
if (array != null)
{
float[] rgb = array.toFloatArray();
if (rgb.length >= 3)
{
retval = new Color(rgb[0], rgb[1], rgb[2]);
}
}
return ret... | 966 | 105 | 1,071 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public void <init>(org.w3c.dom.Element) throws java.io.IOException,public static org.apache.pdfbox.pdmodel.fdf.FDFAnnotation create(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDBord... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTextMarkup.java | FDFAnnotationTextMarkup | getCoords | class FDFAnnotationTextMarkup extends FDFAnnotation
{
/**
* Default constructor.
*/
public FDFAnnotationTextMarkup()
{
super();
}
/**
* Constructor.
*
* @param a An existing FDF Annotation.
*/
public FDFAnnotationTextMarkup(COSDictionary a)
{
su... |
COSArray quadPoints = annot.getCOSArray(COSName.QUADPOINTS);
if (quadPoints != null)
{
return quadPoints.toFloatArray();
}
else
{
return null; // Should never happen as this is a required item
}
| 603 | 78 | 681 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public void <init>(org.w3c.dom.Element) throws java.io.IOException,public static org.apache.pdfbox.pdmodel.fdf.FDFAnnotation create(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.pdmodel.interactive.annotation.PDBord... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java | FDFDocument | getCatalog | class FDFDocument implements Closeable
{
private final COSDocument document;
/**
* Constructor, creates a new FDF document.
*
*/
public FDFDocument()
{
document = new COSDocument();
document.getDocumentState().setParsing(false);
document.setVersion(1.2f);
... |
FDFCatalog retval = null;
COSDictionary trailer = document.getTrailer();
COSDictionary root = trailer.getCOSDictionary(COSName.ROOT);
if (root == null)
{
retval = new FDFCatalog();
setCatalog(retval);
}
else
{
retval = ... | 1,465 | 110 | 1,575 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFIconFit.java | FDFIconFit | getFractionalSpaceToAllocate | class FDFIconFit implements COSObjectable
{
private final COSDictionary fit;
/**
* A scale option.
*/
public static final String SCALE_OPTION_ALWAYS = "A";
/**
* A scale option.
*/
public static final String SCALE_OPTION_ONLY_WHEN_ICON_IS_BIGGER = "B";
/**
* A scale opt... |
PDRange retval = null;
COSArray array = fit.getCOSArray(COSName.A);
if (array == null)
{
retval = new PDRange();
retval.setMin(.5f);
retval.setMax(.5f);
setFractionalSpaceToAllocate(retval);
}
else
{
ret... | 1,247 | 120 | 1,367 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFJavaScript.java | FDFJavaScript | getDoc | class FDFJavaScript implements COSObjectable
{
private final COSDictionary dictionary;
/**
* Default constructor.
*/
public FDFJavaScript()
{
dictionary = new COSDictionary();
}
/**
* Constructor.
*
* @param javaScript The FDF java script.
*/
public FD... |
COSArray array = dictionary.getCOSArray(COSName.DOC);
if (array == null)
{
return null;
}
Map<String, PDActionJavaScript> map = new LinkedHashMap<>();
for (int i = 0; i + 1 < array.size(); i += 2)
{
String name = array.getName(i);
... | 842 | 208 | 1,050 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFPage.java | FDFPage | getPageInfo | class FDFPage implements COSObjectable
{
private final COSDictionary page;
/**
* Default constructor.
*/
public FDFPage()
{
page = new COSDictionary();
}
/**
* Constructor.
*
* @param p The FDF page.
*/
public FDFPage(COSDictionary p)
{
pag... |
FDFPageInfo retval = null;
COSDictionary dict = page.getCOSDictionary(COSName.INFO);
if (dict != null)
{
retval = new FDFPageInfo(dict);
}
return retval;
| 565 | 68 | 633 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFTemplate.java | FDFTemplate | getFields | class FDFTemplate implements COSObjectable
{
private final COSDictionary template;
/**
* Default constructor.
*/
public FDFTemplate()
{
template = new COSDictionary();
}
/**
* Constructor.
*
* @param t The FDF page template.
*/
public FDFTemplate(COSDi... |
COSArray array = template.getCOSArray(COSName.FIELDS);
if (array != null)
{
List<FDFField> fields = new ArrayList<>();
for (int i = 0; i < array.size(); i++)
{
fields.add(new FDFField((COSDictionary) array.getObject(i)));
}
... | 624 | 119 | 743 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/AcroFormDefaultFixup.java | AcroFormDefaultFixup | apply | class AcroFormDefaultFixup extends AbstractFixup
{
public AcroFormDefaultFixup(PDDocument document)
{
super(document);
}
@Override
public void apply() {<FILL_FUNCTION_BODY>}
} |
new AcroFormDefaultsProcessor(document).process();
/*
* Get the AcroForm in it's current state.
*
* Also note: getAcroForm() applies a default fixup which this processor
* is part of. So keep the null parameter otherwise this will end
* in an endless recurs... | 70 | 247 | 317 | <methods><variables>protected final non-sealed org.apache.pdfbox.pdmodel.PDDocument document |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormDefaultsProcessor.java | AcroFormDefaultsProcessor | verifyOrCreateDefaults | class AcroFormDefaultsProcessor extends AbstractProcessor
{
public AcroFormDefaultsProcessor(PDDocument document)
{
super(document);
}
@Override
public void process() {
/*
* Get the AcroForm in it's current state.
*
* Also note: getAcroForm()... |
final String adobeDefaultAppearanceString = "/Helv 0 Tf 0 g ";
// DA entry is required
if (acroForm.getDefaultAppearance().isEmpty())
{
acroForm.setDefaultAppearance(adobeDefaultAppearanceString);
acroForm.getCOSObject().setNeedToBeUpdated(true);
... | 304 | 593 | 897 | <methods><variables>protected final non-sealed org.apache.pdfbox.pdmodel.PDDocument document |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormGenerateAppearancesProcessor.java | AcroFormGenerateAppearancesProcessor | process | class AcroFormGenerateAppearancesProcessor extends AbstractProcessor
{
private static final Logger LOG = LogManager.getLogger(AcroFormGenerateAppearancesProcessor.class);
public AcroFormGenerateAppearancesProcessor(PDDocument document)
{
super(document);
}
@Override
public void ... |
/*
* Get the AcroForm in it's current state.
*
* Also note: getAcroForm() applies a default fixup which this processor
* is part of. So keep the null parameter otherwise this will end
* in an endless recursive call
*/
PDAcroForm acroForm = document.... | 107 | 223 | 330 | <methods><variables>protected final non-sealed org.apache.pdfbox.pdmodel.PDDocument document |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/CIDSystemInfo.java | CIDSystemInfo | toString | class CIDSystemInfo
{
private final String registry;
private final String ordering;
private final int supplement;
public CIDSystemInfo(String registry, String ordering, int supplement)
{
this.registry = registry;
this.ordering = ordering;
this.supplement = supplement;
}
... |
return getRegistry() + "-" + getOrdering() + "-" + getSupplement();
| 169 | 25 | 194 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/CMapManager.java | CMapManager | parseCMap | class CMapManager
{
private static final Map<String, CMap> CMAP_CACHE = new ConcurrentHashMap<>();
private CMapManager()
{
}
/**
* Fetches the predefined CMap from disk (or cache).
*
* @param cMapName CMap name
* @return The predefined CMap, never null.
* @thr... |
CMap targetCmap = null;
if (randomAccessRead != null)
{
targetCmap = new CMapParser().parse(randomAccessRead);
}
return targetCmap;
| 360 | 61 | 421 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontInfo.java | FontInfo | getWeightClassAsPanose | class FontInfo
{
/**
* Returns the PostScript name of the font.
*
* @return the PostScript name of the font
*/
public abstract String getPostScriptName();
/**
* Returns the font's format.
*
* @return the format of the font
*/
public abstract FontFormat getForma... |
int usWeightClass = getWeightClass();
switch (usWeightClass)
{
case -1: return 0;
case 0: return 0;
case 100: return 2;
case 200: return 3;
case 300: return 4;
case 400: return 5;
case 500: return 6;
... | 899 | 165 | 1,064 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMappers.java | DefaultFontMapper | instance | class DefaultFontMapper
{
private static final FontMapper INSTANCE = new FontMapperImpl();
}
/**
* Returns the singleton FontMapper instance.
*
* @return a singleton FontMapper instance
*/
public static FontMapper instance()
{<FILL_FUNCTION_BODY> |
if (instance == null)
{
instance = DefaultFontMapper.INSTANCE;
}
return instance;
| 83 | 33 | 116 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDSystemInfo.java | PDCIDSystemInfo | toString | class PDCIDSystemInfo implements COSObjectable
{
private final COSDictionary dictionary;
PDCIDSystemInfo(String registry, String ordering, int supplement)
{
dictionary = new COSDictionary();
dictionary.setString(COSName.REGISTRY, registry);
dictionary.setString(COSName.ORDERING, ord... |
return getRegistry() + "-" + getOrdering() + "-" + getSupplement();
| 290 | 25 | 315 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDPanoseClassification.java | PDPanoseClassification | toString | class PDPanoseClassification
{
/**
* Length.
*/
public static final int LENGTH = 10;
private final byte[] bytes;
public PDPanoseClassification(byte[] bytes)
{
this.bytes = bytes;
}
public int getFamilyKind()
{
return bytes[0];
}
public int getSe... |
return "{ FamilyKind = " + getFamilyKind() + ", " +
"SerifStyle = " + getSerifStyle() + ", " +
"Weight = " + getWeight() + ", " +
"Proportion = " + getProportion() + ", " +
"Contrast = " + getContrast() + ", " +
"StrokeVariat... | 352 | 175 | 527 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFontEmbedder.java | PDTrueTypeFontEmbedder | setWidths | class PDTrueTypeFontEmbedder extends TrueTypeEmbedder
{
private final Encoding fontEncoding;
/**
* Creates a new TrueType font embedder for the given TTF as a PDTrueTypeFont.
*
* @param document The parent document
* @param dict Font dictionary
* @param ttf TrueType font
... |
float scaling = 1000f / ttf.getHeader().getUnitsPerEm();
HorizontalMetricsTable hmtx = ttf.getHorizontalMetrics();
Map<Integer, String> codeToName = getFontEncoding().getCodeToNameMap();
int firstChar = Collections.min(codeToName.keySet());
int lastChar = Collections.ma... | 540 | 455 | 995 | <methods>public void addGlyphIds(Set<java.lang.Integer>) ,public void addToSubset(int) ,public final void buildFontFile2(java.io.InputStream) throws java.io.IOException,public org.apache.pdfbox.pdmodel.font.PDFontDescriptor getFontDescriptor() ,public java.lang.String getTag(Map<java.lang.Integer,java.lang.Integer>) ,p... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1FontEmbedder.java | PDType1FontEmbedder | buildFontDescriptor | class PDType1FontEmbedder
{
private final Encoding fontEncoding;
private final Type1Font type1;
/**
* This will load a PFB to be embedded into a document.
*
* @param doc The PDF document that will hold the embedded font.
* @param dict The Font dictionary to write to.
... |
boolean isSymbolic = metrics.getEncodingScheme().equals("FontSpecific");
PDFontDescriptor fd = new PDFontDescriptor();
fd.setFontName(metrics.getFontName());
fd.setFontFamily(metrics.getFamilyName());
fd.setNonSymbolic(!isSymbolic);
fd.setSymbolic(isSymbolic);
... | 1,275 | 285 | 1,560 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java | PDType3CharProc | getGlyphBBox | class PDType3CharProc implements COSObjectable, PDContentStream
{
private static final Logger LOG = LogManager.getLogger(PDType3CharProc.class);
private final PDType3Font font;
private final COSStream charStream;
public PDType3CharProc(PDType3Font font, COSStream charStream)
{
this.font = ... |
List<COSBase> arguments = new ArrayList<>();
PDFStreamParser parser = new PDFStreamParser(this);
Object token = parser.parseNextToken();
while (token != null)
{
if (token instanceof Operator)
{
if (((Operator) token).getName().equals("d1")... | 923 | 294 | 1,217 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/ToUnicodeWriter.java | ToUnicodeWriter | allowCodeRange | class ToUnicodeWriter
{
private final Map<Integer, String> cidToUnicode = new TreeMap<>();
private int wMode;
/**
* To test corner case of PDFBOX-4302.
*/
static final int MAX_ENTRIES_PER_OPERATOR = 100;
/**
* Creates a new ToUnicode CMap writer.
*/
ToUnicodeWriter()
{
... |
if ((prev + 1) != next)
{
return false;
}
int prevH = (prev >> 8) & 0xFF;
int prevL = prev & 0xFF;
int nextH = (next >> 8) & 0xFF;
int nextL = next & 0xFF;
return prevH == nextH && prevL < nextL;
| 1,749 | 104 | 1,853 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/UniUtil.java | UniUtil | getUniNameOfCodePoint | class UniUtil
{
private UniUtil()
{
}
// faster than String.format("uni%04X", codePoint)
static String getUniNameOfCodePoint(int codePoint)
{<FILL_FUNCTION_BODY>}
} |
String hex = Integer.toString(codePoint, 16).toUpperCase(Locale.US);
switch (hex.length())
{
case 1:
return "uni000" + hex;
case 2:
return "uni00" + hex;
case 3:
return "uni0" + hex;
default:
... | 72 | 107 | 179 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java | DictionaryEncoding | getEncodingName | class DictionaryEncoding extends Encoding
{
private final COSDictionary encoding;
private final Encoding baseEncoding;
private final Map<Integer, String> differences = new HashMap<>();
/**
* Creates a new DictionaryEncoding for embedding.
*
* @param baseEncoding the base encoding of this... |
if (baseEncoding == null)
{
// In type 3 the /Differences array shall specify the complete character encoding
return "differences";
}
return baseEncoding.getEncodingName() + " with differences";
| 1,224 | 58 | 1,282 | <methods>public non-sealed void <init>() ,public boolean contains(java.lang.String) ,public boolean contains(int) ,public Map<java.lang.Integer,java.lang.String> getCodeToNameMap() ,public abstract java.lang.String getEncodingName() ,public static org.apache.pdfbox.pdmodel.font.encoding.Encoding getInstance(org.apache.... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/Encoding.java | Encoding | overwrite | class Encoding implements COSObjectable
{
protected static final int CHAR_CODE = 0;
protected static final int CHAR_NAME = 1;
/**
* This will get an encoding by name. May return null.
*
* @param name The name of the encoding to get.
* @return The encoding that matches the name.
*/
... |
// remove existing reverse mapping first
String oldName = codeToName.get(code);
if (oldName != null)
{
Integer oldCode = inverted.get(oldName);
if (oldCode != null && oldCode == code)
{
inverted.remove(oldName);
}
}... | 1,072 | 109 | 1,181 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/Type1Encoding.java | Type1Encoding | fromFontBox | class Type1Encoding extends Encoding
{
/**
* Creates an encoding from the given FontBox encoding.
*
* @param encoding FontBox encoding
* @return the encoding created from the given FontBox encoding
*/
public static Type1Encoding fromFontBox(org.apache.fontbox.encoding.Encoding encoding)... |
// todo: could optimise this by looking for specific subclasses
Map<Integer,String> codeToName = encoding.getCodeToNameMap();
Type1Encoding enc = new Type1Encoding();
codeToName.forEach(enc::add);
return enc;
| 281 | 67 | 348 | <methods>public non-sealed void <init>() ,public boolean contains(java.lang.String) ,public boolean contains(int) ,public Map<java.lang.Integer,java.lang.String> getCodeToNameMap() ,public abstract java.lang.String getEncodingName() ,public static org.apache.pdfbox.pdmodel.font.encoding.Encoding getInstance(org.apache.... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDFontSetting.java | PDFontSetting | getFont | class PDFontSetting implements COSObjectable
{
private COSArray fontSetting = null;
/**
* Creates a blank font setting, font will be null, size will be 1.
*/
public PDFontSetting()
{
fontSetting = new COSArray();
fontSetting.add( null );
fontSetting.add( new COSFloat( ... |
PDFont retval = null;
COSBase font = fontSetting.getObject(0);
if( font instanceof COSDictionary )
{
retval = PDFontFactory.createFont( (COSDictionary)font );
}
return retval;
| 493 | 68 | 561 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java | PDLineDashPattern | getCOSObject | class PDLineDashPattern implements COSObjectable
{
private final int phase;
private final float[] array;
/**
* Creates a new line dash pattern, with no dashes and a phase of 0.
*/
public PDLineDashPattern()
{
array = new float[] { };
phase = 0;
}
/**
* Create... |
COSArray cos = new COSArray();
cos.add(COSArray.of(array));
cos.add(COSInteger.get(phase));
return cos;
| 541 | 48 | 589 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDXObject.java | PDXObject | createXObject | class PDXObject implements COSObjectable
{
private final PDStream stream;
/**
* Creates a new XObject instance of the appropriate type for the COS stream.
*
* @param base The stream which is wrapped by this XObject.
* @param resources the resources of this XObject
* @return A ... |
if (base == null)
{
// TODO throw an exception?
return null;
}
if (!(base instanceof COSStream))
{
throw new IOException("Unexpected object type: " + base.getClass().getName());
}
COSStream stream = (COSStream)bas... | 762 | 380 | 1,142 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEBasedColorSpace.java | PDCIEBasedColorSpace | toRGBImage | class PDCIEBasedColorSpace extends PDColorSpace
{
//
// WARNING: this method is performance sensitive, modify with care!
//
@Override
public BufferedImage toRGBImage(WritableRaster raster) throws IOException
{<FILL_FUNCTION_BODY>}
@Override
public BufferedImage toRawImage(WritableRaster... |
// This method calls toRGB to convert images one pixel at a time. For matrix-based
// CIE color spaces this is fast enough. However, it should not be used with any
// color space which uses an ICC Profile as it will be far too slow.
int width = raster.getWidth();
int height = r... | 171 | 365 | 536 | <methods>public non-sealed void <init>() ,public static org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace create(org.apache.pdfbox.cos.COSBase) throws java.io.IOException,public static org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace create(org.apache.pdfbox.cos.COSBase, org.apache.pdfbox.pdmodel.PDResources) ... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java | PDCIEDictionaryBasedColorSpace | convXYZtoRGB | class PDCIEDictionaryBasedColorSpace extends PDCIEBasedColorSpace
{
protected final COSDictionary dictionary;
private static final ColorSpace CIEXYZ = ColorSpace.getInstance(ColorSpace.CS_CIEXYZ);
// we need to cache whitepoint values, because using getWhitePoint()
// would create a new default object... |
// toRGB() malfunctions with negative values
// XYZ must be non-negative anyway:
// http://ninedegreesbelow.com/photography/icc-profile-negative-tristimulus.html
if (x < 0)
{
x = 0;
}
if (y < 0)
{
y = 0;
}
if (z < 0... | 1,146 | 146 | 1,292 | <methods>public non-sealed void <init>() ,public java.awt.image.BufferedImage toRGBImage(java.awt.image.WritableRaster) throws java.io.IOException,public java.awt.image.BufferedImage toRawImage(java.awt.image.WritableRaster) throws java.io.IOException,public java.lang.String toString() <variables> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalGray.java | PDCalGray | toRGB | class PDCalGray extends PDCIEDictionaryBasedColorSpace
{
private final PDColor initialColor = new PDColor(new float[] { 0 }, this);
// PDFBOX-4119: cache the results for much improved performance
// cached values MUST be cloned, because they are modified by the caller.
// this can be observed in re... |
// see implementation of toRGB in PDCalRGB, and PDFBOX-2971
if (isWhitePoint())
{
float a = value[0];
float[] result = map1.get(a);
if (result != null)
{
return result.clone();
}
float gamma = getGamma();
... | 543 | 178 | 721 | <methods>public final org.apache.pdfbox.pdmodel.graphics.color.PDTristimulus getBlackPoint() ,public final org.apache.pdfbox.pdmodel.graphics.color.PDTristimulus getWhitepoint() ,public void setBlackPoint(org.apache.pdfbox.pdmodel.graphics.color.PDTristimulus) ,public void setWhitePoint(org.apache.pdfbox.pdmodel.graphi... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java | PDCalRGB | toRGB | class PDCalRGB extends PDCIEDictionaryBasedColorSpace
{
private final PDColor initialColor = new PDColor(new float[] { 0, 0, 0 }, this);
/**
* Creates a new CalRGB color space.
*/
public PDCalRGB()
{
super(COSName.CALRGB);
}
/**
* Creates a new CalRGB color space using t... |
if (isWhitePoint())
{
float a = value[0];
float b = value[1];
float c = value[2];
PDGamma gamma = getGamma();
float powAR = (float)Math.pow(a, gamma.getR());
float powBG = (float)Math.pow(b, gamma.getG());
float powCB ... | 1,083 | 412 | 1,495 | <methods>public final org.apache.pdfbox.pdmodel.graphics.color.PDTristimulus getBlackPoint() ,public final org.apache.pdfbox.pdmodel.graphics.color.PDTristimulus getWhitepoint() ,public void setBlackPoint(org.apache.pdfbox.pdmodel.graphics.color.PDTristimulus) ,public void setWhitePoint(org.apache.pdfbox.pdmodel.graphi... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDColor.java | PDColor | getComponents | class PDColor
{
private static final Logger LOG = LogManager.getLogger(PDColor.class);
private final float[] components;
private final COSName patternName;
private final PDColorSpace colorSpace;
/**
* Creates a PDColor containing the given color value.
* @param array a COS arra... |
if (colorSpace instanceof PDPattern || colorSpace == null)
{
// colorspace of the pattern color isn't known, so just clone
// null colorspace can happen with empty annotation color
// see PDFBOX-3351-538928-p4.pdf
return components.clone();
... | 1,567 | 138 | 1,705 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceCMYK.java | PDDeviceCMYK | toRawImage | class PDDeviceCMYK extends PDDeviceColorSpace
{
/** The single instance of this class. */
public static PDDeviceCMYK INSTANCE;
static
{
INSTANCE = new PDDeviceCMYK();
}
private final PDColor initialColor = new PDColor(new float[] { 0, 0, 0, 1 }, this);
private ICC_ColorSpace awtCol... |
// Device CMYK is not specified, as its the colors of whatever device you use.
// The user should fallback to the RGB image
return null;
| 1,687 | 41 | 1,728 | <methods>public non-sealed void <init>() ,public org.apache.pdfbox.cos.COSBase getCOSObject() ,public java.lang.String toString() <variables> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceGray.java | PDDeviceGray | toRGBImage | class PDDeviceGray extends PDDeviceColorSpace
{
/** The single instance of this class. */
public static final PDDeviceGray INSTANCE = new PDDeviceGray();
private final PDColor initialColor = new PDColor(new float[] { 0 }, this);
private PDDeviceGray()
{
}
@Override
public String g... |
int width = raster.getWidth();
int height = raster.getHeight();
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
int[] gray = new int[1];
int[] rgb = new int[3];
for (int y = 0; y < height; y++)
{
for (int x = 0; x... | 366 | 194 | 560 | <methods>public non-sealed void <init>() ,public org.apache.pdfbox.cos.COSBase getCOSObject() ,public java.lang.String toString() <variables> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceNAttributes.java | PDDeviceNAttributes | toString | class PDDeviceNAttributes
{
/**
* Log instance.
*/
private static final Logger LOG = LogManager.getLogger(PDDeviceNAttributes.class);
private final COSDictionary dictionary;
/**
* Creates a new DeviceN colour space attributes dictionary.
*/
public PDDeviceNAttributes()
{
... |
StringBuilder sb = new StringBuilder(dictionary.getNameAsString(COSName.SUBTYPE));
sb.append('{');
PDDeviceNProcess process = getProcess();
if (process != null)
{
sb.append(process);
sb.append(' ');
}
Map<String, PDSeparation> colorants;
... | 813 | 265 | 1,078 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceNProcess.java | PDDeviceNProcess | toString | class PDDeviceNProcess
{
/**
* Log instance.
*/
private static final Logger LOG = LogManager.getLogger(PDDeviceNProcess.class);
private final COSDictionary dictionary;
/**
* Creates a new DeviceN Process Dictionary.
*/
public PDDeviceNProcess()
{
dictionary = new CO... |
StringBuilder sb = new StringBuilder("Process{");
try
{
sb.append(getColorSpace());
for (String component : getComponents())
{
sb.append(" \"");
sb.append(component);
sb.append('\"');
}
}
... | 515 | 137 | 652 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceRGB.java | PDDeviceRGB | toRGBImage | class PDDeviceRGB extends PDDeviceColorSpace
{
/** This is the single instance of this class. */
public static final PDDeviceRGB INSTANCE = new PDDeviceRGB();
private final PDColor initialColor = new PDColor(new float[] { 0, 0, 0 }, this);
private PDDeviceRGB()
{
}
@Override
publ... |
//
// WARNING: this method is performance sensitive, modify with care!
//
// Please read PDFBOX-3854 and PDFBOX-2092 and look at the related commits first.
// The current code returns TYPE_INT_RGB images which prevents slowness due to threads
// blocking each other when ... | 392 | 143 | 535 | <methods>public non-sealed void <init>() ,public org.apache.pdfbox.cos.COSBase getCOSObject() ,public java.lang.String toString() <variables> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDLab.java | PDLab | getBRange | class PDLab extends PDCIEDictionaryBasedColorSpace
{
private PDColor initialColor;
/**
* Creates a new Lab color space.
*/
public PDLab()
{
super(COSName.LAB);
}
/**
* Creates a new Lab color space from a PDF array.
* @param lab the color space array
*/
... |
COSArray rangeArray = dictionary.getCOSArray(COSName.RANGE);
if (rangeArray == null)
{
rangeArray = getDefaultRangeArray();
}
return new PDRange(rangeArray, 1);
| 1,956 | 64 | 2,020 | <methods>public final org.apache.pdfbox.pdmodel.graphics.color.PDTristimulus getBlackPoint() ,public final org.apache.pdfbox.pdmodel.graphics.color.PDTristimulus getWhitepoint() ,public void setBlackPoint(org.apache.pdfbox.pdmodel.graphics.color.PDTristimulus) ,public void setWhitePoint(org.apache.pdfbox.pdmodel.graphi... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDOutputIntent.java | PDOutputIntent | configureOutputProfile | class PDOutputIntent implements COSObjectable
{
private final COSDictionary dictionary;
public PDOutputIntent(PDDocument doc, InputStream colorProfile) throws IOException
{
dictionary = new COSDictionary();
dictionary.setItem(COSName.TYPE, COSName.OUTPUT_INTENT);
dictionary.... |
ICC_Profile icc = ICC_Profile.getInstance(colorProfile);
PDStream stream = new PDStream(doc, new ByteArrayInputStream(icc.getData()), COSName.FLATE_DECODE);
stream.getCOSObject().setInt(COSName.N, icc.getNumComponents());
return stream;
| 640 | 93 | 733 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDPattern.java | PDPattern | getPattern | class PDPattern extends PDSpecialColorSpace
{
/** A pattern which leaves no marks on the page. */
private static final PDColor EMPTY_PATTERN = new PDColor(new float[] { }, null);
private final PDResources resources;
private PDColorSpace underlyingColorSpace;
/**
* Creates a new pattern co... |
PDAbstractPattern pattern = resources.getPattern(color.getPatternName());
if (pattern == null)
{
throw new IOException("pattern " + color.getPatternName() + " was not found");
}
else
{
return pattern;
}
| 711 | 71 | 782 | <methods>public non-sealed void <init>() <variables> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java | PDFormXObject | getGroup | class PDFormXObject extends PDXObject implements PDContentStream
{
private PDTransparencyGroupAttributes group;
private final ResourceCache cache;
/**
* Creates a Form XObject for reading.
* @param stream The XObject stream
*/
public PDFormXObject(PDStream stream)
{
super(str... |
if( group == null )
{
COSDictionary dic = getCOSObject().getCOSDictionary(COSName.GROUP);
if( dic != null )
{
group = new PDTransparencyGroupAttributes(dic);
}
}
return group;
| 1,836 | 76 | 1,912 | <methods>public static org.apache.pdfbox.pdmodel.graphics.PDXObject createXObject(org.apache.pdfbox.cos.COSBase, org.apache.pdfbox.pdmodel.PDResources) throws java.io.IOException,public final org.apache.pdfbox.cos.COSStream getCOSObject() ,public final org.apache.pdfbox.pdmodel.common.PDStream getStream() <variables>pr... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDTransparencyGroupAttributes.java | PDTransparencyGroupAttributes | getColorSpace | class PDTransparencyGroupAttributes implements COSObjectable
{
private final COSDictionary dictionary;
private PDColorSpace colorSpace;
/**
* Creates a group object with /Transparency subtype entry.
*/
public PDTransparencyGroupAttributes()
{
dictionary = new COSDictionary();
... |
if (colorSpace == null && getCOSObject().containsKey(COSName.CS))
{
colorSpace = PDColorSpace.create(getCOSObject().getDictionaryObject(COSName.CS), resources);
}
return colorSpace;
| 564 | 67 | 631 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java | PNGConverterState | parsePNGChunks | class PNGConverterState
{
List<Chunk> IDATs = new ArrayList<>();
@SuppressWarnings("SpellCheckingInspection") Chunk IHDR;
@SuppressWarnings("SpellCheckingInspection") Chunk PLTE;
Chunk iCCP;
Chunk tRNS;
Chunk sRGB;
Chunk gAMA;
Chunk cHRM;
// P... |
if (imageData.length < 20)
{
LOG.error("ByteArray way to small: {}", imageData.length);
return null;
}
PNGConverterState state = new PNGConverterState();
int ptr = 8;
int firstChunkType = readInt(imageData, ptr + 4);
if (firstChunkType !... | 416 | 1,085 | 1,501 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/PDOptionalContentGroup.java | PDOptionalContentGroup | getRenderState | class PDOptionalContentGroup extends PDPropertyList
{
/**
* Creates a new optional content group (OCG).
* @param name the name of the content group
*/
public PDOptionalContentGroup(String name)
{
this.dict.setItem(COSName.TYPE, COSName.OCG);
setName(name);
}
/**
... |
COSName state = null;
COSDictionary usage = dict.getCOSDictionary(COSName.USAGE);
if (usage != null)
{
if (RenderDestination.PRINT == destination)
{
COSDictionary print = usage.getCOSDictionary(COSName.PRINT);
state = print == null... | 714 | 267 | 981 | <methods>public static org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDPropertyList create(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.cos.COSDictionary getCOSObject() <variables>protected final non-sealed org.apache.pdfbox.cos.COSDictionary dict |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/PDOptionalContentMembershipDictionary.java | PDOptionalContentMembershipDictionary | getOCGs | class PDOptionalContentMembershipDictionary extends PDPropertyList
{
/**
* Creates a new optional content membership dictionary (OCMD).
*/
public PDOptionalContentMembershipDictionary()
{
this.dict.setItem(COSName.TYPE, COSName.OCMD);
}
/**
* Creates a new instance based on a... |
COSBase base = dict.getDictionaryObject(COSName.OCGS);
if (base instanceof COSDictionary)
{
return Collections.singletonList(PDPropertyList.create((COSDictionary) base));
}
if (base instanceof COSArray)
{
List<PDPropertyList> list = new ArrayList... | 572 | 193 | 765 | <methods>public static org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDPropertyList create(org.apache.pdfbox.cos.COSDictionary) ,public org.apache.pdfbox.cos.COSDictionary getCOSObject() <variables>protected final non-sealed org.apache.pdfbox.cos.COSDictionary dict |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/pattern/PDAbstractPattern.java | PDAbstractPattern | setMatrix | class PDAbstractPattern implements COSObjectable
{
/** Tiling pattern type. */
public static final int TYPE_TILING_PATTERN = 1;
/** Shading pattern type. */
public static final int TYPE_SHADING_PATTERN = 2;
/**
* Create the correct PD Model pattern based on the COS base pattern.
* @param... |
COSArray matrix = new COSArray();
double[] values = new double[6];
transform.getMatrix(values);
for (double v : values)
{
matrix.add(new COSFloat((float)v));
}
getCOSObject().setItem(COSName.MATRIX, matrix);
| 872 | 86 | 958 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/pattern/PDShadingPattern.java | PDShadingPattern | getExtendedGraphicsState | class PDShadingPattern extends PDAbstractPattern
{
private PDExtendedGraphicsState extendedGraphicsState;
private PDShading shading;
/**
* Creates a new shading pattern.
*/
public PDShadingPattern()
{
getCOSObject().setInt(COSName.PATTERN_TYPE, PDAbstractPattern.TYPE_SHADING_PATTE... |
if (extendedGraphicsState == null)
{
COSDictionary base = getCOSObject().getCOSDictionary(COSName.EXT_G_STATE);
if (base != null)
{
extendedGraphicsState = new PDExtendedGraphicsState(base);
}
}
return extendedGraphicsState... | 606 | 85 | 691 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public static org.apache.pdfbox.pdmodel.graphics.pattern.PDAbstractPattern create(org.apache.pdfbox.cos.COSDictionary, org.apache.pdfbox.pdmodel.ResourceCache) throws java.io.IOException,public org.apache.pdfbox.cos.COSDictionary ge... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/pattern/PDTilingPattern.java | PDTilingPattern | getContents | class PDTilingPattern extends PDAbstractPattern implements PDContentStream
{
/** paint type 1 = colored tiling pattern. */
public static final int PAINT_COLORED = 1;
/** paint type 2 = uncolored tiling pattern. */
public static final int PAINT_UNCOLORED = 2;
/** tiling type 1 = constant spacing.*/... |
RandomAccessRead contentsForRandomAccess = getContentsForRandomAccess();
return contentsForRandomAccess != null
? new RandomAccessInputStream(contentsForRandomAccess) : null;
| 1,686 | 45 | 1,731 | <methods>public void <init>() ,public void <init>(org.apache.pdfbox.cos.COSDictionary) ,public static org.apache.pdfbox.pdmodel.graphics.pattern.PDAbstractPattern create(org.apache.pdfbox.cos.COSDictionary, org.apache.pdfbox.pdmodel.ResourceCache) throws java.io.IOException,public org.apache.pdfbox.cos.COSDictionary ge... |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingPaint.java | AxialShadingPaint | createContext | class AxialShadingPaint extends ShadingPaint<PDShadingType2>
{
private static final Logger LOG = LogManager.getLogger(AxialShadingPaint.class);
/**
* Constructor.
*
* @param shadingType2 the shading resources
* @param matrix the pattern matrix concatenated with that of the parent co... |
try
{
return new AxialShadingContext(shading, cm, xform, matrix, deviceBounds);
}
catch (IOException e)
{
LOG.error("An error occurred while painting", e);
return new Color(0, 0, 0, 0).createContext(cm, deviceBounds, userBounds, xform,... | 249 | 106 | 355 | <methods>public org.apache.pdfbox.util.Matrix getMatrix() ,public org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType2 getShading() <variables>protected final non-sealed org.apache.pdfbox.util.Matrix matrix,protected final non-sealed org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType2 shading |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CubicBezierCurve.java | CubicBezierCurve | getPoints | class CubicBezierCurve
{
private final Point2D[] controlPoints;
private final int level;
private final Point2D[] curve;
/**
* Constructor of CubicBezierCurve
*
* @param ctrlPnts 4 control points [p0, p1, p2, p3]
* @param l dividing level, if l = 0, one cubic Bezier curve is divided
... |
if (l < 0)
{
l = 0;
}
int sz = (1 << l) + 1;
Point2D[] res = new Point2D[sz];
double step = (double) 1 / (sz - 1);
double t = -step;
for (int i = 0; i < sz; i++)
{
t += step;
double tmpX = (1 - t) * (1 - t) * (1... | 455 | 331 | 786 | <no_super_class> |
apache_pdfbox | pdfbox/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/GouraudShadingContext.java | GouraudShadingContext | calcPixelTable | class GouraudShadingContext extends TriangleBasedShadingContext
{
/**
* triangle list.
*/
private List<ShadedTriangle> triangleList = new ArrayList<>();
/**
* Constructor creates an instance to be used for fill operations.
*
* @param shading the shading type to be used
* @para... |
Map<Point, Integer> map = new HashMap<>();
super.calcPixelTable(triangleList, map, deviceBounds);
return map;
| 334 | 41 | 375 | <methods>public final java.awt.image.Raster getRaster(int, int, int, int) <variables>private Map<java.awt.Point,java.lang.Integer> pixelTable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.