You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by "Dave Roxburgh (Jira)" <ji...@apache.org> on 2023/05/30 14:42:00 UTC

[jira] [Commented] (BATIK-1357) Labels are missing in PDF when SVG is converted to PDF using PDFTranscoder

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

Dave Roxburgh commented on BATIK-1357:
--------------------------------------

Labels are (text is) 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}
The foreignObject case is being chosen when Batik processes the SVG.

See https://issues.apache.org/jira/browse/FOP-3133

> Labels are missing in PDF when SVG is converted to PDF using PDFTranscoder
> --------------------------------------------------------------------------
>
>                 Key: BATIK-1357
>                 URL: https://issues.apache.org/jira/browse/BATIK-1357
>             Project: Batik
>          Issue Type: Bug
>    Affects Versions: 1.10
>            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)

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org