Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfStream


    StringBuilder textBarcodes = new StringBuilder();
    for (int i = 0; i < reader.getXrefSize(); i++) {
      PdfObject pdfobj = reader.getPdfObject(i);
      if (pdfobj != null) {
        if (pdfobj.isStream()) {
          PdfStream stream = (PdfStream) pdfobj;
          PdfObject pdfsubtype = stream.get(PdfName.SUBTYPE);
          if (pdfsubtype != null) {
            if (pdfsubtype.toString().equals(PdfName.IMAGE.toString())) {
              System.out.println("OCR on PDF object " + i);
              getImageFromPageAndAddOcrResultToContent(ocr, pdfContent, barcodes, textBarcodes, ocrName, stream);
            }
View Full Code Here


     * @param xobjectName the name of the XObject to retrieve from the resource dictionary
     */
    private void displayXObject(PdfName xobjectName) throws IOException {
        PdfDictionary xobjects = resources.getAsDict(PdfName.XOBJECT);
        PdfObject xobject = xobjects.getDirectObject(xobjectName);
        PdfStream xobjectStream = (PdfStream)xobject;

        PdfName subType = xobjectStream.getAsName(PdfName.SUBTYPE);
        if (xobject.isStream()){
            XObjectDoHandler handler = xobjectDoHandlers.get(subType);
            if (handler == null)
                handler = xobjectDoHandlers.get(PdfName.DEFAULT);
            handler.handleXObject(this, xobjectStream, xobjects.getAsIndirectObject(xobjectName));
View Full Code Here

          PdfReader reader = new PdfReader(baos.toByteArray());
          for (int j = 0; j < reader.getXrefSize(); j++) {
            PdfObject pdfobj = reader.getPdfObject(j);
            if (pdfobj != null) {
              if (pdfobj.isStream()) {
                PdfStream stream = (PdfStream) pdfobj;
                PdfObject pdfsubtype = stream.get(PdfName.SUBTYPE);
                if (pdfsubtype != null) {
                  if (pdfsubtype.toString().equals(PdfName.IMAGE.toString())) {
                    PdfImageObject image = new PdfImageObject((PRStream) stream);
                    BufferedImage bufferedImage = image.getBufferedImage();
                    if (bufferedImage != null) {
View Full Code Here

       
        PdfDictionary xobjects = resourceDic.getAsDict(PdfName.XOBJECT);
        if (xobjects == null)
          return "No XObjects";
        for (PdfName entryName : xobjects.getKeys()) {
            PdfStream xobjectStream = xobjects.getAsStream(entryName);
           
            sb.append("------ " + entryName + " - subtype = " + xobjectStream.get(PdfName.SUBTYPE) + " = " + xobjectStream.getAsNumber(PdfName.LENGTH) + " bytes ------\n");
           
            if (!xobjectStream.get(PdfName.SUBTYPE).equals(PdfName.IMAGE)){
           
                byte[] contentBytes = ContentByteUtils.getContentBytesFromContentObject(xobjectStream);
               
                InputStream is = new ByteArrayInputStream(contentBytes);
                int ch;
                while ((ch = is.read()) != -1){
                    sb.append((char)ch);
                }
   
                sb.append("------ " + entryName + " - subtype = " + xobjectStream.get(PdfName.SUBTYPE) + "End of Content" + "------\n");
            }
        }
      
        return sb.toString();
    }
View Full Code Here

     * @param xobjectName the name of the XObject to retrieve from the resource dictionary
     */
    private void displayXObject(PdfName xobjectName) throws IOException {
        PdfDictionary xobjects = resources.getAsDict(PdfName.XOBJECT);
        PdfObject xobject = xobjects.getDirectObject(xobjectName);
        PdfStream xobjectStream = (PdfStream)xobject;

        PdfName subType = xobjectStream.getAsName(PdfName.SUBTYPE);
        if (xobject.isStream()){
            XObjectDoHandler handler = xobjectDoHandlers.get(subType);
            if (handler == null)
                handler = xobjectDoHandlers.get(PdfName.DEFAULT);
            handler.handleXObject(this, xobjectStream, xobjects.getAsIndirectObject(xobjectName));
View Full Code Here

TOP

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

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.