View | Details | Raw Unified | Return to bug 24438
Collapse All | Expand All

(-)20.5\org\apache\fop\render\pdf\PDFRenderer.java (-3 / +36 lines)
Lines 376-384 Link Here
376
                closeText();
376
                closeText();
377
377
378
                SVGDocument svg = ((SVGImage) image).getSVGDocument();
378
                SVGDocument svg = ((SVGImage) image).getSVGDocument();
379
                currentStream.add("ET\nq\n");
379
//                currentStream.add("ET\nq\n");
380
                renderSVGDocument(svg, x, y, fs);
380
                renderSVGDocument(svg, x, y, fs);
381
                currentStream.add("Q\nBT\n");
381
//                currentStream.add("Q\nBT\n");
382
            } catch (FopImageException e) {}
382
            } catch (FopImageException e) {}
383
383
384
        } else {
384
        } else {
Lines 537-542 Link Here
537
        // this.currentYPosition -= area.getEffectiveHeight();
537
        // this.currentYPosition -= area.getEffectiveHeight();
538
    }
538
    }
539
539
540
    java.util.Vector pendingSVG = new java.util.Vector();
541
    public class SVGInfo {
542
        public Document d;
543
        public int x;
544
        public int y;
545
        public FontState fs;
546
        public SVGInfo(Document d, int x, int y, FontState fs) {
547
            this.d = d;
548
            this.x = x;
549
            this.y = y;
550
            this.fs = fs;
551
        }
552
    }
540
    /**
553
    /**
541
     * render SVG area to PDF
554
     * render SVG area to PDF
542
     *
555
     *
Lines 546-552 Link Here
546
        // place at the current instream offset
559
        // place at the current instream offset
547
        int x = this.currentXPosition;
560
        int x = this.currentXPosition;
548
        int y = this.currentYPosition;
561
        int y = this.currentYPosition;
549
        renderSVGDocument(area.getSVGDocument(), x, y, area.getFontState());
562
//        renderSVGDocument(area.getSVGDocument(), x, y, area.getFontState());
563
        pendingSVG.add(new SVGInfo(area.getSVGDocument(), x, y, area.getFontState()));
550
    }
564
    }
551
565
552
    /**
566
    /**
Lines 888-893 Link Here
888
        this.pdfDoc.output(outputStream);
902
        this.pdfDoc.output(outputStream);
889
    }
903
    }
890
904
905
906
    private void processPendingBorders() {
907
        for (int i = pendingBorders.size() - 1; i >= 0; i--) {
908
            PrintRenderer.BorderInfo borderInfo = (PrintRenderer.BorderInfo) pendingBorders.remove(i);
909
            addLine(borderInfo.x, borderInfo.y, borderInfo.w, borderInfo.h, borderInfo.width, borderInfo.c);
910
        }
911
    }
912
    private void processPendingSVG() {
913
        for (int i = pendingSVG.size() - 1; i >= 0; i--) {
914
            SVGInfo svgInfo = (SVGInfo) pendingSVG.remove(i);
915
            closeText();
916
            currentStream.add("ET\nq\n");
917
            renderSVGDocument(svgInfo.d, svgInfo.x, svgInfo.y, svgInfo.fs);
918
            currentStream.add("Q\nBT\n");
919
        }
920
    }
891
    /**
921
    /**
892
     * render page into PDF
922
     * render page into PDF
893
     *
923
     *
Lines 904-909 Link Here
904
        renderRegions(page);
934
        renderRegions(page);
905
935
906
        closeText();
936
        closeText();
937
938
        processPendingBorders();
939
        processPendingSVG();
907
940
908
        float w = page.getWidth();
941
        float w = page.getWidth();
909
        float h = page.getHeight();
942
        float h = page.getHeight();
(-)20.5\org\apache\fop\render\PrintRenderer.java (-7 / +48 lines)
Lines 219-224 Link Here
219
        addRect(x, y, w, h, pdfcol, pdfcol);
219
        addRect(x, y, w, h, pdfcol, pdfcol);
220
    }
220
    }
221
221
222
223
    protected java.util.Vector pendingBorders = new java.util.Vector();
224
    public class BorderInfo {
225
        public int x;
226
        public int y;
227
        public int w;
228
        public int h;
229
        public int width;
230
        public PDFColor c;
231
        public BorderInfo(int x, int y, int w, int h, int width, PDFColor c) {
232
            this.x = x;
233
            this.y = y;
234
            this.w = w;
235
            this.h = h;
236
            this.width = width;
237
            this.c = c;
238
        }
239
    }
240
222
    protected void doFrame(Area area) {
241
    protected void doFrame(Area area) {
223
        int w, h;
242
        int w, h;
224
        int rx = this.currentAreaContainerXPosition;
243
        int rx = this.currentAreaContainerXPosition;
Lines 233-240 Link Here
233
        w = w + area.getPaddingLeft() + area.getPaddingRight();
252
        w = w + area.getPaddingLeft() + area.getPaddingRight();
234
        h = h + area.getPaddingTop() + area.getPaddingBottom();
253
        h = h + area.getPaddingTop() + area.getPaddingBottom();
235
254
236
        doBackground(area, rx, ry, w, h);
237
238
        // rx = rx - area.getBorderLeftWidth();
255
        // rx = rx - area.getBorderLeftWidth();
239
        // ry = ry + area.getBorderTopWidth();
256
        // ry = ry + area.getBorderTopWidth();
240
        // w = w + area.getBorderLeftWidth() + area.getBorderRightWidth();
257
        // w = w + area.getBorderLeftWidth() + area.getBorderRightWidth();
Lines 265-283 Link Here
265
        int right = area.getBorderRightWidth();
282
        int right = area.getBorderRightWidth();
266
        int top = area.getBorderTopWidth();
283
        int top = area.getBorderTopWidth();
267
        int bottom = area.getBorderBottomWidth();
284
        int bottom = area.getBorderBottomWidth();
285
286
        doBackground(area, rx + 500/*(left == 0 ? 500 : left)*/, ry - 500/*(top == 0 ? 500 : top)*/, w - 500/*left - right / 2*/, h - 500/*bottom*/);
287
268
        // If style is solid, use filled rectangles
288
        // If style is solid, use filled rectangles
269
        if (top != 0)
289
/*        if (top != 0)
270
            addFilledRect(rx, ry, w, top,
290
            addFilledRect(rx, ry, w, top,
271
                          new PDFColor(bp.getBorderColor(BorderAndPadding.TOP)));
291
                          new PDFColor(bp.getBorderColor(BorderAndPadding.TOP)));
272
        if (left != 0)
292
        if (left != 0)
273
            addFilledRect(rx - left, ry - h - bottom, left, h + top + bottom,
293
            addFilledRect(rx, ry - h, left, h,
274
                          new PDFColor(bp.getBorderColor(BorderAndPadding.LEFT)));
294
                          new PDFColor(bp.getBorderColor(BorderAndPadding.LEFT)));
275
        if (right != 0)
295
        if (right != 0)
276
            addFilledRect(rx + w, ry - h - bottom, right, h + top + bottom,
296
            addFilledRect(rx + w, ry - h, right, h,
277
                          new PDFColor(bp.getBorderColor(BorderAndPadding.RIGHT)));
297
                          new PDFColor(bp.getBorderColor(BorderAndPadding.RIGHT)));
278
        if (bottom != 0)
298
        if (bottom != 0)
279
            addFilledRect(rx, ry - h - bottom, w, bottom,
299
            addFilledRect(rx, ry - h, w, bottom,
280
                          new PDFColor(bp.getBorderColor(BorderAndPadding.BOTTOM)));
300
                          new PDFColor(bp.getBorderColor(BorderAndPadding.BOTTOM)));*/
301
302
        if (top != 0)
303
//            addLine(rx - top / 2, ry, rx + w + top / 2, ry, top,
304
//                    new PDFColor(bp.getBorderColor(BorderAndPadding.TOP)));
305
            pendingBorders.add(new BorderInfo(rx - Math.max(left / 2, 500), ry, rx + w + Math.max(left / 2, 500), ry, top,
306
                    new PDFColor(bp.getBorderColor(BorderAndPadding.TOP))));
307
        if (left != 0)
308
//            addLine(rx, ry + left / 2, rx, ry - h - left / 2, left,
309
//                    new PDFColor(bp.getBorderColor(BorderAndPadding.LEFT)));
310
            pendingBorders.add(new BorderInfo(rx, ry + Math.max(top / 2, 500), rx, ry - h/* - top*/, left,
311
                    new PDFColor(bp.getBorderColor(BorderAndPadding.LEFT))));
312
        if (right != 0)
313
//            addLine(rx + w, ry + right / 2, rx + w, ry - h - right / 2, right,
314
//                    new PDFColor(bp.getBorderColor(BorderAndPadding.RIGHT)));
315
            pendingBorders.add(new BorderInfo(rx + w, ry + Math.max(top / 2, 500), rx + w, ry - h/* - top*/, right,
316
                    new PDFColor(bp.getBorderColor(BorderAndPadding.RIGHT))));
317
        if (bottom != 0)
318
//            addLine(rx - bottom / 2, ry - h, rx + w + bottom / 2, ry - h, bottom,
319
//                    new PDFColor(bp.getBorderColor(BorderAndPadding.BOTTOM)));
320
            pendingBorders.add(new BorderInfo(rx - Math.max(left / 2, 500), ry - h, rx + w + Math.max(left / 2, 500), ry - h, bottom,
321
                    new PDFColor(bp.getBorderColor(BorderAndPadding.BOTTOM))));
281
    }
322
    }
282
323
283
    /**
324
    /**

Return to bug 24438