I've faced the same problem with PDFSharp 1.32 version.
The error occurs in ImageRenderer:
A generic error occurred in GDI+.
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at PdfSharp.Pdf.Advanced.PdfImage.InitializeJpeg()
at PdfSharp.Pdf.Advanced.PdfImage..ctor(PdfDocument document, XImage image)
at PdfSharp.Pdf.Advanced.PdfImageTable.GetImage(XImage image)
at PdfSharp.Pdf.PdfPage.GetImageName(XImage image)
at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.GetImageName(XImage image)
at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.Realize(XImage image)
at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.DrawImage(XImage image, XRect destRect, XRect srcRect, XGraphicsUnit srcUnit)
at PdfSharp.Drawing.XGraphics.DrawImage(XImage image, XRect destRect, XRect srcRect, XGraphicsUnit srcUnit)
at MigraDoc.Rendering.ImageRenderer.Render()
As I see in XImage.cs:241 the EXIF format is not officially supported:
case "{B96B3CB2-0728-11D3-9D7B-0000F81EF32E}": // exif
default:
throw new InvalidOperationException("Unsupported image format.");
Unfortunately GDI+ defines my exif format images as JPEG, so the expected case doesn't trigger.
Currently I didn't find any ideal solution for that. On developers forum (http://forum.pdfsharp.net/viewtopic.php?f=3&t=3304) you could find some more information about the similar problem. Seems like the problem occurs cause the image is saved using one of Adobe tools.
From other point - newer versions of Windows handle this correctly, this problem was only reproduced on Windows Server 2008 R2, so maybe an update could resolve the problem.