private synchronized void init() throws TranscoderException { if (!initialized) { if (transcoderInput == null) { throw new IllegalStateException("input == null"); } initialized = true; super.transcode(transcoderInput, null); } }
@Override public void setImageSize(float docWidth, float docHeight) { super.setImageSize(docWidth, docHeight); }
/** * Creates the default SVG 1.0/1.1 BridgeContext. Subclass this method to provide * customized bridges. This method is provided for historical reasons. New applications * should use {@link #createBridgeContext(String)} instead. * @return the newly instantiated BridgeContext * @see #createBridgeContext(String) */ protected BridgeContext createBridgeContext() { return createBridgeContext("1.x"); }
ctx = createBridgeContext(svgDoc); float docHeight = (float)ctx.getDocumentSize().getHeight(); setImageSize(docWidth, docHeight); CanvasGraphicsNode cgn = getCanvasGraphicsNode(gvtRoot); if (cgn != null) { cgn.setViewingTransform(Px);
protected SVGAbstractTranscoder() { userAgent = createUserAgent(); hints.put(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, SVGConstants.SVG_NAMESPACE_URI); hints.put(KEY_DOCUMENT_ELEMENT, SVGConstants.SVG_SVG_TAG); hints.put(KEY_DOM_IMPLEMENTATION, SVGDOMImplementation.getDOMImplementation()); hints.put(KEY_MEDIA, "screen"); hints.put(KEY_DEFAULT_FONT_FAMILY, DEFAULT_DEFAULT_FONT_FAMILY); hints.put(KEY_EXECUTE_ONLOAD, Boolean.FALSE); hints.put(KEY_ALLOWED_SCRIPT_TYPES, DEFAULT_ALLOWED_SCRIPT_TYPES); }
ctx = createBridgeContext(svgDoc); float docHeight = (float)ctx.getDocumentSize().getHeight(); setImageSize(docWidth, docHeight); CanvasGraphicsNode cgn = getCanvasGraphicsNode(gvtRoot); if (cgn != null) { cgn.setViewingTransform(Px);
protected SVGAbstractTranscoder() { userAgent = createUserAgent(); hints.put(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, SVGConstants.SVG_NAMESPACE_URI); hints.put(KEY_DOCUMENT_ELEMENT, SVGConstants.SVG_SVG_TAG); hints.put(KEY_DOM_IMPLEMENTATION, SVGDOMImplementation.getDOMImplementation()); hints.put(KEY_MEDIA, "screen"); hints.put(KEY_DEFAULT_FONT_FAMILY, DEFAULT_DEFAULT_FONT_FAMILY); hints.put(KEY_EXECUTE_ONLOAD, Boolean.FALSE); hints.put(KEY_ALLOWED_SCRIPT_TYPES, DEFAULT_ALLOWED_SCRIPT_TYPES); }
/** * Transcodes the specified Document as an image in the specified output. * * @param document the document to transcode * @param uri the uri of the document or null if any * @param output the ouput where to transcode * @exception TranscoderException if an error occured while transcoding */ protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { super.transcode(document, uri, output); // We do this to hide 'ctx' from the SVGAbstractTranscoder // otherwise it will dispose of the context before we can // print the document. theCtx = ctx; ctx = null; } /**
/** * Sets document size according to the hints. * Global variables width and height are modified. * * @param docWidth Width of the document. * @param docHeight Height of the document. */ protected void setImageSize(float docWidth, float docHeight) { // Check hint to know if scaling is really needed Boolean scaleToPage = (Boolean)hints.get(KEY_SCALE_TO_PAGE); if(scaleToPage != null && !scaleToPage.booleanValue()) { float w = docWidth; float h = docHeight; if (hints.containsKey(KEY_AOI)) { Rectangle2D aoi = (Rectangle2D)hints.get(KEY_AOI); w = (float)aoi.getWidth(); h = (float)aoi.getHeight(); } super.setImageSize(w, h); } }
/** * Creates the default SVG 1.0/1.1 BridgeContext. Subclass this method to provide * customized bridges. This method is provided for historical reasons. New applications * should use {@link #createBridgeContext(String)} instead. * @return the newly instantiated BridgeContext * @see #createBridgeContext(String) */ protected BridgeContext createBridgeContext() { return createBridgeContext("1.x"); }
/** * Transcodes the specified Document as an image in the specified output. * * @param document the document to transcode * @param uri the uri of the document or null if any * @param output the ouput where to transcode * @exception TranscoderException if an error occured while transcoding */ protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { super.transcode(document, uri, output); // We do this to hide 'ctx' from the SVGAbstractTranscoder // otherwise it will dispose of the context before we can // print the document. theCtx = ctx; ctx = null; } /**
/** * Sets document size according to the hints. * Global variables width and height are modified. * * @param docWidth Width of the document. * @param docHeight Height of the document. */ protected void setImageSize(float docWidth, float docHeight) { // Check hint to know if scaling is really needed Boolean scaleToPage = (Boolean)hints.get(KEY_SCALE_TO_PAGE); if(scaleToPage != null && !scaleToPage) { float w = docWidth; float h = docHeight; if (hints.containsKey(KEY_AOI)) { Rectangle2D aoi = (Rectangle2D)hints.get(KEY_AOI); w = (float)aoi.getWidth(); h = (float)aoi.getHeight(); } super.setImageSize(w, h); } }
/** * Factory method for constructing an configuring a * BridgeContext so subclasses can insert new/modified * bridges in the context. * @param doc the SVG document to create the BridgeContext for * @return the newly instantiated BridgeContext */ protected BridgeContext createBridgeContext(SVGOMDocument doc) { return createBridgeContext(doc.isSVG12() ? "1.2" : "1.x"); }
private synchronized void init() throws TranscoderException { if (!initialized) { if (transcoderInput == null) { throw new IllegalStateException("input == null"); } initialized = true; super.transcode(transcoderInput, null); } }
/** * Factory method for constructing an configuring a * BridgeContext so subclasses can insert new/modified * bridges in the context. * @param doc the SVG document to create the BridgeContext for * @return the newly instantiated BridgeContext */ protected BridgeContext createBridgeContext(SVGOMDocument doc) { return createBridgeContext(doc.isSVG12() ? "1.2" : "1.x"); }
@Override protected void transcode(Document svg, String uri, TranscoderOutput out) throws TranscoderException { // Note: We have to initialize user agent here and not in ::createUserAgent() as method // is called before our constructor is called in the super constructor. this.userAgent = new OpenHtmlUserAgent(this.fontResolver); super.transcode(svg, uri, out); outputDevice.drawWithGraphics((float)x, (float)y, width, height, new OutputDeviceGraphicsDrawer() { @Override public void render(Graphics2D graphics2D) { /* * Do the real paint */ PDFTranscoder.this.root.paint(graphics2D); } }); }
width = (int)pageFormat.getImageableWidth(); height = (int)pageFormat.getImageableHeight(); super.transcode ((TranscoderInput)printedInputs.get(pageIndex),null); curIndex = pageIndex;
width = (int)pageFormat.getImageableWidth(); height = (int)pageFormat.getImageableHeight(); super.transcode ((TranscoderInput)printedInputs.get(pageIndex),null); curIndex = pageIndex;
super.transcode(document, uri, output);
super.transcode(document, uri, output);