Skip to content

InvalidFontFormatException: No encoding found with name /PDFDocEncoding to use as base encoding #1284

Description

@ghosttie

We're getting this exception when splitting this PDF:

UglyToad.PdfPig.Fonts.InvalidFontFormatException: No encoding found with name /PDFDocEncoding to use as base encoding.
   at UglyToad.PdfPig.PdfFonts.Parser.EncodingReader.ReadEncodingDictionary(DictionaryToken encodingDictionary, Encoding fontEncoding)
   at UglyToad.PdfPig.PdfFonts.Parser.EncodingReader.Read(DictionaryToken fontDictionary, FontDescriptor descriptor, Encoding fontEncoding)
   at UglyToad.PdfPig.PdfFonts.Parser.Handlers.Type1FontHandler.Generate(DictionaryToken dictionary)
   at UglyToad.PdfPig.PdfFonts.FontFactory.Get(DictionaryToken dictionary)
   at UglyToad.PdfPig.Content.ResourceStore.LoadFontDictionary(DictionaryToken fontDictionary)
   at UglyToad.PdfPig.Content.ResourceStore.LoadResourceDictionary(DictionaryToken resourceDictionary)
   at UglyToad.PdfPig.Graphics.BaseStreamProcessor`1.ProcessFormXObject(StreamToken formStream, NameToken xObjectName)
   at UglyToad.PdfPig.Graphics.BaseStreamProcessor`1.ApplyXObject(NameToken xObjectName)
   at UglyToad.PdfPig.Graphics.Operations.InvokeNamedXObject.Run(IOperationContext operationContext)
   at UglyToad.PdfPig.Graphics.BaseStreamProcessor`1.ProcessOperations(IReadOnlyList`1 operations)
   at UglyToad.PdfPig.Graphics.BaseStreamProcessor`1.ProcessFormXObject(StreamToken formStream, NameToken xObjectName)
   at UglyToad.PdfPig.Graphics.BaseStreamProcessor`1.ApplyXObject(NameToken xObjectName)
   at UglyToad.PdfPig.Graphics.Operations.InvokeNamedXObject.Run(IOperationContext operationContext)
   at UglyToad.PdfPig.Graphics.BaseStreamProcessor`1.ProcessOperations(IReadOnlyList`1 operations)
   at UglyToad.PdfPig.Graphics.ContentStreamProcessor.Process(Int32 pageNumberCurrent, IReadOnlyList`1 operations)
   at UglyToad.PdfPig.Parser.PageFactory.ProcessPage(Int32 pageNumber, DictionaryToken dictionary, NamedDestinations namedDestinations, MediaBox mediaBox, CropBox cropBox, UserSpaceUnit userSpaceUnit, PageRotationDegrees rotation, TransformationMatrix initialMatrix, IReadOnlyList`1 operations)
   at UglyToad.PdfPig.Content.BasePageFactory`1.ProcessPageInternal(Int32 pageNumber, DictionaryToken dictionary, NamedDestinations namedDestinations, MediaBox mediaBox, CropBox cropBox, UserSpaceUnit userSpaceUnit, PageRotationDegrees rotation, TransformationMatrix& initialMatrix, ReadOnlyMemory`1 contentBytes)
   at UglyToad.PdfPig.Content.BasePageFactory`1.Create(Int32 number, DictionaryToken dictionary, PageTreeMembers pageTreeMembers, NamedDestinations namedDestinations)
   at UglyToad.PdfPig.Content.Pages.GetPage[TPage](IPageFactory`1 pageFactory, Int32 pageNumber, NamedDestinations namedDestinations, ParsingOptions parsingOptions)
   at UglyToad.PdfPig.Content.Pages.GetPage(Int32 pageNumber, NamedDestinations namedDestinations, ParsingOptions parsingOptions)
   at UglyToad.PdfPig.PdfDocument.GetPage(Int32 pageNumber)
   at UglyToad.PdfPig.Writer.PdfDocumentBuilder.AddPage(PdfDocument document, Int32 pageNumber, AddPageOptions options)
   at UglyToad.PdfPig.Writer.PdfDocumentBuilder.AddPage(PdfDocument document, Int32 pageNumber)
   at ETR.BusinessLogic.Services.Concrete.PDFService.SplitPdf(Stream stream) in C:\Users\ghost\source\repos\ETR\ETR.BusinessLogic\Services\Concrete\PDFService.cs:line 132
   at ETR.BusinessLogic.Services.Concrete.PDFService.SplitPages(Stream stream) in C:\Users\ghost\source\repos\ETR\ETR.BusinessLogic\Services\Concrete\PDFService.cs:line 29
   at ETR.Controllers.DocumentCaptureController.CreateUploadedFileFromFormFileAsync(IFormFile file) in C:\Users\ghost\source\repos\ETR\ETR\Controllers\DocumentCaptureController.cs:line 166
   at ETR.BusinessLogic.Extensions.IEnumerableExtensions.SelectAsync[TSource,TResult](IEnumerable`1 source, Func`2 selector, CancellationToken cancellationToken)+MoveNext() in C:\Users\ghost\source\repos\ETR\ETR.BusinessLogic\Extensions\IEnumerableExtensions.cs:line 8
   at ETR.BusinessLogic.Extensions.IEnumerableExtensions.SelectAsync[TSource,TResult](IEnumerable`1 source, Func`2 selector, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
   at ETR.BusinessLogic.Extensions.IAsyncEnumerableExtensions.ToDisposableListAsync[T](IAsyncEnumerable`1 source, CancellationToken cancellationToken) in C:\Users\ghost\source\repos\ETR\ETR.BusinessLogic\Extensions\IAsyncEnumerableExtensions.cs:line 9
   at ETR.BusinessLogic.Extensions.IAsyncEnumerableExtensions.ToDisposableListAsync[T](IAsyncEnumerable`1 source, CancellationToken cancellationToken) in C:\Users\ghost\source\repos\ETR\ETR.BusinessLogic\Extensions\IAsyncEnumerableExtensions.cs:line 9
   at ETR.Controllers.DocumentCaptureController.SaveCapturedDocuments(List`1 files, Nullable`1 etrId, Nullable`1 recipientId, Boolean barcode) in C:\Users\ghost\source\repos\ETR\ETR\Controllers\DocumentCaptureController.cs:line 96
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)

50058.pdf

The user says they've used this PDF before without an error but I can't confirm that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions