Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I had a brief look into this.</p> <p>The <code>Image.Resolution</code> property can be used to set the PDF rendering resolution but that property is not exposed by the ImageMagick.NET wrapper.</p> <p>Adding the missing property to the Image class is simple enough.</p> <pre><code>Index: ImageMagickNET/Image.h =================================================================== --- ImageMagickNET/Image.h (revision 59374) +++ ImageMagickNET/Image.h (working copy) @@ -532,6 +532,13 @@ } + // Vertical and horizontal resolution in pixels of the image. + property Geometry^ Density + { + void set(Geometry^); + } + + //---------------------------------------------------------------- // IO //---------------------------------------------------------------- Index: ImageMagickNET/Image.cpp =================================================================== --- ImageMagickNET/Image.cpp (revision 59374) +++ ImageMagickNET/Image.cpp (working copy) @@ -1099,5 +1099,9 @@ return bitmap; } + void Image::Density::set(Geometry^ density_) + { + image-&gt;density(*(density_-&gt;geometry)); + } } </code></pre> <p>Unfortunately it seems that <a href="http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&amp;t=15585" rel="nofollow noreferrer">a bug</a> prevents us from setting the rendering quality while iterating through the PDF pages as you're attempting to do.</p> <p>Another option would be to open each page separately:</p> <pre><code>Image image = new Image(); image.Density = new Geometry("1000"); // 1000 dpi image.Read(@"C:\u\test.pdf[2]"); // Open the 3rd page, index 0 is the first </code></pre> <p>If the page number is out of range you get a <em>raw</em> C++ exception. While <a href="https://stackoverflow.com/questions/150544/can-you-catch-a-native-exception-in-c-code">you can catch it in C#</a> the wrapper should probably include a <em>.NET</em> exception class for representing ImageMagick errors.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload