WPF Apps crash on Windows 10/11 after Windows Updates installed: System.IO.FileFormatException: StoryFragments part failed to load

Mark Chesney 26 Reputation points
2022-12-15T01:57:03.347+00:00

My company develops .NET WPF apps (32-bit, targeting .NET Framework 4.7.2, and 4.5 for one of the old ones) written in C# using Visual Studio. My Windows 11 dev system installed updates last night, and today when I run any of our WPF apps (either under the Visual Studio debugger or standalone) they all crash with the same error: "System.IO.FileFormatException: StoryFragments part failed to load".

I initially thought the crash was due to code changes I had made, but eventually came to suspect it was due to the recent upgrades. I verified this by running the apps on another Windows 11 system and confirming that they ran just fine. I then installed the latest updates from the Windows Update part of the Settings app and rebooted the PC. After the reboot, when our apps are run they crash with the same error!

I then ran the same test on a Windows 10 system and got the same result - the app crashes with the same error!

My questions are:

  • Has anyone else experienced this error?
  • If so, is there a way to prevent it from occurring?
  • Or is there a problem with a particular Windows updates that needs to be fixed?

Since the applications crash every time they are run, I am currently dead in the water as far as application development for my employer goes. So obviously I need a resolution to this problem ASAP.

If any of these updates happen to get installed on our sales staff PCs, then they will be unable to demo the applications for customers.

Fortunately we have a private Windows Update server for our deployed systems, so I've notified the person in charge of that to hopefully prevent any new updates from reaching those systems. Otherwise we'd be in a world of hurt!

Here are the Windows updates that were installed on the various systems:

Windows 10 PC
2022-12 Cumulative Update for Windows 10 Version 21H2 for x64-based Systems (KB5021233)
2022-12 Cumulative Update for .NET Framework 3.5, 4.8 and 4.8.1 for Windows 10 Version 21H2 for x64 9KB5021088)

Windows 11 PC #1
2022-12 Cumulative Update for .NET Framework 3.5, 4.8 and 4.8.1 for Windows 11 for x64 (KB5021090)
2022-12 .NET 6.0.12 Security Update for x64 Client (KB5021954)
2022-12 .NET Core 3.1.32 Security Update for x64 Client (KB5021953)
2022-12 Cumulative Update for Windows 11 for x64-based Systems (KB5021234)

Windows 11 PC #2
2022-12 Cumulative Update for Windows 11 Version 22H2 for x64-based Systems (KB5021255)
2022-12 Cumulative Update for .NET Framework 3.5 and 4.8.1 for Windows 11, version 22H2 for x64 (KB5020880)
2022-12 .NET Core 3.1.32 Security Update for x64 Client (KB5021953)
2022-12 .NET 6.0.12 Security Update for x64 Client (KB5021954)

Here is the call stack from when one of our apps crashed:

2022-12-14 16:58:31.5440,Fatal,App,Fatal Exception,TruMed.AccuShelf.App.OnDispatcherUnhandledException,981,"System.IO.FileFormatException: StoryFragments part failed to load.
at System.Windows.Documents.FixedDocument.GetStoryFragments(FixedPage fixedPage)
at System.Windows.Documents.FixedTextBuilder.EnsureTextOMForPage(Int32 pageIndex)
at System.Windows.Documents.FlowPosition._xGetNextFlowNode()
at System.Windows.Documents.FlowPosition._vGetSymbolType(LogicalDirection dir)
at System.Windows.Documents.FixedTextPointer.System.Windows.Documents.ITextPointer.GetPointerContext(LogicalDirection direction)
at System.Windows.Documents.DocumentSequenceTextPointer.xGetClingDSTP(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
at System.Windows.Documents.DocumentSequenceTextPointer.xGapAwareGetSymbolType(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
at System.Windows.Documents.DocumentSequenceTextPointer.GetPointerContext(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
at System.Windows.Documents.DocumentSequenceTextPointer.System.Windows.Documents.ITextPointer.GetPointerContext(LogicalDirection direction)
at System.Windows.Documents.TextPointerBase.GetBorderingElementCategory(ITextPointer position, LogicalDirection direction)
at System.Windows.Documents.TextPointerBase.IsAtNormalizedPosition(ITextPointer position, Boolean respectCaretUnitBoundaries)
at System.Windows.Documents.TextPointerBase.IsAtNormalizedPosition(ITextPointer position, LogicalDirection direction, Boolean respectCaretUnitBoundaries)
at System.Windows.Documents.TextRangeBase.IsAtNormalizedPosition(ITextRange thisRange, ITextPointer position, LogicalDirection direction)
at System.Windows.Documents.TextRangeBase.CreateNormalizedTextSegment(ITextRange thisRange, ITextPointer start, ITextPointer end)
at System.Windows.Documents.TextRangeBase.SelectPrivate(ITextRange thisRange, ITextPointer position1, ITextPointer position2, Boolean includeCellAtMovingPosition, Boolean markRangeChanged)
at System.Windows.Documents.TextRangeBase.Select(ITextRange thisRange, ITextPointer position1, ITextPointer position2, Boolean includeCellAtMovingPosition)
at System.Windows.Documents.TextRange..ctor(ITextPointer position1, ITextPointer position2, Boolean ignoreTextUnitBoundaries)
at System.Windows.Documents.TextSelection..ctor(TextEditor textEditor)
at System.Windows.Documents.TextEditor..ctor(ITextContainer textContainer, FrameworkElement uiScope, Boolean isUndoEnabled)
at System.Windows.Controls.Primitives.DocumentViewerBase.AttachTextEditor()
at System.Windows.Controls.Primitives.DocumentViewerBase.OnDocumentChanged()
at System.Windows.Controls.DocumentViewer.OnDocumentChanged()
at System.Windows.Controls.Primitives.DocumentViewerBase.DocumentChanged(IDocumentPaginatorSource oldDocument, IDocumentPaginatorSource newDocument)
at System.Windows.Controls.Primitives.DocumentViewerBase.DocumentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.OnDependencyPropertyChanged(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.OnSourceInvalidation(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Run(Object arg)
at MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)
at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at System.Windows.Window.SetRootVisual()
at System.Windows.Window.SetRootVisualAndUpdateSTC()
at System.Windows.Window.SafeCreateWindowDuringShow()
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Window.Show()
at TruMed.AccuShelf.App.<>c__DisplayClass69_0.<OnApplicationStartup>b__1() in C:\TS-475\AccuShelf\App\App\App.xaml.cs:line 885
at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at TruMed.AccuShelf.App.<OnApplicationStartup>d__69.MoveNext() in C:\TS-475\AccuShelf\App\App\App.xaml.cs:line 883
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Documents.FixedDocument.GetStoryFragments(FixedPage fixedPage)
at System.Windows.Documents.FixedTextBuilder.EnsureTextOMForPage(Int32 pageIndex)
at System.Windows.Documents.FlowPosition._xGetNextFlowNode()
at System.Windows.Documents.FlowPosition._vGetSymbolType(LogicalDirection dir)
at System.Windows.Documents.FixedTextPointer.System.Windows.Documents.ITextPointer.GetPointerContext(LogicalDirection direction)
at System.Windows.Documents.DocumentSequenceTextPointer.xGetClingDSTP(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
at System.Windows.Documents.DocumentSequenceTextPointer.xGapAwareGetSymbolType(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
at System.Windows.Documents.DocumentSequenceTextPointer.GetPointerContext(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
at System.Windows.Documents.DocumentSequenceTextPointer.System.Windows.Documents.ITextPointer.GetPointerContext(LogicalDirection direction)
at System.Windows.Documents.TextPointerBase.GetBorderingElementCategory(ITextPointer position, LogicalDirection direction)
at System.Windows.Documents.TextPointerBase.IsAtNormalizedPosition(ITextPointer position, Boolean respectCaretUnitBoundaries)
at System.Windows.Documents.TextPointerBase.IsAtNormalizedPosition(ITextPointer position, LogicalDirection direction, Boolean respectCaretUnitBoundaries)
at System.Windows.Documents.TextRangeBase.IsAtNormalizedPosition(ITextRange thisRange, ITextPointer position, LogicalDirection direction)
at System.Windows.Documents.TextRangeBase.CreateNormalizedTextSegment(ITextRange thisRange, ITextPointer start, ITextPointer end)
at System.Windows.Documents.TextRangeBase.SelectPrivate(ITextRange thisRange, ITextPointer position1, ITextPointer position2, Boolean includeCellAtMovingPosition, Boolean markRangeChanged)
at System.Windows.Documents.TextRangeBase.Select(ITextRange thisRange, ITextPointer position1, ITextPointer position2, Boolean includeCellAtMovingPosition)
at System.Windows.Documents.TextRange..ctor(ITextPointer position1, ITextPointer position2, Boolean ignoreTextUnitBoundaries)
at System.Windows.Documents.TextSelection..ctor(TextEditor textEditor)
at System.Windows.Documents.TextEditor..ctor(ITextContainer textContainer, FrameworkElement uiScope, Boolean isUndoEnabled)
at System.Windows.Controls.Primitives.DocumentViewerBase.AttachTextEditor()
at System.Windows.Controls.Primitives.DocumentViewerBase.OnDocumentChanged()
at System.Windows.Controls.DocumentViewer.OnDocumentChanged()
at System.Windows.Controls.Primitives.DocumentViewerBase.DocumentChanged(IDocumentPaginatorSource oldDocument, IDocumentPaginatorSource newDocument)
at System.Windows.Controls.Primitives.DocumentViewerBase.DocumentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.OnDependencyPropertyChanged(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.OnSourceInvalidation(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Run(Object arg)
at MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)
at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at System.Windows.Window.SetRootVisual()
at System.Windows.Window.SetRootVisualAndUpdateSTC()
at System.Windows.Window.SafeCreateWindowDuringShow()
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Window.Show()
at TruMed.AccuShelf.App.<>c__DisplayClass69_0.<OnApplicationStartup>b__1() in C:\TS-475\AccuShelf\App\App\App.xaml.cs:line 885
at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at TruMed.AccuShelf.App.<OnApplicationStartup>d__69.MoveNext() in C:\TS-475\AccuShelf\App\App\App.xaml.cs:line 883
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)"

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,894 questions
{count} votes

8 answers

Sort by: Most helpful
  1. Alar Antons 11 Reputation points
    2023-01-06T12:21:05.92+00:00

    We have the same problem. Our application is used by hundreds of users and displaying XPS files plays a big role in it. In addition this security update has another issue: some XPS files are shown, but only partially, for example some of the letters are shown, most are not. Workaround in before mentioned Knowledge Base article dosen't fix this error, but alternative workaround fixes.

    Advising our paying customers to roll back the security patch doesn't seem like a viable solution, we really hope for an upcoming update, any information about it would be greatly appreciated.

    2 people found this answer helpful.
    0 comments No comments

  2. Mark Chesney 26 Reputation points
    2022-12-17T07:06:56.077+00:00

    Found the solution. There is a link provided by Microsoft in the KB5020880 Knowledge Base article: https://support.microsoft.com/en-us/topic/kb5022083-change-in-how-wpf-based-applications-render-xps-documents-a4ae4fa4-bc58-4c37-acdd-5eebc4e34556

    On that page are several suggestions for how to resolve the problem, either by running a Microsoft-supplied Power Shell script, adding a registry key to disable the patch, or using Group Policy to create the REG_SZ entry to disable the patch.

    1 person found this answer helpful.

  3. Geoffrey GESLIN 6 Reputation points
    2022-12-20T18:02:46.217+00:00

    Same pronlem here and we also display XPS documents in our products.

    Patching our clients systems is not an option !

    Can we have some insight on any upcoming update to correct the issue ?

    1 person found this answer helpful.

  4. Daniel Gallardo 6 Reputation points
    2022-12-20T18:07:47.413+00:00

    Mi solución actual fue publicar una actualización de mi App: al iniciar agrega la entrada al registro de Windows mencionada en el link.
    De todas maneras, espero que microsoft publique alguna actualización con las correcciones correspondientes.
    Mi app se esta ejecutando en 2000 equipos aproximadamente, en distintos lugares del mundo. No es una opción para mi, instalar un parche, equipo por equipo.

    1 person found this answer helpful.
    0 comments No comments

  5. Strano, Emanuele 10 Reputation points
    2023-01-31T08:26:11.6966667+00:00

    I found a temporary solution for this issue on this SO answer: https://stackoverflow.com/questions/63421763/wpf-printpreview-get-the-pagecontent-of-documentpaginator-pages

    To make long story short: you can exploit a capability of the PrintDialog control in order to create a fixeddocument sequence suitable for the WPF DocumentViewer control by yourself and avoiding the use of defective GetFixedDocument.

    For information about the issue which was corrected in the "Cumulative Update Windows 10 9KB5021088" see this chinese site: https://www-twblogs-net.translate.goog/a/62ac0eab90cad81eeb8b1970?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=de&_x_tr_pto=wapp

    Here the code I used for my custom GetFixedDocument

    public FixedDocumentSequence GetFixedDocumentSequence(FlowDocument document, object printObject)
            {
                var paginator = GetPaginator((document as IDocumentPaginatorSource).DocumentPaginator);
                var printAttr = GetPrintDocumentLoader(printObject);
                if (printAttr != null)
                {
                    paginator.Title = printAttr.GetTitle();
                    var imgPath = printAttr.GetImageSource();
                    paginator.ImageSource = string.IsNullOrEmpty(imgPath) ? null : new BitmapImage(new Uri(imgPath, UriKind.RelativeOrAbsolute));
                }
    
                paginator.HeaderText = GetInfoText(printObject, PrintInfoTextPosition.Header);
                paginator.FooterText = GetInfoText(printObject, PrintInfoTextPosition.Footer);
                var fixedDocument = new FixedDocument();
                var pdlgPrint = new PrintDialog();
    
                paginator.ComputePageCount();
                PrintCapabilities capabilities = pdlgPrint.PrintQueue.GetPrintCapabilities(pdlgPrint.PrintTicket);
    
    
                for (int iPages = 0; iPages < paginator.PageCount; iPages++)
                {
                    var page = paginator.GetPage(iPages);
                    var pageContent = new PageContent();
                    var fixedPage = new FixedPage();
    
                    Canvas canvas = new Canvas();
    
                    VisualBrush vb = new VisualBrush(page.Visual);
                    vb.Stretch = Stretch.None;
                    vb.AlignmentX = AlignmentX.Left;
                    vb.AlignmentY = AlignmentY.Top;
                    vb.ViewboxUnits = BrushMappingMode.Absolute;
                    vb.TileMode = TileMode.None;
                    vb.Viewbox = new Rect(0, 0, capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
    
                    FixedPage.SetLeft(canvas, 0);
                    FixedPage.SetTop(canvas, 0);
                    canvas.Width = capabilities.PageImageableArea.ExtentWidth;
                    canvas.Height = capabilities.PageImageableArea.ExtentHeight;
                    canvas.Background = vb;
    
                    fixedPage.Children.Add(canvas);
    
                    fixedPage.Width = pdlgPrint.PrintableAreaWidth;
                    fixedPage.Height = pdlgPrint.PrintableAreaHeight;
                    pageContent.Child = fixedPage;
                    fixedDocument.Pages.Add(pageContent);
                }
                var sequence = new FixedDocumentSequence();
                var reference = new DocumentReference();
                reference.SetDocument(fixedDocument);
                sequence.References.Add(reference);
                sequence.BeginInit();
    
                return sequence;
            }
    
    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.