Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfDictionary


     * @param ref the reference to the image dictionary
     * @throws BadElementException on error
     * @return the image
     */
    public static Image getInstance(final PRIndirectReference ref) throws BadElementException {
        PdfDictionary dic = (PdfDictionary)PdfReader.getPdfObjectRelease(ref);
        int width = ((PdfNumber)PdfReader.getPdfObjectRelease(dic.get(PdfName.WIDTH))).intValue();
        int height = ((PdfNumber)PdfReader.getPdfObjectRelease(dic.get(PdfName.HEIGHT))).intValue();
        Image imask = null;
        PdfObject obj = dic.get(PdfName.SMASK);
        if (obj != null && obj.isIndirect()) {
            imask = getInstance((PRIndirectReference)obj);
        }
        else {
            obj = dic.get(PdfName.MASK);
            if (obj != null && obj.isIndirect()) {
                PdfObject obj2 = PdfReader.getPdfObjectRelease(obj);
                if (obj2 instanceof PdfDictionary)
                    imask = getInstance((PRIndirectReference)obj);
            }
View Full Code Here


     * @return the provided renderListener
     * @throws IOException if operations on the reader fail
     */
   
    public <E extends RenderListener> E processContent(int pageNumber, E renderListener) throws IOException{
        PdfDictionary pageDic = reader.getPageN(pageNumber);
        PdfDictionary resourcesDic = pageDic.getAsDict(PdfName.RESOURCES);
       
        PdfContentStreamProcessor processor = new PdfContentStreamProcessor(renderListener);
        processor.processContent(ContentByteUtils.getContentBytesForPage(reader, pageNumber), resourcesDic);       
        return renderListener;

View Full Code Here

     * @return  a byte array with the effective content stream of a page
     * @throws IOException
     * @since 5.0.1
     */
    public static byte[] getContentBytesForPage(PdfReader reader, int pageNum) throws IOException {
        final PdfDictionary pageDictionary = reader.getPageN(pageNum);
        final PdfObject contentObject = pageDictionary.get(PdfName.CONTENTS);
        if (contentObject == null)
            return new byte[0];
       
        final byte[] contentBytes = ContentByteUtils.getContentBytesFromContentObject(contentObject);
        return contentBytes;
View Full Code Here

   * @param  d    the default
   * @param  max    the maximum
   * @param  min    the minimum
   */
  private PdfDictionary createDimensionDictionary(float d, float max, float min) {
    PdfDictionary dict = new PdfDictionary();
    dict.put(PdfName.DEFAULT, new PdfNumber(d));
    dict.put(PdfName.MAX_CAMEL_CASE, new PdfNumber(max));
    dict.put(PdfName.MIN_CAMEL_CASE, new PdfNumber(min));
    return dict;
  }
View Full Code Here

   */
  public RichMediaAnnotation(PdfWriter writer, Rectangle rect) {
    this.writer = writer;
    annot = new PdfAnnotation(writer, rect);
        annot.put(PdfName.SUBTYPE, PdfName.RICHMEDIA);
        richMediaContent = new PdfDictionary(PdfName.RICHMEDIACONTENT);
    assetsmap = new HashMap<String, PdfIndirectReference>();
    configurations = new PdfArray();
    views = new PdfArray();
  }
View Full Code Here

   * @return  a PdfAnnotation
   */
  public PdfAnnotation createAnnotation() throws IOException {
    if (richMediaContent != null) {
      if (!assetsmap.isEmpty()) {
        PdfDictionary assets = PdfNameTree.writeTree(assetsmap, writer);
        richMediaContent.put(PdfName.ASSETS, writer.addToBody(assets).getIndirectReference());
      }
      if (configurations.size() > 0) {
        richMediaContent.put(PdfName.CONFIGURATION, writer.addToBody(configurations).getIndirectReference());
      }
View Full Code Here

  public void setPrefix(String key, String prefix) {
    PdfName fieldname = new PdfName(key);
    PdfObject o = get(fieldname);
    if (o == null)
      throw new IllegalArgumentException(MessageLocalization.getComposedMessage("you.must.set.a.value.before.adding.a.prefix"));
    PdfDictionary dict = new PdfDictionary(PdfName.COLLECTIONSUBITEM);
    dict.put(PdfName.D, o);
    dict.put(PdfName.P, new PdfString(prefix, PdfObject.TEXT_UNICODE));
    put(fieldname, dict);
  }
View Full Code Here

   * @see com.itextpdf.text.pdf.interfaces.PdfVersion#addDeveloperExtension(com.itextpdf.text.pdf.PdfDeveloperExtension)
   * @since  2.1.6
   */
  public void addDeveloperExtension(PdfDeveloperExtension de) {
    if (extensions == null) {
      extensions = new PdfDictionary();
    }
    else {
      PdfDictionary extension = extensions.getAsDict(de.getPrefix());
      if (extension != null) {
        int diff = de.getBaseversion().compareTo(extension.getAsName(PdfName.BASEVERSION));
        if (diff < 0)
          return;
        diff = de.getExtensionLevel() - extension.getAsNumber(PdfName.EXTENSIONLEVEL).intValue();
        if (diff <= 0)
          return;
      }
    }
    extensions.put(de.getPrefix(), de.getDeveloperExtensions());
View Full Code Here

    preferences.setViewerPreferences(prefs);
    // other preferences
    obj = PdfReader.getPdfObjectRelease(catalog
        .get(PdfName.VIEWERPREFERENCES));
    if (obj != null && obj.isDictionary()) {
      PdfDictionary vp = (PdfDictionary) obj;
      for (int i = 0; i < VIEWER_PREFERENCES.length; i++) {
        obj = PdfReader.getPdfObjectRelease(vp.get(VIEWER_PREFERENCES[i]));
        preferences.addViewerPreference(VIEWER_PREFERENCES[i], obj);
      }
    }
    return preferences;
  }
View Full Code Here

    }
   
    public void completeExtraCatalog(PdfDictionary extraCatalog) {
        if (isPdfX() && !isPdfA1()) {
            if (extraCatalog.get(PdfName.OUTPUTINTENTS) == null) {
                PdfDictionary out = new PdfDictionary(PdfName.OUTPUTINTENT);
                out.put(PdfName.OUTPUTCONDITION, new PdfString("SWOP CGATS TR 001-1995"));
                out.put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString("CGATS TR 001"));
                out.put(PdfName.REGISTRYNAME, new PdfString("http://www.color.org"));
                out.put(PdfName.INFO, new PdfString(""));
                out.put(PdfName.S, PdfName.GTS_PDFX);
                extraCatalog.put(PdfName.OUTPUTINTENTS, new PdfArray(out));
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.PdfDictionary

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.