Package org.pdfclown.documents.contents

Examples of org.pdfclown.documents.contents.Resources


  private PdfName getFontName(
    Font value
    )
  {
    // Ensuring that the font exists within the context resources...
    Resources resources = scanner.getContentContext().getResources();
    FontResources fonts = resources.getFonts();
    // No font resources collection?
    if(fonts == null)
    {
      // Create the font resources collection!
      fonts = new FontResources(scanner.getContents().getDocument());
      resources.setFonts(fonts); resources.update();
    }
    // Get the key associated to the font!
    PdfName name = fonts.getBaseDataObject().getKey(value.getBaseObject());
    // No key found?
    if(name == null)
View Full Code Here


  private PdfName getXObjectName(
    XObject value
    )
  {
    // Ensuring that the external object exists within the context resources...
    Resources resources = scanner.getContentContext().getResources();
    XObjectResources xObjects = resources.getXObjects();
    // No external object resources collection?
    if(xObjects == null)
    {
      // Create the external object resources collection!
      xObjects = new XObjectResources(scanner.getContents().getDocument());
      resources.setXObjects(xObjects); resources.update();
    }
    // Get the key associated to the external object!
    PdfName name = xObjects.getBaseDataObject().getKey(value.getBaseObject());
    // No key found?
    if(name == null)
View Full Code Here

    header.put(PdfName.BBox,new Rectangle(0,0,0,0).getBaseDataObject());

    // No resources collection?
    /* NOTE: Resources collection is mandatory. */
    if(resources == null)
    {resources = new Resources(context);}
    header.put(PdfName.Resources,resources.getBaseObject());
  }
View Full Code Here

    // 1. Set default page size (A4)!
    document.setPageSize(PageFormat.getSize());

    // 2. Setting the document resources...
    // 2.1. Resources collection.
    Resources resources = new Resources(document); // Instantiates the resources collection inside the document context.
    document.setResources(resources); // Puts the resources collection in the common resources role.
    // 2.2. Fonts collection.
    FontResources fonts = new FontResources(document); // Instantiates the fonts collection inside the document context.
    resources.setFonts(fonts); // Puts the fonts collection in the common resources role.
    // Add a font to the fonts collection!
    fonts.put(
      ResourceName_DefaultFont,
      new StandardType1Font(
        document,
View Full Code Here

    // Default page size.
    setPageSize(PageFormat.getSize());

    // Default resources collection.
    setResources(new Resources(this));
  }
View Full Code Here

    // Add the image to the document!
    XObject imageXObject = image.toXObject(document); // XObject (i.e. external object) is, in PDF spec jargon, a reusable object.
    // Looking for images to replace...
    for(Page page : document.getPages())
    {
      Resources resources = page.getResources();
      XObjectResources xObjects = resources.getXObjects();
      if(xObjects == null)
        continue;

      for(PdfName xObjectKey : xObjects.keySet())
      {
View Full Code Here

    System.out.println(" Content head:");
    printContentObjects(contents,0,0);

    // 3. Showing page resources information...
    {
      Resources resources = page.getResources();
      System.out.println(" Resources:");
      Map<PdfName, ? extends PdfObjectWrapper<?>> subResources;
     
      subResources = resources.getFonts();
      if(subResources != null)
      {System.out.println("  Font count: " + subResources.size());}

      subResources = resources.getXObjects();
      if(subResources != null)
      {System.out.println("  XObjects count: " + subResources.size());}

      subResources = resources.getColorSpaces();
      if(subResources != null)
      {System.out.println("  ColorSpaces count: " + subResources.size());}
    }
  }
View Full Code Here

TOP

Related Classes of org.pdfclown.documents.contents.Resources

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.