Package org.pdfclown.objects

Examples of org.pdfclown.objects.PdfInteger


    // 2. Header.
    {
      final PdfDictionary header = getHeader();
      header.put(
        PdfName.N,
        new PdfInteger(getEntries().size())
        );
      header.put(
        PdfName.First,
        new PdfInteger(dataByteOffset)
        );
    }
  }
View Full Code Here


      {getBaseDataObject().remove(PdfName.P);}
      else
      {
        PdfDirectObject pageRefObject;
        if(value instanceof Integer)
        {pageRefObject = new PdfInteger((Integer)value);}
        else if(value instanceof String)
        {pageRefObject = new PdfString((String)value);}
        else
          throw new IllegalArgumentException("Wrong argument type: it MUST be either a page number Integer or a named destination String.");
View Full Code Here

      {getBaseDataObject().remove(PdfName.A);}
      else
      {
        PdfDirectObject annotationRefObject;
        if(value instanceof Integer)
        {annotationRefObject = new PdfInteger((Integer)value);}
        else if(value instanceof String)
        {annotationRefObject = new PdfTextString((String)value);}
        else
          throw new IllegalArgumentException("Wrong argument type: it MUST be either an annotation index Integer or an annotation name String.");
View Full Code Here

    {
      // Which token type?
      switch(tokenType)
      {
        case Integer:
          return new PdfInteger((Integer)token);
        case Name:
          return new PdfName((String)token,true);
        case Reference:
          /*
            NOTE: Curiously, PDF references are the only primitive objects that require
View Full Code Here

    @return <code>-1</code> in case no linked stream exists.
  */
  public int getLinkedStreamOffset(
    )
  {
    PdfInteger linkedStreamOffsetObject = (PdfInteger)getHeader().get(PdfName.Prev);
    return (linkedStreamOffsetObject != null ? linkedStreamOffsetObject.getValue() : -1);
  }
View Full Code Here

      {
        int entryNumber = entry.getNumber();
        if(entryNumber - prevObjectNumber != 1) // Current subsection terminated.
        {
          if(!indexArray.isEmpty())
          {indexArray.add(new PdfInteger(prevObjectNumber-((PdfInteger)indexArray.get(indexArray.size()-1)).getValue()+1));} // Number of entries in the previous subsection.
          indexArray.add(new PdfInteger(entryNumber)); // First object number in the next subsection.
        }
        prevObjectNumber = entryNumber;

        switch(entry.getUsage())
        {
          case Free:
            body.append((byte)FreeEntryType);
            body.append(numberToByteArray(entry.getOffset(),entryFieldSizes[1]));
            body.append(numberToByteArray(entry.getGeneration(),entryFieldSizes[2]));
            break;
          case InUse:
            body.append((byte)InUseEntryType);
            body.append(numberToByteArray(entry.getOffset(),entryFieldSizes[1]));
            body.append(numberToByteArray(entry.getGeneration(),entryFieldSizes[2]));
            break;
          case InUseCompressed:
            body.append((byte)InUseCompressedEntryType);
            body.append(numberToByteArray(entry.getStreamNumber(),entryFieldSizes[1]));
            body.append(numberToByteArray(entry.getOffset(),entryFieldSizes[2]));
            break;
          default:
            throw new UnsupportedOperationException();
        }
      }
      indexArray.add(new PdfInteger(prevObjectNumber-((PdfInteger)indexArray.get(indexArray.size()-1)).getValue()+1)); // Number of entries in the previous subsection.
    }

    // 2. Header.
    {
      final PdfDictionary header = getHeader();
      header.put(
        PdfName.Index,
        indexArray
        );
      header.put(
        PdfName.Size,
        new PdfInteger(file.getIndirectObjects().size()+1)
        );
      header.put(
        PdfName.W,
        new PdfArray(
          new PdfInteger(entryFieldSizes[0]),
          new PdfInteger(entryFieldSizes[1]),
          new PdfInteger(entryFieldSizes[2])
          )
        );
    }
  }
View Full Code Here

        if(header.containsKey(PdfName.Index))
        {subsectionBounds = (PdfArray)header.get(PdfName.Index);}
        else
        {
          subsectionBounds = new PdfArray();
          subsectionBounds.add(new PdfInteger(0));
          subsectionBounds.add(new PdfInteger(size));
        }

        body.setByteOrder(ByteOrder.BIG_ENDIAN);
        body.seek(0);
View Full Code Here

        }
        if(prevFreeEntry != null)
        {prevFreeEntry.setOffset(0);} // Linking back to the first free object. NOTE: The first entry in the table (object number 0) is always free.

        // 2.2. XRef stream.
        xrefStream.getHeader().put(PdfName.Prev,new PdfInteger((int)parser.retrieveXRefOffset()));
        addXRefEntry(
          xrefStreamEntry,
          xrefStreamIndirectObject,
          xrefStream,
          null
View Full Code Here

      // 2. Body.
      // Update its entries:
      PdfDictionary trailer = file.getTrailer();
      // * Size
      trailer.put(PdfName.Size,new PdfInteger(xrefSize));
      // * Prev
      if(parser == null)
      {trailer.remove(PdfName.Prev);} // [FIX:0.0.4:5] It (wrongly) kept the 'Prev' entry of multiple-section xref tables.
      else
      {trailer.put(PdfName.Prev,new PdfInteger((int)parser.retrieveXRefOffset()));}
      // Serialize its contents!
      trailer.writeTo(stream); stream.write(Chunk.LineFeed);

      // 3. Tail.
      writeTail(startxref);
View Full Code Here

    if(reference == null)
      return null;

    PdfDictionary dataObject = (PdfDictionary)reference.getDataObject();
    PdfName fieldType = (PdfName)dataObject.get(PdfName.FT);
    PdfInteger fieldFlags = (PdfInteger)dataObject.get(PdfName.Ff);
    int fieldFlagsValue = (fieldFlags == null ? 0 : fieldFlags.getRawValue());
    if(fieldType.equals(PdfName.Btn)) // Button.
    {
      if((fieldFlagsValue & FlagsEnum.Pushbutton.getCode()) > 0) // Pushbutton.
        return new PushButton(reference);
      else if((fieldFlagsValue & FlagsEnum.Radio.getCode()) > 0) // Radio.
View Full Code Here

TOP

Related Classes of org.pdfclown.objects.PdfInteger

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.