internal RemoteDestination( PdfDirectObject baseObject, PdfString name ) : base(baseObject, name) { }
internal WidgetActions( Annotation parent, PdfDirectObject baseObject ) : base(parent, baseObject) { }
internal JavaScript( PdfDirectObject baseObject, PdfString name ) : base(baseObject, name) { }
//TODO:verify (colorspace is available or may be implicit?) protected Pattern( PatternColorSpace colorSpace, PdfDirectObject baseObject ) : base(colorSpace, baseObject) { }
public GenericOperation( string operator_, PdfDirectObject operand ) : base(operator_,operand) { }
public MarkedContentPoint( PdfName tag, PdfDirectObject properties ) : base(tag, properties) { }
/** <summary>Instantiates a wrapper in case of reference or mutable data object.</summary> <param name="baseObject">PDF object backing this wrapper. MUST be a <see cref="PdfReference"/> everytime available.</param> */ protected PdfObjectWrapper( PdfDirectObject baseObject ) { BaseObject = baseObject; container = (baseObject != null ? baseObject.Container : null); }
protected LeveledColor( ColorSpace colorSpace, PdfDirectObject baseObject ) : base(colorSpace, baseObject) { }
internal TilingPattern( PatternColorSpace colorSpace, PdfDirectObject baseObject ) : base(colorSpace, baseObject) { }
protected DeviceColor( DeviceColorSpace colorSpace, PdfDirectObject baseObject ) : base(colorSpace, baseObject) { }
protected Operation( string operator_, PdfDirectObject operand ) { this.operator_ = operator_; this.operands = new List<PdfDirectObject>(); this.operands.Add(operand); }
public static ILayerNode Wrap( PdfDirectObject baseObject ) { if(baseObject == null) return null; PdfDataObject baseDataObject = baseObject.Resolve(); if(baseDataObject is PdfDictionary) return Layer.Wrap(baseObject); else if(baseDataObject is PdfArray) return Layers.Wrap(baseObject); else throw new ArgumentException(baseDataObject.GetType().Name + " is NOT a valid layer node."); }
internal GoToFirstPage( PdfDirectObject baseObject ) : base(baseObject) { }
protected SimpleFont( PdfDirectObject baseObject ) : base(baseObject) { }
internal NamedAction( PdfDirectObject baseObject ) : base(baseObject) { }
internal SubmitForm( PdfDirectObject baseObject ) : base(baseObject) { }
public Names(PdfDirectObject baseObject) : base(baseObject) { }
/** * <summary>Parses the current PDF object [PDF:1.6:3.2].</summary> */ public virtual PdfDataObject ParsePdfObject() { switch (TokenType) { case TokenTypeEnum.Integer: return(PdfInteger.Get((int)Token)); case TokenTypeEnum.Name: return(new PdfName((string)Token, true)); case TokenTypeEnum.DictionaryBegin: { PdfDictionary dictionary = new PdfDictionary(); dictionary.Updateable = false; while (true) { // Key. MoveNext(); if (TokenType == TokenTypeEnum.DictionaryEnd) { break; } PdfName key = (PdfName)ParsePdfObject(); // Value. MoveNext(); PdfDirectObject value = (PdfDirectObject)ParsePdfObject(); // Add the current entry to the dictionary! if (dictionary.ContainsKey(key)) { key = new PdfName(key.StringValue + "Dublicat"); } dictionary[key] = value; } dictionary.Updateable = true; return(dictionary); } case TokenTypeEnum.ArrayBegin: { PdfArray array = new PdfArray(); array.Updateable = false; while (true) { // Value. MoveNext(); if (TokenType == TokenTypeEnum.ArrayEnd) { break; } // Add the current item to the array! array.Add((PdfDirectObject)ParsePdfObject()); } array.Updateable = true; return(array); } case TokenTypeEnum.Literal: if (Token is DateTime) { return(PdfDate.Get((DateTime)Token)); } else { return(new PdfTextString(Token == null ? null : Encoding.Pdf.Encode((string)Token))); } case TokenTypeEnum.Hex: return(new PdfTextString((string)Token, PdfString.SerializationModeEnum.Hex)); case TokenTypeEnum.Real: return(PdfReal.Get((double)Token)); case TokenTypeEnum.Boolean: return(PdfBoolean.Get((bool)Token)); case TokenTypeEnum.Null: return(null); default: throw new PostScriptParseException(String.Format("Unknown type beginning: '{0}'", Token), this); } }
internal JavaScript( PdfDirectObject baseObject ) : base(baseObject) { }
public EmbeddedFile(PdfDirectObject baseObject) : base(baseObject) { }
internal MediaScreenParameters( PdfDirectObject baseObject ) : base(baseObject) { }
internal Viability( PdfDirectObject baseObject ) : base(baseObject) { }
internal FloatingWindowParametersObject( PdfDirectObject baseObject ) : base(baseObject) { }
private LayerDefinition( PdfDirectObject baseObject ) : base(baseObject) { Initialize(); }
public static LayerDefinition Wrap( PdfDirectObject baseObject ) { return(baseObject != null ? new LayerDefinition(baseObject) : null); }
internal FullFileSpecification( PdfDirectObject baseObject ) : base(baseObject) { }
protected internal Widget( PdfDirectObject baseObject ) : base(baseObject) { }
//TODO:IMPL new element constructor! internal ShadingPattern(PdfDirectObject baseObject) : base(baseObject) { }
//TODO:implement function creation! internal Type0Function( PdfDirectObject baseObject ) : base(baseObject) { }
private ColorSpaceResources( PdfDirectObject baseObject, PdfIndirectObject container ) : base(baseObject, container) { }
public Page(PdfDirectObject baseObject) : base(baseObject) { }
protected override ColorSpace Wrap( PdfDirectObject baseObject ) { return(ColorSpace.Wrap(baseObject, Container)); }
public FunctionBasedShading(PdfDirectObject baseObject) : base(baseObject) { }
} //TODO:shading types! #endregion #endregion #endregion #region dynamic #region constructors //TODO:IMPL new element constructor! protected Shading(PdfDirectObject baseObject) : base(baseObject) { }
internal Rectangle( PdfDirectObject baseObject ) : base(baseObject) { }
internal Names( PdfDirectObject baseObject ) : base(baseObject) { }
public ListBox( PdfDirectObject baseObject ) : base(baseObject) { }
public CheckBox( PdfDirectObject baseObject ) : base(baseObject) { }
protected LayerEntity( PdfDirectObject baseObject ) : base(baseObject) { }
/** * <summary>Parses the current PDF object [PDF:1.6:3.2].</summary> */ public PdfDataObject ParsePdfObject( ) { /* * NOTE: Object parsing is intrinsically a sequential operation tied to the stream pointer. * Calls bound towards other classes are potentially disruptive for the predictability of * the position of the stream pointer, so we are forced to carefully keep track of our * current position in order to recover its proper state after any outbound call. */ do { // Which token type? switch (tokenType) { case TokenTypeEnum.Integer: return(new PdfInteger((int)token)); case TokenTypeEnum.Name: return(new PdfName((string)token, true)); case TokenTypeEnum.Reference: /* * NOTE: Curiously, PDF references are the only primitive objects that require * a file reference. That's because they deal with indirect objects, which are strongly * coupled with the current state of the file: so, PDF references are the fundamental * bridge between the token layer and the file layer. */ return(new PdfReference( (Reference)token, file )); case TokenTypeEnum.Literal: return(new PdfTextString( Encoding.Encode((string)token) )); case TokenTypeEnum.DictionaryBegin: PdfDictionary dictionary = new PdfDictionary(); while (true) { // Key. MoveNext(); if (tokenType == TokenTypeEnum.DictionaryEnd) { break; } PdfName key = (PdfName)ParsePdfObject(); // Value. MoveNext(); PdfDirectObject value = (PdfDirectObject)ParsePdfObject(); // Add the current entry to the dictionary! dictionary[key] = value; } int oldOffset = (int)stream.Position; MoveNext(); // Is this dictionary the header of a stream object [PDF:1.6:3.2.7]? if ((tokenType == TokenTypeEnum.Keyword) && token.Equals(Keyword.BeginStream)) { // Keep track of current position! long position = stream.Position; // Get the stream length! /* * NOTE: Indirect reference resolution is an outbound call (stream pointer hazard!), * so we need to recover our current position after it returns. */ int length = ((PdfInteger)files.File.Resolve(dictionary[PdfName.Length])).RawValue; // Move to the stream data beginning! stream.Seek(position); SkipEOL(); // Copy the stream data to the instance! byte[] data = new byte[length]; stream.Read(data); MoveNext(); // Postcondition (last token should be 'endstream' keyword). Object streamType = dictionary[PdfName.Type]; if (PdfName.ObjStm.Equals(streamType)) // Object stream [PDF:1.6:3.4.6]. { return(new ObjectStream( dictionary, new bytes.Buffer(data), file )); } else if (PdfName.XRef.Equals(streamType)) // Cross-reference stream [PDF:1.6:3.4.7]. { return(new XRefStream( dictionary, new bytes.Buffer(data), file )); } else // Generic stream. { return(new PdfStream( dictionary, new bytes.Buffer(data) )); } } else // Stand-alone dictionary. { stream.Seek(oldOffset); // Restores postcondition (last token should be the dictionary end). return(dictionary); } case TokenTypeEnum.ArrayBegin: PdfArray array = new PdfArray(); while (true) { // Value. MoveNext(); if (tokenType == TokenTypeEnum.ArrayEnd) { break; } // Add the current item to the array! array.Add((PdfDirectObject)ParsePdfObject()); } return(array); case TokenTypeEnum.Real: return(new PdfReal((float)token)); case TokenTypeEnum.Boolean: return(PdfBoolean.Get((bool)token)); case TokenTypeEnum.Date: return(new PdfDate((DateTime)token)); case TokenTypeEnum.Hex: return(new PdfTextString( (string)token, PdfString.SerializationModeEnum.Hex )); case TokenTypeEnum.Null: return(null); case TokenTypeEnum.Comment: // NOOP: Comments are simply ignored and skipped. break; default: throw new Exception("Unknown type: " + tokenType); } } while(MoveNext()); return(null); }
internal GoToRemote( PdfDirectObject baseObject ) : base(baseObject) { }
internal ListBox( PdfDirectObject baseObject ) : base(baseObject) { }
public static Widget Wrap( PdfDirectObject baseObject, Field field ) { return field is CheckBox || field is RadioButton ? new DualWidget(baseObject) : new Widget(baseObject); }
internal PageElements(IWrapper <TItem> itemWrapper, PdfDirectObject baseObject, Page page) : base(itemWrapper, baseObject) { this.page = page; }
internal ToggleVisibility( PdfDirectObject baseObject ) : base(baseObject) { }
public Annotation(PdfDirectObject baseObject) : base(baseObject) { }
//TODO:IMPL new element constructor! internal ShadingPattern( PdfDirectObject baseObject ) : base(baseObject) { }
/** * <summary>Wraps an annotation base object into an annotation object.</summary> * <param name="baseObject">Annotation base object.</param> * <returns>Annotation object associated to the base object.</returns> */ public static Annotation Wrap(PdfDirectObject baseObject) { if (baseObject == null) { return(null); } if (baseObject.Wrapper is Annotation annotation) { return(annotation); } if (baseObject is PdfReference reference && reference.DataObject?.Wrapper is Annotation referenceAnnotation) { baseObject.Wrapper = referenceAnnotation; return(referenceAnnotation); } var dictionary = (PdfDictionary)baseObject.Resolve(); if (dictionary == null) { return(null); } PdfName annotationType = (PdfName)dictionary[PdfName.Subtype]; if (annotationType.Equals(PdfName.Text)) { return(new StickyNote(baseObject)); } else if (annotationType.Equals(PdfName.Link)) { return(new Link(baseObject)); } else if (annotationType.Equals(PdfName.FreeText)) { return(new FreeText(baseObject)); } else if (annotationType.Equals(PdfName.Line)) { return(new Line(baseObject)); } else if (annotationType.Equals(PdfName.Square)) { return(new Rectangle(baseObject)); } else if (annotationType.Equals(PdfName.Circle)) { return(new Ellipse(baseObject)); } else if (annotationType.Equals(PdfName.Polygon)) { return(new Polygon(baseObject)); } else if (annotationType.Equals(PdfName.PolyLine)) { return(new Polyline(baseObject)); } else if (annotationType.Equals(PdfName.Highlight) || annotationType.Equals(PdfName.Underline) || annotationType.Equals(PdfName.Squiggly) || annotationType.Equals(PdfName.StrikeOut)) { return(new TextMarkup(baseObject)); } else if (annotationType.Equals(PdfName.Stamp)) { return(new Stamp(baseObject)); } else if (annotationType.Equals(PdfName.Caret)) { return(new Caret(baseObject)); } else if (annotationType.Equals(PdfName.Ink)) { return(new Scribble(baseObject)); } else if (annotationType.Equals(PdfName.Popup)) { return(new Popup(baseObject)); } else if (annotationType.Equals(PdfName.FileAttachment)) { return(new FileAttachment(baseObject)); } else if (annotationType.Equals(PdfName.Sound)) { return(new Sound(baseObject)); } else if (annotationType.Equals(PdfName.Movie)) { return(new Movie(baseObject)); } else if (annotationType.Equals(PdfName.Widget)) { return(new Widget(baseObject)); } else if (annotationType.Equals(PdfName.Screen)) { return(new Screen(baseObject)); } //TODO // else if(annotationType.Equals(PdfName.PrinterMark)) return new PrinterMark(baseObject); // else if(annotationType.Equals(PdfName.TrapNet)) return new TrapNet(baseObject); // else if(annotationType.Equals(PdfName.Watermark)) return new Watermark(baseObject); // else if(annotationType.Equals(PdfName.3DAnnotation)) return new 3DAnnotation(baseObject); else // Other annotation type. { return(new GenericAnnotation(baseObject)); } }
internal GoTo3dView( PdfDirectObject baseObject ) : base(baseObject) { }
/** * <summary>Instantiates an existing external object.</summary> */ protected XObject( PdfDirectObject baseObject ) : base(baseObject) { }
internal Ellipse( PdfDirectObject baseObject ) : base(baseObject) { }
internal Line( PdfDirectObject baseObject ) : base(baseObject) { }
//TODO:IMPL new element constructor! protected SpecialColorSpace( PdfDirectObject baseObject ) : base(baseObject) { }
internal PageElements(PdfDirectObject baseObject, Page page) : base(baseObject) { this.page = page; }