We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Print preview doesn't work with images

Hi there,

I'm trying to print using built-in Print command from sfReportViewer, but on print preview page images doesn't show up. 

Here's my code:

protected override async void OnNavigatedTo(NavigationEventArgs e)

            writer.Format = BarcodeFormat.DATA_MATRIX;
            writer.Options = new DatamatrixEncodingOptions
                SymbolShape     = ZXing.Datamatrix.Encoder.SymbolShapeHint.FORCE_SQUARE,
                Height = 64,
                Width = 64,
                MaxSize = new Dimension(64, 64),
                MinSize = new Dimension(32, 32),
                GS1Format = true

            Assembly assembly = typeof(MainPage).GetTypeInfo().Assembly;
            Stream reportStream = assembly.GetManifestResourceStream("TrackAndTrace.Report3.rdlc");
            sfReport.ProcessingMode = Syncfusion.UI.Xaml.Reports.ProcessingMode.Local;
            sfReport.ExportMode = Syncfusion.UI.Xaml.Reports.ExportMode.Local;
            //sfReport.PaperOrientation = PaperOrientation.Landscape;

            ViewModel = new IzvozPodatakaViewModel(App.ViewModel.OdabraniPlan);

            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                AppViewModel.UcitavaSe = true;

            await ViewModel.UcitajPlanPakovanja();
            List<Task<string>> tasks = new List<Task<string>>();

            foreach (var j in ViewModel.Jedinacne)
                j.Code = await GetDMCode(j.SerijskiBroj.Replace("(", "").Replace(")", ""));

            Task task = Task.Run(()=>App.SbRepository.UpdateJedinacneAsync(ViewModel.Jedinacne));

            await task.ContinueWith(async t1 =>
                if (t1.Status == TaskStatus.RanToCompletion)
                    await sfReport.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                        sfReport.DataSources.Add(new ReportDataSource("DataSet1", ViewModel.Jedinacne));

            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                AppViewModel.UcitavaSe = false;

        private async Task<byte[]> GetDMCode(string serBroj)
            WriteableBitmap bitmap = writer.Write(serBroj);
            byte[] bytes;

            using (InMemoryRandomAccessStream ms = new InMemoryRandomAccessStream())
                BitmapEncoder bitmapEncoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, ms);
                    bitmap.PixelBuffer, BitmapPixelFormat.Bgra8, bitmap.PixelWidth, bitmap.PixelHeight));
                await bitmapEncoder.FlushAsync();
                bitmap = null;
                bytes = new byte[ms.Size];
                await ms.AsStream().ReadAsync(bytes, 0, bytes.Length);
            return bytes;

Exports work properly and images are shown without problem.

I did screenshot for better visual explanation:

Any advice?

1 Reply

MM Mageshyadav M Syncfusion Team November 20, 2018 01:25 AM

Hi Mursel,  
We were able to reproduce the print preview doesn't work with images issue and a support incident to track the status of this issue fix delivery has been created under your account. Please log on to our support website to check for further updates.   

Live Chat Icon For mobile
Up arrow icon