question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

svgdoc.Ppi not respected

See original GitHub issue

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?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
PeterWonecommented, May 3, 2019

Explicit conversion with a supplied owner also fails. I found the bug and corrected it, at some point I will do a PR

0reactions
MassMessagecommented, Nov 8, 2021

Does anyone has a work around this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

svgdoc.Ppi not respected · Issue #446 · svg-net/SVG
On this basis I assert that Ppi is not respected. Rummaging, implicit conversion does this .ToDeviceValue(null, UnitRenderingType.Other, null) and because owner ...
Read more >
Set SvgUnit DPI · Issue #313 · svg-net/SVG
Hi, I am having trouble rendering my SVG using Batik as I am trying to render at a higher dpi than the default...
Read more >
How to get started | SVG.NET API
After I load the SVG, I make new SVG with the same initial SvgDocument properties (basically a deep copy followed by deleting all...
Read more >
Management of the Patient with Incomplete Response to ...
Hence, with an incomplete response to PPI therapy, a fundamental question is whether or not the persistent symptoms are attributable to reflux. Obtaining...
Read more >
Proton Pump Inhibitor Nonresponders - PMC
One of the most common reasons that patients with GERD do not respond to PPI therapy is that they are not compliant with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found