This is a migrated thread and some comments may be shown as answers.

Errors accessing PDFs with PdfFormatProvider

7 Answers 877 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 27 Mar 2020, 02:26 PM

I am working with the Telerik UI for WinForms 2020 R1 release and I am experiencing a multitude of issues loading PDFs into the Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider via a FileStream (for splitting into individual pages) that I can properly load into the Telerik RadPdfViewer using the Load() method with the file name.

Some of the errors that I am experiencing are "R24 color space not supported", "R25 color space not supported", and "currentIndirectObject should not be null". I cannot provide copies of these PDFs, as they all contain Protected Health Information (PHI), which is protected information under HIPPA.

7 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 30 Mar 2020, 10:15 AM

Hello Jay,

The first one (color space not supported) is a known issue that is already logged on our feedback portal. You can track its progress, subscribe to status changes and add your comment to it here: PdfProcessing: NotSupportedColorSpaceException is thrown when importing color space defined as an external resource.

Unfortunately, I cannot suggest a workaround for the issue.

I am not sure what is causing the second exception. Without a file that allows me to reproduce this, I cannot say what is causing it. Would it be possible for you to remove any sensitive information from this file and send it to us? The support tickets are private and we do not share the files with any third parties. This is noted in our EULA (point - 1.11).

I am looking forward to your reply.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Tony
Top achievements
Rank 1
answered on 25 Aug 2020, 10:01 PM
Hi Dimitar, I'm also getting a currentIndirectObject should be null error when attempting to do a simple PDF merge of some existing PDF documents into a new PDF file. I have version 2019.3.1021.40 Telerik modules. My C# code is below, but the ticket system won't allow me to upload PDFs for you to look at/test with. Do you have another way I could get them to you?

Stack trace:
System.ArgumentException: currentIndirectObject should be null
   at Telerik.Windows.Documents.Utilities.Guard.ThrowExceptionIfNotNull[T](T param, String paramName)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExportContext.BeginExportIndirectObject(IndirectObject indirectObject, Int64 offset)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.IndirectObject.Write(PdfWriter writer, IPdfExportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExporter.WritePendingIndirectObjects(IPdfExportContext context, PdfWriter writer)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExporter.WriteCatalogAndRelatedProperties(PdfWriter writer, IPdfExportContext context, DocumentCatalog catalog)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Streaming.PdfStreamWriter.WriteAllPendingPdfObjects()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Streaming.PdfStreamWriter.Dispose()

My C# code:
using(var fileWriter = new PdfStreamWriter(System.IO.File.OpenWrite(model.TargetFileUrl)))
{
     fileWriter.Settings.DocumentInfo.Author = "Acme";
     foreach(var doc in model.FilesToMerge)
     {
          using(var fileToMerge = new PdfFileSource(System.IO.File.OpenRead(doc.Location)))
          {
               foreach(var pageToMerge in fileToMerge.Pages)
               {
                    fileWriter.WritePage(pageToMerge);
               }
          }
     }
}
0
Dimitar
Telerik team
answered on 26 Aug 2020, 10:31 AM

Hi Jay,

It would better to attach the fields.

The forum threads allow attaching only images. It would be better to open a new support ticket for this. You can attach files up to 20 megabytes per thread. Please note that you should add the files to an archive (zip, rar) and then attach them. Is this approach suitable for you? 

I am looking forward to your reply.

Regards,
Dimitar
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

0
Tony
Top achievements
Rank 1
answered on 27 Aug 2020, 02:33 PM

Hi Dimitar, would it be possible for you to attempt the code I submitted with a couple PDF files of your own and the same version of the code base and see if you get the same error? I don't think the PDF files really matter here. They are valid PDF files that open successfully on their own.

Thanks

0
Dimitar
Telerik team
answered on 28 Aug 2020, 06:11 AM

Hi Jay,

I have tested this with some sample files and it works on my side. I have attached my test project that shows this with your code.

Please note that the PDF standard supports many features and usually something very specific in the file is causing the issues. Please consider submitting a ticket with the files. This will allow us to properly investigate this case.

Let me know if you have any other questions.

Regards,
Dimitar
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

0
Andrey
Top achievements
Rank 1
answered on 25 Nov 2020, 05:27 PM
Tony, were you able to solve this issue. I too am having this problem. My first guess, was that it was a particular PDF that was giving the issue. Other PDF's works with no problem.
0
Dimitar
Telerik team
answered on 26 Nov 2020, 08:04 AM

Hello Andrey,

This might be caused by a known issue that has a workaround. The issue details are located here:  PdfProcessing: ArgumentException when merging or splitting files with PdfStreamWriter.

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
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/.

Tags
PdfProcessing
Asked by
Jay
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Tony
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Share this question
or