Skip to content

svgdoc.Ppi not respected #446

Open
Open
@PeterWone

Description

@PeterWone

According to #313 one can set Ppi after creating an SvgDocument.

  SvgDocument svgDoc = SvgDocument.Open(xmlDoc);
  svgDoc.Ppi = (int)e.Graphics.DpiX;

  ...
  svgDoc.Height = new SvgUnit(SvgUnitType.Millimeter, 20);
  float h = (int) svgDoc.Height;

In my tests the printer device context DpiX value is 600 and this is definitely assigned to Ppi.
However, the value returned into h is 75.6.

The correct result is 20 / 25.4 * 600 = 472.441

Working backward from the actual result 20 / 25.4 * dpi = 75.6 w have dpi = 75 / (20 / 25.4) = 96 which is the default dpi.

On this basis I assert that Ppi is not respected.

Rummaging, implicit conversion does this .ToDeviceValue(null, UnitRenderingType.Other, null) and because owner is not supplied ppi is obtained from SvgDocument.PointsPerInch which matches the observed behaviour.

What is the recommended way to do this kind of conversion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions