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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Print preview doesn't work with images

Thread ID:

Created:

Updated:

Platform:

Replies:

141028 Nov 19,2018 09:29 PM UTC Nov 20,2018 06:25 AM UTC UWP 1
loading
Tags: SfReportViewer
Mursel Musabasic
Asked On November 19, 2018 09:29 PM UTC

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;
            sfReport.LoadReport(reportStream);

            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.Clear();
                        sfReport.DataSources.Add(new ReportDataSource("DataSet1", ViewModel.Jedinacne));
                        sfReport.RefreshReport();
                    });
                }
            });

            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);
                bitmapEncoder.SetSoftwareBitmap(SoftwareBitmap.CreateCopyFromBuffer(
                    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?


Mageshyadav M [Syncfusion]
Replied On November 20, 2018 06:25 AM UTC

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.   
    
 
Regards,  
Mageshyadav.M 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;