I worked on a project some time ago, that used Syncfusion for WinRT version 12.2.0.36
it had some pdf manipulation, such as adding images to the pdf. After some effort it was working and the part of the code was something like this
//...
foreach (var image in this.images) //image is type Windows.Ui.Xaml.Controls.Image
{
var bitmap = image.Source as ImageSource;
var index = bitmaps.IndexOf(bitmap);
var signature = signatures.ElementAt(index);
var bytes = await signature.Data.EncodePngToJpeg(); //returns bytes of png image converted to jpg
PdfImage pdfImage;
using (var memoryStream = new MemoryStream(bytes))
{
pdfImage = PdfImage.FromStream(memoryStream);
}
var transform = image.RenderTransform as CompositeTransform;
var x = (image.Margin.Left + transform.TranslateX + horizontalOffset) * 100 / pdfViewer.Zoom - 10;
var y = (image.Margin.Top + transform.TranslateY + verticalOffset) * 100 / pdfViewer.Zoom - 10;
var firstPage = pdfDocument.Pages[pdfViewer.PageNumber - 1];
var pageHeight = firstPage.Size.Height;
var pageWidth = firstPage.Size.Width;
var selpage = pdfViewer.PageNumber;
var pagn = selpage - 1;
if (pagn < 0)
pagn = 0;
var ss = pdfViewer.GetDescendantsOfType<ScrollViewer>();
var hh = ss.ElementAt(3);
float VertOff = (float)hh.VerticalOffset;
float VertOff2 = (VertOff * 100 / pdfViewer.Zoom) - ((pagn) * (pageHeight * 1.325f));
var page = pdfDocument.Pages[pagn];
var graphics = page.Graphics;
var width = image.Width;
var height = image.Height;
//float fWidth = (float)width;
//float fHeight = (float)height;
fWidth = 165f * 0.50f;
fHeight = 110f * 0.50f;
graphics.ScaleTransform(0.75f, 0.75f);
graphics.DrawImage(pdfImage, (float)x, (float)y + VertOff2, fWidth, fHeight); // <-- exception is here
}
then i installed the WinRT trial version (13.1.0.21) and i started to get this exception
A first chance exception of type 'System.NullReferenceException' occurred in Syncfusion.Pdf.WinRT.DLL
System.NullReferenceException' : {"Object reference not set to an instance of an object."}
with this StackTrace:
at Syncfusion.Pdf.Graphics.PdfBitmap.SetColorSpace()
at Syncfusion.Pdf.Graphics.PdfBitmap.Save()
at Syncfusion.Pdf.Graphics.PdfGraphics.DrawImage(PdfImage image, Single x, Single y, Single width, Single height)
at Gapp_metro.Pages.PdfPage.<OnSaveButtonClick>d__25.MoveNext()
Did anything changed between versions that might be giving me an error?