using PdfFormatProvider() to load a simple PDF. I am getting the error import not supported:
I have read that there limitations to PDF files being imported, however, the file being imported was generated with FixedContentEditor, so, should be able to import?
You cannot use the WordsProcessing library to merge the PDF files. Currently, the WordsProcessing library support conversion to PDF from other file formats, but PDF files cannot be imported.
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/.
Anoosh
Posted on:07 Dec 2021 05:20
I am running into the same issue again. If this thread is closed, I will open a new one.
I am writing a quick method to merge several PDFs:
public string Merge(string OutputPath, List<string> MergeFilePaths, out string Errors) { Errors = null; DocumentConverter Converter = new DocumentConverter(); if (!string.IsNullOrEmpty(Errors)) return null; string TempDir = Utils.GetTempDir(); PdfFormatProvider PdfFormatProvider = new PdfFormatProvider(); RadFlowDocument MergeIntoDocument = new RadFlowDocument(); foreach (string OnePath in MergeFilePaths) { string ConvertedPath = Converter.ConvertFileIfNecessary(OnePath, "pdf", out Errors); ConvertedPath = ConvertedPath.Replace("\\", "/").Replace(TempDir, "/MedusaTemp"); // Make virtual if (!string.IsNullOrEmpty(Errors)) return null; using (Stream OnceStream = File.OpenRead(ConvertedPath)) { RadFlowDocument OneDocument = PdfFormatProvider.Import(OnceStream); MergeIntoDocument.Merge(OneDocument); } } File.WriteAllBytes(OutputPath, PdfFormatProvider.Export(MergeIntoDocument)); return OutputPath; }
Given my past experience, I am converting paths to virual, even though not sure why it matters as PdfFormatProvider is importing from a stream. I still get "'Import not supported." when PdfFormatProvider.Import(OnceStream)
Example of the path value in absolute and virtual is:
Looks like the issue was the file location. PDF processing requires the path to be in the same directory structure as the website. Solved by creating a virtual directory pointing to the actual file directory.
ADMIN
Dimitar
Posted on:01 Feb 2021 11:17
Hi Anoosh,
You should be able to import a file created with our library. Can you send me the file and the code that you have used to generate it? This will allow me to properly investigate this case and determine what is causing such issues.
Please note that this is a public tread and the file will be seen by other users as well. If there is confidential information in the file please open a new support ticket and attach it there.
I am looking forward to your reply.
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/.