Examples of PDFFormXObject


Examples of org.apache.fop.pdf.PDFFormXObject

        if (uri.length() > 0) {
            uri = URISpecification.getURL(uri);
            ImageSize imgSize = renderer.getImageSize(uri);

            String xFormKey = "3D_Overlay_XForm_" + uri;
            PDFFormXObject xForm = (PDFFormXObject) pdfi.pdfDoc
                .getXObject(xFormKey);
            if (xForm == null) {
                // Form XObject content stream
                PDFStream xFormStream = pdfi.factory.makeStream(
                    PDFFilterList.CONTENT_FILTER, false);

                // locate the image with the upper left corner
                Rectangle2D pos = new Rectangle2D.Double(0, 0, imgSize
                    .getWidthMpt(), imgSize.getHeightMpt());

                // Adds the image to the PDF document
                renderer.addImageXObject(uri, pos, xFormStream);

                // Resource context
                PDFResourceContext resContext = (PDFResourceContext) ctx
                    .getProperty(PDFRendererContextConstants.PDF_CONTEXT);

                // Try to get a already added image with the same key
                PDFXObject xObj = pdfi.pdfDoc.getXObject(uri);

                PDFReference xFormResRef = null;
                if (xObj != null) {
                    // e.g. Form XObject's resources aren't used for svg images
                    // (svg images are drawn directly to the stream)
                    PDFResources xFormRes = pdfi.factory.makeResources();
                    xFormRes.addXObject(xObj);
                    xFormResRef = xFormRes.makeReference();
                }

                // Build new Form XObject
                xForm = pdfi.pdfDoc.addFormXObject(resContext, xFormStream,
                    xFormResRef, xFormKey);

                // Setup bounding box for the Form XObject
                // We set this to the dimensions of the image overlay.
                xForm.setBBox(new Rectangle2D.Double(0.0d, 0.0d,
                    (double) imgSize.getWidthMpt() / 1000d, (double) imgSize
                        .getHeightMpt() / 1000d));
            }
            // Add the newly created Form XObject to the 3D annotation.
            // (as a "normal" appearance, used if the 3d artwork is disabled)
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.