Page 1 of 1

Flatten PDF

Posted: 2015-08-06T14:55:50-07:00
by devyekov
Hello,

How I do "Flatten" a pdf?

Convert PDF to PDF with flatten.

Use
Magick.NET 7.0.0.0007
With
C# fw2
Ghostscript 9.16


Regards.

Re: Flatten PDF

Posted: 2015-08-06T16:00:38-07:00
by devyekov
I found this

Code: Select all

MagickReadSettings settings = new MagickReadSettings();
settings.Density = new MagickGeometry(300);

using (MagickImageCollection images = new MagickImageCollection())
{
   images.Read("Snakeware.pdf", settings);  
    MagickImage image = images.Flatten();
    image.Write("SnakewareNew.pdf");
}
Now the question is, as I reduce the size / quality of the file, the result is as follows:
Original file: 4566KB
New file: 44950KB

Change the value of quality without result

Code: Select all

image.Quality = 15;
Regards

Re: Flatten PDF

Posted: 2015-08-06T17:11:46-07:00
by snibgo
What do you mean by "flatten"?

Re: Flatten PDF

Posted: 2015-08-10T13:54:42-07:00
by devyekov
Merge / join in layers. or how does it work in ImageMagick?

How I can reduce the size of PDF?

Thk
Regards

Re: Flatten PDF

Posted: 2015-08-13T15:07:25-07:00
by devyekov
Hi

For the problem of the size of the file, solve with

Code: Select all

image.CompressionMethod = CompressionMethod.JPEG;
but... I think the "flatten" of the ImageMagick is different Ghostscript, how do I indicate to GhostScript from ImageMagick apply flatten? This for pdf file.

Thk
Regards

Re: Flatten PDF

Posted: 2015-08-13T15:14:19-07:00
by fmw42
I do not think GS does any flattening. IM does that. Though I could be wrong if you run GS standalone.

Flattening in IM will overlay every layer/page, etc. So if your PDF has no transparency, you will only see the top most (last) page.

Perhaps you mean something else by flatten? If so, please describe what you want to happen.