Package org.pdfclown.objects

Examples of org.pdfclown.objects.PdfName


    )
  {
    /*
      NOTE: 'S' entry may be undefined.
    */
    PdfName styleObject = (PdfName)getBaseDataObject().get(PdfName.S);
    if(styleObject == null)
      return DefaultStyle;

    return StyleEnum.get(styleObject);
  }
View Full Code Here


    /*
      NOTE: The names DeviceGray, DeviceRGB, DeviceCMYK, and Pattern always identify
      the corresponding color spaces directly; they never refer to resources in the
      ColorSpace subdictionary [PDF:1.6:4.5.7].
    */
    PdfName name = getName();
    if(name.equals(PdfName.DeviceGray))
      return DeviceGrayColorSpace.Default;
    else if(name.equals(PdfName.DeviceRGB))
      return DeviceRGBColorSpace.Default;
    else if(name.equals(PdfName.DeviceCMYK))
      return DeviceCMYKColorSpace.Default;
    else if(name.equals(PdfName.Pattern))
      return PatternColorSpace.Default;
    else
      return context.getResources().getColorSpaces().get(name);
  }
View Full Code Here

    )
  {
    /*
      NOTE: 'Name' entry may be undefined.
    */
    PdfName nameObject = (PdfName)getBaseDataObject().get(PdfName.Name);
    if(nameObject == null)
      return IconTypeEnum.PushPin;

    return IconTypeEnum.get(nameObject);
  }
View Full Code Here

    Document document = file.getDocument();
    {
      // Create the action dictionary!
      PdfDictionary action = new PdfDictionary();
      // Define the action type (in this case: go-to)!
      action.put(new PdfName("S"),new PdfName("GoTo"));
      // Defining the action destination...
      {
        // Create the destination array!
        PdfArray destination = new PdfArray();
        // Define the 2nd page as the destination target!
        destination.add(document.getPages().get(1).getBaseObject());
        // Define the location of the document window on the page (fit vertically)!
        destination.add(new PdfName("FitV"));
        // Define the window's left-edge horizontal coordinate!
        destination.add(new PdfInteger(-32768));
        // Associate the destination to the action!
        action.put(new PdfName("D"),destination);
      }
      // Associate the action to the document!
      document.getBaseDataObject().put(
        new PdfName("OpenAction"),
        file.register(action) // Adds the action to the file, returning its reference.
        ); document.update(); // Updates the existing document object (fundamental to override previous content).
    }

    // (boilerplate metadata insertion -- ignore it)
View Full Code Here

    PdfDictionary dataObject = (PdfDictionary)File.resolve(baseObject);
    if(!dataObject.get(PdfName.Type).equals(PdfName.Annot))
      return null;

    PdfName annotationType = (PdfName)dataObject.get(PdfName.Subtype);
    if(annotationType.equals(PdfName.Text))
      return new Note(baseObject,container);
    else if(annotationType.equals(PdfName.Link))
      return new Link(baseObject,container);
    else if(annotationType.equals(PdfName.FreeText))
      return new CalloutNote(baseObject,container);
    else if(annotationType.equals(PdfName.Line))
      return new Line(baseObject,container);
    else if(annotationType.equals(PdfName.Square))
      return new Rectangle(baseObject,container);
    else if(annotationType.equals(PdfName.Circle))
      return new Ellipse(baseObject,container);
    else if(annotationType.equals(PdfName.Polygon))
      return new Polygon(baseObject,container);
    else if(annotationType.equals(PdfName.PolyLine))
      return new Polyline(baseObject,container);
    else if(annotationType.equals(PdfName.Highlight)
      || annotationType.equals(PdfName.Underline)
      || annotationType.equals(PdfName.Squiggly)
      || annotationType.equals(PdfName.StrikeOut))
      return new TextMarkup(baseObject,container);
    else if(annotationType.equals(PdfName.Stamp))
      return new RubberStamp(baseObject,container);
    else if(annotationType.equals(PdfName.Caret))
      return new Caret(baseObject,container);
    else if(annotationType.equals(PdfName.Ink))
      return new Scribble(baseObject,container);
    else if(annotationType.equals(PdfName.Popup))
      return new Popup(baseObject,container);
    else if(annotationType.equals(PdfName.FileAttachment))
      return new FileAttachment(baseObject,container);
    else if(annotationType.equals(PdfName.Sound))
      return new Sound(baseObject,container);
    else if(annotationType.equals(PdfName.Movie))
      return new Movie(baseObject,container);
    else if(annotationType.equals(PdfName.Widget))
      return new Widget(baseObject,container);
//TODO
//     else if(annotationType.equals(PdfName.Screen)) return new Screen(baseObject,container);
//     else if(annotationType.equals(PdfName.PrinterMark)) return new PrinterMark(baseObject,container);
//     else if(annotationType.equals(PdfName.TrapNet)) return new TrapNet(baseObject,container);
View Full Code Here

      switch(tokenType)
      {
        case Integer:
          return new PdfInteger((Integer)token);
        case Name:
          return new PdfName((String)token,true);
        case Literal:
          return new PdfString(
            Encoding.encode((String)token),
            PdfString.SerializationModeEnum.Literal
            );
        case DictionaryBegin:
          {
            PdfDictionary dictionary = new PdfDictionary();
            // Populate the dictionary.
            while(true)
            {
              // Key.
              moveNext();
              if(tokenType == TokenTypeEnum.DictionaryEnd)
                break;
              PdfName key = (PdfName)parsePdfObject();

              // Value.
              moveNext();
              PdfDirectObject value = parsePdfObject();
View Full Code Here

    )
  {
    /*
      NOTE: 'Name' entry may be undefined.
    */
    PdfName nameObject = (PdfName)getBaseDataObject().get(PdfName.Name);
    if(nameObject == null)
      return IconTypeEnum.Speaker;

    return IconTypeEnum.get(nameObject);
  }
View Full Code Here

      return parser.parse();
    }
    else if(descriptor.containsKey(PdfName.FontFile3)) // Embedded compact Type 1 font.
    {
      PdfStream fontFileStream = (PdfStream)descriptor.resolve(PdfName.FontFile3);
      PdfName fontFileSubtype = (PdfName)fontFileStream.getHeader().get(PdfName.Subtype);
      if(fontFileSubtype.equals(PdfName.Type1C)) // CFF.
      {throw new NotImplementedException("Embedded CFF font file.");}
      else if(fontFileSubtype.equals(PdfName.OpenType)) // OpenFont/CFF.
      {throw new NotImplementedException("Embedded OpenFont/CFF font file.");}
      else
      {throw new UnsupportedOperationException("Unsupported embedded font file format: " + fontFileSubtype);}
    }
    else // Non-embedded font.
View Full Code Here

      else // Custom encoding.
      {
        PdfDictionary encodingDictionary = (PdfDictionary)encodingObject;

        // 1. Base encoding.
        PdfName baseEncodingName = (PdfName)encodingDictionary.get(PdfName.BaseEncoding);
        if(baseEncodingName == null) // Native base encoding.
        {codes = getNativeEncoding();}
        else // Predefined base encoding.
        {codes = Encoding.get(baseEncodingName).getCodes();}
View Full Code Here

    /*
      NOTE: The names DeviceGray, DeviceRGB, DeviceCMYK, and Pattern always identify
      the corresponding color spaces directly; they never refer to resources in the
      ColorSpace subdictionary [PDF:1.6:4.5.7].
    */
    PdfName name = getName();
    if(name.equals(PdfName.DeviceGray))
      return DeviceGrayColorSpace.Default;
    else if(name.equals(PdfName.DeviceRGB))
      return DeviceRGBColorSpace.Default;
    else if(name.equals(PdfName.DeviceCMYK))
      return DeviceCMYKColorSpace.Default;
    else if(name.equals(PdfName.Pattern))
      return PatternColorSpace.Default;
    else
      return context.getResources().getColorSpaces().get(name);
  }
View Full Code Here

TOP

Related Classes of org.pdfclown.objects.PdfName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.