Package org.apache.pdfbox.pdmodel

Examples of org.apache.pdfbox.pdmodel.PDResources


   * @return
   * @throws ValidationException
   */
  protected boolean validateTransparency(PDPage page, DocumentHandler handler,
      List<ValidationError> result) throws ValidationException {
    PDResources resources = page.getResources();
    COSDocument cDoc = handler.getDocument().getDocument();
    ExtGStateContainer extGStates = new ExtGStateContainer(resources
        .getCOSDictionary(), cDoc);
    return extGStates.validateTransparencyRules(result);
    // ---- Even if a Group entry is possible in the Page dictionary, No
    // restrictions are defined by PDF/A
  }
View Full Code Here


   * @throws ValidationException
   */
  protected boolean validateShadingPattern(PDPage page,
      DocumentHandler handler, List<ValidationError> result)
      throws ValidationException {
    PDResources resources = page.getResources();
    COSDictionary shadings = (COSDictionary) resources.getCOSDictionary()
        .getDictionaryObject(PATTERN_KEY_SHADING);
    boolean res = true;
    if (shadings != null) {
      for (Object key : shadings.keySet()) {
        COSDictionary aShading = (COSDictionary) shadings
View Full Code Here

    try {
      COSDictionary res = (COSDictionary) pattern
          .getDictionaryObject(DICTIONARY_KEY_RESOURCES);
      resetEnginContext();
      processSubStream(null, new PDResources(res), pattern);
    } catch (ContentStreamException e) {
      errors.add(new ValidationError(e.getValidationError(), e.getMessage()));
    } catch (IOException e) {
      throw new ValidationException("Unable to check the ContentStream : "
          + e.getMessage(), e);
View Full Code Here

        } else {
          try {
            // --- Parse the Glyph description to obtain the Width
            PDFAType3StreamParser parser = new PDFAType3StreamParser(
                this.handler);
            PDResources pRes = null;
            if (this.resources != null) {
              COSDictionary resAsDict = COSUtils.getAsDictionary(
                  this.resources, cDoc);
              if (resAsDict != null) {
                pRes = new PDResources(resAsDict);
              }
            }
            parser.resetEngine();
            parser.processSubStream(null, pRes, charStream);
View Full Code Here

        graphics.setRenderingHint( RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON );
        // Only if there is some content, we have to process it.
        // Otherwise we are done here and we will produce an empty page
        if ( page.getContents() != null)
        {
            PDResources resources = page.findResources();
            processStream( page, resources, page.getContents().getStream() );
        }
        List annotations = page.getAnnotations();
        for( int i=0; i<annotations.size(); i++ )
        {
View Full Code Here

     * @throws IOException If there is an IO error while attempting to find the appropriate PDShading object.
     */
    private PDShading FindShadingDictionary(COSName ShadingName) throws IOException
    {
       
        PDResources resources = (PDResources)page.getResources();
               
        COSDictionary AllShadings = (COSDictionary)(resources.getCOSDictionary().getDictionaryObject(COSName.SHADING));
       
        PDShading Shading = new PDShading(ShadingName, (COSDictionary)(AllShadings.getDictionaryObject(ShadingName)));
       
        return Shading;
       
View Full Code Here

        if(xobject instanceof PDXObjectForm)
        {
            PDXObjectForm form = (PDXObjectForm)xobject;
            COSStream formContentstream = form.getCOSStream();
            // find some optional resources, instead of using the current resources
            PDResources pdResources = form.getResources();
            getContext().processSubStream( context.getCurrentPage(), pdResources, formContentstream );
        }
    }
View Full Code Here

        graphics.setRenderingHint( RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON );
        // Only if there is some content, we have to process it.
        // Otherwise we are done here and we will produce an empty page
        if ( page.getContents() != null)
        {
            PDResources resources = page.findResources();
            processStream( page, resources, page.getContents().getStream() );
        }
        List annotations = page.getAnnotations();
        for( int i=0; i<annotations.size(); i++ )
        {
View Full Code Here

    private PDFont getFontAndUpdateResources( List tokens, PDAppearanceStream appearanceStream ) throws IOException
    {

        PDFont retval = null;
        PDResources streamResources = appearanceStream.getResources();
        PDResources formResources = acroForm.getDefaultResources();
        if( formResources != null )
        {
            if( streamResources == null )
            {
                streamResources = new PDResources();
                appearanceStream.setResources( streamResources );
            }

            COSString da = getDefaultAppearance();
            if( da != null )
            {
                String data = da.getString();
                PDFStreamParser streamParser = new PDFStreamParser(
                        new ByteArrayInputStream( data.getBytes("ISO-8859-1") ), null );
                streamParser.parse();
                tokens = streamParser.getTokens();
            }

            int setFontIndex = tokens.indexOf( PDFOperator.getOperator( "Tf" ));
            COSName cosFontName = (COSName)tokens.get( setFontIndex-2 );
            String fontName = cosFontName.getName();
            retval = (PDFont)streamResources.getFonts().get( fontName );
            if( retval == null )
            {
                retval = (PDFont)formResources.getFonts().get( fontName );
                streamResources.addFont(retval, fontName);
            }
        }
        return retval;
    }
View Full Code Here

                getGraphicsStack().push( (PDGraphicsState)getGraphicsState().clone() );
                PDPage page = getCurrentPage();
               
                PDXObjectForm form = (PDXObjectForm)xobject;
                COSStream invoke = (COSStream)form.getCOSObject();
                PDResources pdResources = form.getResources();
                if(pdResources == null)
                {
                    pdResources = page.findResources();
                }
                // if there is an optional form matrix, we have to
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.pdmodel.PDResources

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.