Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-1763

When generating EPS from SVG image content doesn't fit borders

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • 0.95
    • None
    • renderer/ps
    • None
    • Operating System: Linux
      Platform: PC
    • 48575

    Description

      org.apache.fop.render.ps.EPSTranscoder produces EPS file from SVG DOM, and image content doesn't fit image borders (so that picture is croped), though viewBox parameter in svg file covers all content.

      If specify area of interest (by EPSTranscoder.KEY_AOI hint) aproximately 1.38 times larger then actual viewBox then content fit borders well.

      Versions 0.93 and 0.94 generate EPS file well, image content fits borders as it should.

      Batik 1.7 was used to create SVG DOM.

      Code being used for conversion:

      public static byte[] serialize2EPS(Document document){
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      EPSTranscoder tr = new EPSTranscoder();

      try

      { tr.transcode(new TranscoderInput(document),new TranscoderOutput(baos)); }

      catch (TranscoderException e)

      { e.printStackTrace(); }


      return baos.toByteArray();
      }

      SVG file being processed:

      <?xml version="1.0"?>
      <svg transform="scale(1.0)"
      width="100.0mm" xmlns:xlink="http://www.w3.org/1999/xlink" height="100.0mm" viewBox="0.0 0.0 100.0 100.0" xmlns="http://www.w3.org/2000/svg">
      <rect fill="#ffffff" x="0" width="100.0" height="100.0" y="0" style="stroke:#ffffff"/>
      <path stroke-linecap="square" fill-opacity="1.0" fill="none" fill-rule="nonzero" stroke-linejoin="miter" style="stroke:#000"
      d="M48.913043478260875,13.539282990083906 C64.97395582555245,13.539282990083906 77.99389778794813,20.881676490189015 77.99389778794813,29.938977879481314 C77.99389778794813,38.99627926877361 64.97395582555245,46.33867276887872 48.913043478260875,46.33867276887872 C32.852131130969305,46.33867276887872 19.83218916857361,38.99627926877361 19.83218916857361,29.938977879481314 C19.83218916857361,20.881676490189015 32.852131130969305,13.539282990083906 48.913043478260875,13.539282990083906Z"
      stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/>
      <path stroke-linecap="square" fill-opacity="1.0" fill="none" fill-rule="nonzero" stroke-linejoin="miter" style="stroke:#000"
      d="M1.0526315789473684,1.4736842105263157 C1.0526315789473684,1.4736842105263157 98.73684210526316,1.4736842105263157 98.73684210526316,1.4736842105263157 C98.73684210526316,1.4736842105263157 98.73684210526316,98.52631578947368 98.73684210526316,98.52631578947368 C98.73684210526316,98.52631578947368 1.0526315789473684,98.52631578947368 1.0526315789473684,98.52631578947368 C1.0526315789473684,98.52631578947368 1.0526315789473684,1.4736842105263157 1.0526315789473684,1.4736842105263157Z"
      stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/><path stroke-linecap="square" fill-opacity="1.0" fill="none" fill-rule="nonzero" stroke-linejoin="miter" style="stroke:#000"
      d="M5.684210526315789,5.473684210526316 C5.684210526315789,5.473684210526316 86.52631578947368,90.52631578947368 86.52631578947368,90.52631578947368"
      stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/><path stroke-linecap="square" fill-opacity="1.0" fill="none" fill-rule="nonzero" stroke-linejoin="miter" style="stroke:#000"
      d="M6.105263157894737,89.6842105263158 C6.105263157894737,89.6842105263158 93.89473684210526,6.736842105263165 93.89473684210526,6.736842105263165"
      stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/></svg>

      Attachments

        1. out.eps
          11 kB
          Peter Hancock
        2. out.pdf
          1 kB
          Peter Hancock

        Activity

          People

            Unassigned Unassigned
            paul.lysak Paul Lysak
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: