You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2007/08/31 11:20:01 UTC

DO NOT REPLY [Bug 43274] New: - embed SVG file in PDF: picture incorrect (wrong colors)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43274>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43274

           Summary: embed SVG file in PDF: picture incorrect (wrong colors)
           Product: Fop
           Version: 0.94
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P4
         Component: svg
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: ckohrn@tng.de


We have a XSL/FO script that just embeds a SVG file using <fo:external-
graphic>. The PDF rendered with FOP-0.20.5rc contains the SVG, correctly like 
displayed with the batik viewer gui.

The PDF rendered with FOP-0.93 or 0.94 contains the SVG, but the colors aren't 
displayed correctly: The SVG seems to be invisible.

After patching one file, the problem seems to be solved. Even with more complex 
XSL/FO scripts the results of the patched FOP-0.94 look fine.

It looks like the 0.94 uses inherited color values in some cases, misleadingly.



--------- input.xsl ------------
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE xsl:stylesheet []>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
  <xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <xsl:call-template name="layout-master-set"/>
      <fo:page-sequence master-reference="one">
        <fo:flow flow-name="xsl-region-body">
          <xsl:call-template name="gfx"/>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
  <xsl:template name="layout-master-set">
    <fo:layout-master-set>
      <fo:simple-page-master master-name="one">
        <fo:region-body margin-bottom="20pt" margin-left="12mm" margin-
right="25pt" />
      </fo:simple-page-master>
    </fo:layout-master-set>
  </xsl:template>
  <xsl:template name="gfx">
    <fo:block>
      <fo:external-graphic content-width="222pt">
        <xsl:attribute name="src">/data/home/ckohrn/Desktop/manipulated.svg</
xsl:attribute>
      </fo:external-graphic>
    </fo:block>
  </xsl:template>
</xsl:stylesheet>


--------- manipulated.svg ------------
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 10, SVG Export Plug-In . SVG Version: 3.0.0 
Build 76)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/
REC-SVG-20010904/DTD/svg10.dtd" [
	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg  xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/
AdobeSVGViewerExtensions/3.0/"
	 width="117.524902" height="69.405273" viewBox="0 0 117.524902 
69.405273"
	 overflow="visible" enable-background="new 0 0 117.524902 69.405273" 
xml:space="preserve">
	<g id="Dimension_Layer">
		<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" 
d="M57.727539,16.092773v-0.513672l-3.995117-0.001465
			L53.711914,4.447754l-
7.166992,0.004395L46.52832,1.648438H19.372559v2.757324l-5.233887-
0.031738V0.233398l-2.798828,0.005859
			l0.017578,15.389648l-4.234375-
0.030762v0.463379h0.5625v24.6875l-0.5625,0.00293v0.530273l3.943359-
0.001953v9.045898h2.029785
			h2.342285h38.138672l-0.032227-
9.061523l4.09375,0.015625v-0.46875h-0.3125V16.108398L57.727539,16.092773z 
M24.435547,40.749023
			h-1l-0.03125-24.65625l1.03125-0.015625V40.749023z 
M41.269043,40.787109l-1.010254-0.017578l0.004883-24.661133
			l1.015625-0.015625L41.269043,40.787109z"/>
			<path fill="none" stroke="#000000" stroke-width="0.15" 
stroke-linejoin="round" stroke-miterlimit="1" d="M103.759766,49.632812
				"/>
		<g>
			<path fill="none" stroke="#000000" stroke-width="0.15" 
stroke-linejoin="round" stroke-miterlimit="1" d="M106.358398,50.322266
				"/>
		</g>
		<path d="M5.669434,2.990723c0,1.56543-1.269043,2.833984-
2.834961,2.833984C1.269043,5.824707,0,4.556152,0,2.990723
			c0-1.566406,1.269043-2.834961,2.834473-
2.834961C4.400391,0.155762,5.669434,1.424316,5.669434,2.990723z"/>
		<g>
			<path fill="#FFFFFF" d="M1.834473,4.408691v-
0.60791h0.852051V2.344727L1.90625,2.784668L1.598633,2.224609l1.099609-0.639648
				H3.45459v2.21582h0.699707v0.60791H1.834473z"/>
		</g>
	</g>
</svg>


----------- fop-0.94-org.apache.fop.svg.PDFGraphics2D.patch --------------
Index: PDFGraphics2D.java
===================================================================
--- PDFGraphics2D.java  (Revision 570024)
+++ PDFGraphics2D.java  (Arbeitskopie)
@@ -719,13 +719,15 @@
         }

         c = getColor();
-        if (graphicsState.setColor(c)) {
+        graphicsState.setColor(c);
+        // if (graphicsState.setColor(c)) {
             applyColor(c, false);
-        }
+        // }
         c = getBackground();
-        if (graphicsState.setBackColor(c)) {
+        graphicsState.setBackColor(c);
+        // if (graphicsState.setBackColor(c)) {
             applyColor(c, true);
-        }
+        // }

         Paint paint = getPaint();
         if (graphicsState.setPaint(paint)) {
@@ -1718,13 +1720,15 @@
         }

         c = getColor();
-        if (graphicsState.setColor(c)) {
+        graphicsState.setColor(c);
+        // if (graphicsState.setColor(c)) {
             applyColor(c, true);
-        }
+        // }
         c = getBackground();
-        if (graphicsState.setBackColor(c)) {
+        graphicsState.setBackColor(c);
+        // if (graphicsState.setBackColor(c)) {
             applyColor(c, false);
-        }
+        // }

         Paint paint = getPaint();
         if (graphicsState.setPaint(paint)) {

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 43274] - embed SVG file in PDF: picture incorrect (wrong colors)

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43274>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43274


a_l.delmelle@pandora.be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From a_l.delmelle@pandora.be  2007-09-04 11:12 -------

Patch applied. See: http://svn.apache.org/viewvc?rev=572763&view=rev

Thanks for the input.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 43274] - embed SVG file in PDF: picture incorrect (wrong colors)

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43274>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43274





------- Additional Comments From dev@cumiskey.com  2007-08-31 09:34 -------
Maybe I am doing something wrong here but I am unable to find any discernible
difference when viewing the pdf output with acrobat reader with or without the
patch.

Adrian.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 43274] - embed SVG file in PDF: picture incorrect (wrong colors)

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43274>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43274





------- Additional Comments From dev@cumiskey.com  2007-09-04 03:23 -------
Created an attachment (id=20764)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20764&action=view)
patch file

I have now verified the problem and cleaned up the patch.

Adrian.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 43274] - embed SVG file in PDF: picture incorrect (wrong colors)

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43274>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43274





------- Additional Comments From ckohrn@tng.de  2007-08-31 09:56 -------
Tested again: The result of the clean 0.94 is an empty PDF page. The resulting 
page of the patched 0.94 contains a small black circle with a white '1' in it.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 43274] - embed SVG file in PDF: picture incorrect (wrong colors)

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43274>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43274





------- Additional Comments From ckohrn@tng.de  2007-08-31 14:19 -------
Next test now at home, using another machine than at work. Test procedure:

chk@mainframe fop-0_94 # ./fop -fo ~/Desktop/input.fo -pdf ~/Desktop/out.pdf

The PDF rendered with the unpatched FOP contains just a blank page and has a 
size of 5335 bytes. After patching the resulting document contains 5338 bytes, 
and contains a "'1' in a circle" in the left upper corner.


--------- input.fo ----------
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="one">
      <fo:region-body margin-bottom="20pt" margin-left="12mm"
 margin-right="25pt"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="one">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>
        <fo:external-graphic content-width="222pt"
 src="/home/chk/Desktop/manipulated.svg"/>
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.