This project has moved and is read-only. For the latest updates, please go here.

The size of image is weird after convert a pdf to image.

Sep 13, 2016 at 9:44 PM
Edited Sep 13, 2016 at 9:46 PM
The size of image is weird after convert a pdf to image. The pdf image not fill in whole canvas , be put to a corner.
If I change to another pdf file, everything is okay. Is it because of the setting or special pdf format?

I am using the latest version of Magick.NET-Q8-AnyCPU.dll.

Sep 14, 2016 at 12:36 PM
Edited Sep 14, 2016 at 12:36 PM
Can you share your PDF file so I can try to reproduce this issue?
Sep 14, 2016 at 2:29 PM
Thank you for help. I wanted to extract only one page from this PDF.
Sep 18, 2016 at 9:16 AM
It appears that your PDF file has a CropBox. You can enable the use of this with Magick.NET but I don't know what this will do with your other images. You will need to test that yourself. Below is the code that can be used to enable the CropBox and read a single page:
MagickReadSettings settings = new MagickReadSettings()
  Density = new Density(300), // Setting this value will get you an image with a higher quality 
  FrameIndex = 4, // Specifies the page you want to view (starts at zero)
  Defines = new PdfReadDefines()
    UseCropBox = true // Enables the use of the CropBox.

using (MagickImage image = new MagickImage("3P207257-2D.pdf", settings))
Sep 20, 2016 at 3:19 PM
It works. Thank you. Another question, How can I overwrite the exists image?
Sep 20, 2016 at 6:27 PM
I don't understand what you are asking. Do you want to save it as a PDF again?