public override void OnLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle extras)
 {
     if (cancellationSignal.IsCanceled)
     {
         callback.OnLayoutCancelled();
     }
     else
     {
         PrintDocumentInfo.Builder builder = new PrintDocumentInfo.Builder(StatsActivity.filename);
         builder.SetContentType(PrintContentType.Document).SetPageCount(PrintDocumentInfo.PageCountUnknown).Build();
         callback.OnLayoutFinished(builder.Build(), !newAttributes.Equals(oldAttributes));
     }
 }
        public override void OnLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, Android.OS.CancellationSignal cancellationSignal, LayoutResultCallback callback, Android.OS.Bundle extras)
        {
            if (cancellationSignal.IsCanceled)
            {
                callback.OnLayoutCancelled();
                return;
            }

            using var builder = new PrintDocumentInfo.Builder(_fileName);
            callback.OnLayoutFinished(builder
                                      .SetContentType(PrintContentType.Document)
                                      .Build(), true);
        }
예제 #3
0
 public override void OnLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle extras)
 {
     if (cancellationSignal.IsCanceled)
     {
         callback?.OnLayoutCancelled();
     }
     else
     {
         var builder = new PrintDocumentInfo.Builder("filename.pdf");
         builder.SetContentType(PrintContentType.Document)
         .SetPageCount(PrintDocumentInfo.PageCountUnknown);
         callback.OnLayoutFinished(builder.Build(), !(newAttributes == oldAttributes));
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="oldAttributes"></param>
        /// <param name="newAttributes"></param>
        /// <param name="cancellationSignal"></param>
        /// <param name="callback"></param>
        /// <param name="extras"></param>
        public override void OnLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle extras)
        {
            if (cancellationSignal.IsCanceled)
            {
                callback.OnLayoutCancelled();
                return;
            }

            using (PrintDocumentInfo.Builder builder = new PrintDocumentInfo.Builder(FileToPrint))
            {
                //using (
                PrintDocumentInfo pdi = builder.SetContentType(ContentType).Build(); //)
                {
                    callback.OnLayoutFinished(pdi, true);
                }
            }
        }