Examples of PRStream


Examples of com.itextpdf.text.pdf.PRStream

   * @param parser  the OCGParser
   * @param page    the page dictionary of the page that needs to be parsed.
   * @throws IOException
   */
  private void parse(OCGParser parser, PdfDictionary page) throws IOException {
    PRStream stream = (PRStream)page.getAsStream(PdfName.CONTENTS);
    PdfDictionary resources = page.getAsDict(PdfName.RESOURCES);
    parser.parse(stream, resources);
  }
View Full Code Here

Examples of com.itextpdf.text.pdf.PRStream

    public void parse(PRStream stream, PdfDictionary resources) throws IOException {
      baos = new ByteArrayOutputStream();
      properties = resources.getAsDict(PdfName.PROPERTIES);
      xobj = new HashSet<PdfName>();
      PdfDictionary xobjects = resources.getAsDict(PdfName.XOBJECT);
      PRStream xobject;
      PdfDictionary oc;
      PdfString ocname;
    if (xobjects != null) {
      // remove XObject (form or image) that belong to an OCG that needs to be removed
      for (PdfName name : xobjects.getKeys()) {
        xobject = (PRStream)xobjects.getAsStream(name);
        oc = xobject.getAsDict(PdfName.OC);
        if (oc != null) {
          ocname = oc.getAsString(PdfName.NAME);
          if (ocname != null && ocgs.contains(ocname.toString())) {
            xobj.add(name);
          }
View Full Code Here

Examples of com.lowagie.text.pdf.PRStream

      return;
    File fLast = new File(fn.toUnicodeString());
    File fullPath = new File(outPath, fLast.getName());
    if (fullPath.exists())
      return;
    PRStream prs = (PRStream) PdfReader.getPdfObject(ef.get(PdfName.F));
    if (prs == null)
      return;
    byte b[] = PdfReader.getStreamBytes(prs);
    FileOutputStream fout = new FileOutputStream(fullPath);
    fout.write(b);
View Full Code Here

Examples of com.lowagie.text.pdf.PRStream

                  }else{
                    LOG.warn("Cannot overwrite "+fullPath.getAbsolutePath()+" (overwrite is false), unable to unpack.");
                  }   
            }       
          else{
            PRStream prs = (PRStream) PdfReader.getPdfObject(ef.get(PdfName.F));
            if (prs != null){
              byte b[] = PdfReader.getStreamBytes(prs);
              FileOutputStream fout = new FileOutputStream(fullPath);
              fout.write(b);
              fout.close();
View Full Code Here

Examples of com.lowagie.text.pdf.PRStream

    PdfObject contents = PdfReader.getPdfObject(page.get(PdfName.CONTENTS));
    if (contents != null) {
      this.add(new StreamTreeNode(contents, "Content"));
      if (contents.isStream()) {
        PRStream page_content = (PRStream) contents;

        Set s = page_content.getKeys();
        Iterator it = s.iterator();

        while (it.hasNext()) {
          Object obj = it.next();
          System.out.println("Field:" + obj);
          Object value = PdfReader.getPdfObject(page_content.get((PdfName) obj));
          System.out.println("Value:" + value);
        }
      }
    }
  }
View Full Code Here

Examples of com.lowagie.text.pdf.PRStream

    this.marker = marker;
  }

  public void updateview(UpdateNodeView updateobject) {
    if (contents.isStream()) {
      PRStream content_stream = (PRStream) contents;
      try {
        byte content[] = PdfReader.getStreamBytes(content_stream);
        updateobject.showtext(new String(content));
      } catch (IOException ex) {
      }
View Full Code Here

Examples of com.lowagie.text.pdf.PRStream

      return;
    File fLast = new File(fn.toUnicodeString());
    File fullPath = new File(outPath, fLast.getName());
    if (fullPath.exists())
      return;
    PRStream prs = (PRStream) PdfReader.getPdfObject(ef.get(PdfName.F));
    if (prs == null)
      return;
    byte b[] = PdfReader.getStreamBytes(prs);
    FileOutputStream fout = new FileOutputStream(fullPath);
    fout.write(b);
View Full Code Here

Examples of com.lowagie.text.pdf.PRStream

      return;
    File fLast = new File(fn.toUnicodeString());
    File fullPath = new File(outPath, fLast.getName());
    if (fullPath.exists())
      return;
    PRStream prs = (PRStream) PdfReader.getPdfObject(ef.get(PdfName.F));
    if (prs == null)
      return;
    byte b[] = PdfReader.getStreamBytes(prs);
    FileOutputStream fout = new FileOutputStream(fullPath);
    fout.write(b);
View Full Code Here

Examples of com.lowagie.text.pdf.PRStream

   * @throws IOException  usual exception when there's a problem writing to an OutputStream
   */
  public void writeTo(OutputStream os) throws IOException {
    Enumeration children = this.children();
    FormTreeNode node;
    PRStream stream;
    String key = null;
    String tmp = null;
    while (children.hasMoreElements()) {
      node = (FormTreeNode) children.nextElement();
      if (key != null) {
View Full Code Here

Examples of com.lowagie.text.pdf.PRStream

   * Renders the content stream of a PdfObject or empties the text area.
   * @param object  the object of which the content stream needs to be rendered
   */
  public void render(PdfObject object) {
    if (object instanceof PRStream) {
      PRStream stream = (PRStream)object;
      try {
        TextAreaOutputStream taos = new TextAreaOutputStream(text);
        taos.write(PdfReader.getStreamBytes(stream));
        //text.addMouseListener(new StreamEditorAction(stream));
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.