[ 
https://issues.apache.org/jira/browse/FOP-3133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17726631#comment-17726631
 ] 

Dave Roxburgh commented on FOP-3133:
------------------------------------

Hi Srikant,

It looks like all your labels are enclosed in SVG switch structures like this:
{code:java}
            <switch>
                <foreignObject pointer-events="none" width="100%" height="100%" 
requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"; 
style="overflow: visible; text-align: left;">
                    <div xmlns="http://www.w3.org/1999/xhtml"; style="display: 
flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; 
height: 1px; padding-top: 20px; margin-left: 91px;">
                        <div data-drawio-colors="color: rgb(0, 0, 0); " 
style="box-sizing: border-box; font-size: 0px; text-align: center;">
                            <div style="display: inline-block; font-size: 12px; 
font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: 
all; font-weight: bold; white-space: normal; overflow-wrap: 
normal;">SigMapRx</div>
                        </div>
                    </div>
                </foreignObject>
                <text x="140" y="24" fill="rgb(0, 0, 0)" 
font-family="Helvetica" font-size="12px" text-anchor="middle" 
font-weight="bold">SigMapRx</text>
            </switch> {code}

It seems the foreignObject case is being chosen when Batik processes the SVG.

Are you familiar with the issues around using foreignObjects with Batik? I 
don't think Batik currently supports foreignObjects. Or if it does you may need 
to supply a handler.

Furthermore, Batik fails to render the text to PNG as well as to PDF. This 
suggests that the issue is a Batik issue, not a FOP issue.
The Batik Jira is here: 
[https://issues.apache.org/jira/issues/?jql=project%20%3D%20BATIK]

I'll consider this issue closed unless you can indicate that there's a fault in 
FOP.

> Labels are missing in PDF when SVG is converted to PDF using PDFTranscoder
> --------------------------------------------------------------------------
>
>                 Key: FOP-3133
>                 URL: https://issues.apache.org/jira/browse/FOP-3133
>             Project: FOP
>          Issue Type: Bug
>            Reporter: Srikant Das
>            Priority: Major
>         Attachments: test.svg
>
>
> I was converting an SVG File into PDF using Apache Batik but labels are 
> missing in the PDF
> The following code is used to generate PDF:
> {code:java}
> import org.apache.batik.transcoder.TranscoderInput;
> import org.apache.batik.transcoder.TranscoderOutput;
> ...
> File svgFile = new File("./target/test.svg");
> ...
> PDFTranscoder transcoder = new PDFTranscoder();
> try (FileInputStream fileInputStream = new FileInputStream(svgFile); 
> FileOutputStream fileOutputStream = new FileOutputStream(new 
> File("./target/test-batik.pdf"))) {
>     TranscoderInput transcoderInput = new TranscoderInput(fileInputStream);
>     TranscoderOutput transcoderOutput = new 
> TranscoderOutput(fileOutputStream);
>     transcoder.transcode(transcoderInput, transcoderOutput);
> }
> {code}
> {code:java}
> //dependency
>   <dependency>
>      <groupId>org.apache.xmlgraphics</groupId>
>      <artifactId>batik-transcoder</artifactId>
>      <version>1.10</version>
>    </dependency>
> {code}
> Could you please help me to resolve this issue?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to