Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: append images to output pdf file

$
0
0
If you want to create a PDF with 300 images you will first have to read all of them in memory. You could use the Q8 instead of the Q16 version of Magick.NET to reduce the memory that is being used.

You cannot write a multipage PDF file by appending to the file. You will have to write the whole file at once:
using (MagickImageCollection collection = new MagickImageCollection())
{
  string[] jpgs = Directory.GetFiles(@"c:\PDF\", @"*.jpg");

  foreach (string jpg in jpgs)
  {               
    MagickImage img = new MagickImage(jpg);
    img.Format = MagickFormat.Pdf;
    collection.Add(img);
  }
  collection.Write(@"c:\PDF\out.pdf");
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>