PdfFormatProvider Export - NullReferenceException

6 posts, 1 answers
  1. Jonas
    Jonas avatar
    3 posts
    Member since:
    Mar 2019

    Posted 02 Mar Link to this post

    Hello, I'm trying out the DevCraft trial to do conversion from pdf to pdfa, however the .Export method throws a nullreference exception far inside the Telerik-components. Not sure how to proceed, since the error tells me nothing.

    I followed the example shown here: https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/howto/comply-with-pdfa-standard

    The exception thrown:

    The type initializer for 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.ColorSpaces.IccProfileObject' threw an exception.
       at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.ColorSpaces.IccProfileObject.get_SRgbProfile()
       at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.OutputIntent..ctor()
       at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPagePropertiesFrom(IRadFixedDocumentExportContext context)
       at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPropertiesFrom(IRadFixedDocumentExportContext context)
       at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExporter.Export(IRadFixedDocumentExportContext context, Stream output)
       at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ExportOverride(RadFixedDocument document, Stream output)
       at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Export(T document, Stream output)
       at Telerik.Windows.Documents.Common.FormatProviders.BinaryFormatProviderBase`1.Export(T document)
       at PdfaConverter.Tjenester.Converters.PdfConverter.ConvertToPdfa(string base64) in E:\Repositories\PdfaConverter\PdfaConverter\Tjenester\Converters\PdfConverter.cs:line 21
       at ConsoleTest.Program.Konverter(String inputPath, String outputPath, IConverter converter, String filetype) in E:\Repositories\PdfaConverter\ConsoleTest\Program.cs:line 51
       at ConsoleTest.Program.KonverterPdfToPdfa() in E:\Repositories\PdfaConverter\ConsoleTest\Program.cs:line 24
       at ConsoleTest.Program.Main(String[] args) in E:\Repositories\PdfaConverter\ConsoleTest\Program.cs:line 17

     

    My code:

    public string ConvertToPdfa(string base64)
    {
        PdfFormatProvider provider = new PdfFormatProvider();
        var document = provider.Import(Convert.FromBase64String(base64));
     
        PdfExportSettings settings = new PdfExportSettings();
        settings.ComplianceLevel = PdfComplianceLevel.PdfA2B;
        provider.ExportSettings = settings;
     
        return Convert.ToBase64String(provider.Export(document));
    }
  2. Jonas
    Jonas avatar
    3 posts
    Member since:
    Mar 2019

    Posted 02 Mar in reply to Jonas Link to this post

    This is a .net5.0 asp.net core application btw.
  3. Answer
    Tanya
    Admin
    Tanya avatar
    934 posts

    Posted 02 Mar Link to this post

    Hi Jonas,

    I have just replied to the support ticket you submitted about this question. Would you please provide the document you are using there so we can investigate the case? I would suggest continuing the discussion in the support ticket so we can keep the information about the case consistent. Thank you in advance for your cooperation.

    Regards,
    Tanya
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

  4. loe
    loe avatar
    4 posts
    Member since:
    Jun 2020

    Posted 17 Mar in reply to Tanya Link to this post

    Hi

    I am facing the same issue. Can you share any news?

    Thanks!

  5. Jonas
    Jonas avatar
    3 posts
    Member since:
    Mar 2019

    Posted 17 Mar in reply to loe Link to this post

    Hey, 

    This is being fixed for the next release, but to work around it I downgraded my assemblies to 118.

  6. loe
    loe avatar
    4 posts
    Member since:
    Jun 2020

    Posted 17 Mar in reply to Jonas Link to this post

    Thank you for your reply, that works for me!
Back to Top