public PDStream getContentStream() { return new PDStream(charStream); }
/** * Creates an Image XObject in the given document. This constructor is for internal PDFBox use * and is not for PDF generation. Users who want to create images should look at {@link #createFromFileByExtension(File, PDDocument) * }. * * @param document the current document * @throws java.io.IOException if there is an error creating the XObject. */ public PDImageXObject(PDDocument document) throws IOException { this(new PDStream(document), null); }
@Override public void createImageFormStream(PDDocument template) { PDStream imageFormStream = new PDStream(template); pdfStructure.setImageFormStream(imageFormStream); LOG.info("Created image form stream"); }
/** * Creates a thumbnail Image XObject from the given COSBase and name. * @param cosStream the COS stream * @return an XObject * @throws IOException if there is an error creating the XObject. */ public static PDImageXObject createThumbnail(COSStream cosStream) throws IOException { // thumbnails are special, any non-null subtype is treated as being "Image" PDStream pdStream = new PDStream(cosStream); return new PDImageXObject(pdStream, null); }
@Override public void createInnerFormStream(PDDocument template) { PDStream innerFormStream = new PDStream(template); pdfStructure.setInnterFormStream(innerFormStream); LOG.info("Stream of another form (inner form - it will be inside holder form) " + "has been created"); }
@Override public void createHolderFormStream(PDDocument template) { PDStream holderForm = new PDStream(template); pdfStructure.setHolderFormStream(holderForm); LOG.info("Holder form stream has been created"); }
public PDStream getContentStream() { return new PDStream(getCOSObject()); }
public PDStream getContentStream() { return new PDStream((COSStream)getCOSObject()); }
/** * A stream containing a true type font program. * * @return A stream containing a true type font program. */ public PDStream getFontFile2() { PDStream retval = null; COSBase obj = dic.getDictionaryObject(COSName.FONT_FILE2); if (obj instanceof COSStream) { retval = new PDStream((COSStream) obj); } return retval; }
private String getPartialStreamCommand(final int indexOfStopFilter) { List<COSName> avaiablrFilters = new PDStream(stream).getFilters(); StringBuilder nameListBuilder = new StringBuilder(); for (int i = indexOfStopFilter; i < avaiablrFilters.size(); i++) { nameListBuilder.append(avaiablrFilters.get(i).getName()).append(" & "); } nameListBuilder.delete(nameListBuilder.lastIndexOf("&"), nameListBuilder.length()); return "Keep " + nameListBuilder.toString() + "..."; }
/** * Get the CIDSet stream. * * @return A stream containing a CIDSet. */ public PDStream getCIDSet() { COSObjectable cidSet = dic.getDictionaryObject(COSName.CID_SET); if (cidSet instanceof COSStream) { return new PDStream((COSStream) cidSet); } return null; }
/** * A stream containing a Type 1 font program. * * @return A stream containing a Type 1 font program. */ public PDStream getFontFile() { PDStream retval = null; COSBase obj = dic.getDictionaryObject(COSName.FONT_FILE); if (obj instanceof COSStream) { retval = new PDStream((COSStream) obj); } return retval; }
/** * A stream containing a font program that is not true type or type 1. * * @return A stream containing a font program. */ public PDStream getFontFile3() { PDStream retval = null; COSBase obj = dic.getDictionaryObject(COSName.FONT_FILE3); if (obj instanceof COSStream) { retval = new PDStream((COSStream) obj); } return retval; }
private List<String> getStopFilterList(final int stopFilterIndex) { List<COSName> avaiablrFilters = new PDStream(stream).getFilters(); final List<String> stopFilters = new ArrayList<>(1); stopFilters.add(avaiablrFilters.get(stopFilterIndex).getName()); return stopFilters; }
/** * produce possible partially decoded stream saving menu items * @param cosStream stream to save * @return JMenuItems for saving partially decoded streams */ private List<JMenuItem> getPartiallyDecodedStreamSaveMenu(final COSStream cosStream) { List<JMenuItem> menuItems = new ArrayList<>(); PDStream stream = new PDStream(cosStream); List<COSName> filters = stream.getFilters(); for (int i = filters.size() - 1; i >= 1; i--) { menuItems.add(getPartialStreamSavingMenuItem(i, stream)); } return menuItems; }
/** * Returns the Soft Mask Image XObject associated with this image, or null if there is none. * @return the SMask Image XObject, or null. * @throws java.io.IOException */ public PDImageXObject getSoftMask() throws IOException { COSStream cosStream = (COSStream) getCOSObject().getDictionaryObject(COSName.SMASK); if (cosStream != null) { // always DeviceGray return new PDImageXObject(new PDStream(cosStream), null); } return null; }
private PDStream configureOutputProfile(PDDocument doc, InputStream colorProfile) throws IOException { ICC_Profile icc = ICC_Profile.getInstance(colorProfile); PDStream stream = new PDStream(doc, new ByteArrayInputStream(icc.getData()), COSName.FLATE_DECODE); stream.getCOSObject().setInt(COSName.N, icc.getNumComponents()); return stream; } }
/** * Creates a new ICC color space with an empty stream. * @param doc the document to store the ICC data */ public PDICCBased(PDDocument doc) { array = new COSArray(); array.add(COSName.ICCBASED); stream = new PDStream(doc); array.add(stream); }
/** * Creates a new XObject from the given stream and subtype. * @param stream The stream to read. * @param subtype */ protected PDXObject(COSStream stream, COSName subtype) { this.stream = new PDStream(stream); // could be used for writing: stream.setName(COSName.TYPE, COSName.XOBJECT.getName()); stream.setName(COSName.SUBTYPE, subtype.getName()); }
/** * Creates a new XObject of the given subtype for writing. * @param document The document in which to create the XObject. * @param subtype The subtype of the new XObject. */ protected PDXObject(PDDocument document, COSName subtype) { stream = new PDStream(document); stream.getCOSObject().setName(COSName.TYPE, COSName.XOBJECT.getName()); stream.getCOSObject().setName(COSName.SUBTYPE, subtype.getName()); }