PdfDictionary names = root.getAsDict(PdfName.NAMES); System.out.println("****names names *********" + names.getKeys().toString()); PdfDictionary embedded = names.getAsDict(PdfName.EMBEDDEDFILES); System.out.println("####embedded embedded ########" + embedded.toString()); PdfArray filespecs =null; filespecs=embedded.getAsArray(PdfName.NAMES);//all pdfs null in case of large no of pdfs
PageStamp(PdfStamperImp stamper, PdfReader reader, PdfDictionary pageN) { this.pageN = pageN; pageResources = new PageResources(); PdfDictionary resources = pageN.getAsDict(PdfName.RESOURCES); pageResources.setOriginalResources(resources, stamper.namePtr); } }
public void invoke(PdfContentStreamProcessor processor, PdfLiteral operator, ArrayList operands) { PdfName fontResourceName = (PdfName)operands.get(0); float size = ((PdfNumber)operands.get(1)).floatValue(); PdfDictionary fontsDictionary = processor.resources.getAsDict(PdfName.FONT); CMapAwareDocumentFont font = new CMapAwareDocumentFont((PRIndirectReference)fontsDictionary.get(fontResourceName)); processor.gs().font = font; processor.gs().fontSize = size; } }
PageStamp(PdfStamperImp stamper, PdfReader reader, PdfDictionary pageN) { this.pageN = pageN; this.pageResources = new PageResources(); PdfDictionary resources = pageN.getAsDict(PdfName.RESOURCES); this.pageResources.setOriginalResources(resources, stamper.namePtr); } }
public PdfContentByte getOverContent() { if (over == null) { if (pageResources == null) { pageResources = new PageResources(); PdfDictionary resources = pageN.getAsDict(PdfName.RESOURCES); pageResources.setOriginalResources(resources, cstp.namePtr); } over = new PdfCopy.StampContent(cstp, pageResources); } return over; }
public PdfContentByte getOverContent(){ if (over == null) { if (pageResources == null) { pageResources = new PageResources(); PdfDictionary resources = pageN.getAsDict(PdfName.RESOURCES); pageResources.setOriginalResources(resources, cstp.namePtr); } over = new PdfCopy.StampContent(cstp, pageResources); } return over; }
@Override public void invoke(ArrayList<PdfObject> operands, PdfContentStreamHandler handler, PdfDictionary resources) { PdfName fontResourceName = (PdfName) operands.get(0); float size = ((PdfNumber) operands.get(1)).floatValue(); PdfDictionary fontsDictionary = resources.getAsDict(PdfName.FONT); CMapAwareDocumentFont font = new CMapAwareDocumentFont( (PRIndirectReference) fontsDictionary.get(fontResourceName)); handler.gs().font = font; handler.gs().fontSize = size; } }
public PdfContentByte getUnderContent(){ if (under == null) { if (pageResources == null) { pageResources = new PageResources(); PdfDictionary resources = pageN.getAsDict(PdfName.RESOURCES); pageResources.setOriginalResources(resources, cstp.namePtr); } under = new PdfCopy.StampContent(cstp, pageResources); } return under; }
public PdfContentByte getUnderContent(){ if (under == null) { if (pageResources == null) { pageResources = new PageResources(); PdfDictionary resources = pageN.getAsDict(PdfName.RESOURCES); pageResources.setOriginalResources(resources, cstp.namePtr); } under = new PdfCopy.StampContent(cstp, pageResources); } return under; }
public void invoke(PdfContentStreamProcessor processor, PdfLiteral operator, ArrayList operands) { PdfName fontResourceName = (PdfName)operands.get(0); float size = ((PdfNumber)operands.get(1)).floatValue(); PdfDictionary fontsDictionary = processor.resources.getAsDict(PdfName.FONT); CMapAwareDocumentFont font = new CMapAwareDocumentFont((PRIndirectReference)fontsDictionary.get(fontResourceName)); processor.gs().font = font; processor.gs().fontSize = size; } }
public PdfContentByte getUnderContent() { if (under == null) { if (pageResources == null) { pageResources = new PageResources(); PdfDictionary resources = pageN.getAsDict(PdfName.RESOURCES); pageResources.setOriginalResources(resources, cstp.namePtr); } under = new PdfCopy.StampContent(cstp, pageResources); } return under; }
public PdfContentByte getOverContent(){ if (over == null) { if (pageResources == null) { pageResources = new PageResources(); PdfDictionary resources = pageN.getAsDict(PdfName.RESOURCES); pageResources.setOriginalResources(resources, cstp.namePtr); } over = new PdfCopy.StampContent(cstp, pageResources); } return over; }
PdfReader reader = new PdfReader(src); // We assume that there's a single large picture on the first page PdfDictionary page = reader.getPageN(1); PdfDictionary resources = page.getAsDict(PdfName.RESOURCES); PdfDictionary xobjects = resources.getAsDict(PdfName.XOBJECT); PdfName imgName = xobjects.getKeys().iterator().next(); Image img = Image.getInstance((PRIndirectReference)xobjects.getAsIndirectObject(imgName)); img.setAbsolutePosition(0, 0); img.scaleAbsolute(reader.getPageSize(1)); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest)); stamper.getOverContent(1).addImage(img); stamper.close(); reader.close();
/** * Gets the text from a page. * @param page the page number of the page * @return a String with the content as plain text (without PDF syntax) * @throws IOException */ public String getTextFromPage(int page) throws IOException { PdfDictionary pageDic = reader.getPageN(page); PdfDictionary resourcesDic = pageDic.getAsDict(PdfName.RESOURCES); extractionProcessor.processContent(getContentBytesForPage(page), resourcesDic); return extractionProcessor.getResultantText(); } }