If it were me today I would do your second process in Itext7 so that you could save the PDF page in its original format (rotated, of course). Sorry, I have no handy code for that, but it *should* be straight forward. As I stated earlier though, there is a learning curve on Itext7 and all of their help is geared toward selling licensing. I understand their need, but it somewhat burdens the journey to get the information you need.
Toby
Posted on:13 Dec 2021 15:05
Thanks for sharing your code, what part of my application is trying to achieve is to simply allow the user open a pdf in the viewer, navigate to a page, rotate it as required and then press a button to export that page as an image.
As the viewer component itself is not capable of exporting a rotated page I'm getting the current page being viewed and its rotation state, closing the pdf viewer then opening the pdf document, deleting all pages except the one I want and then rotating it by the appropriate amount then exporting it to a file as an image. When the original PDF is type 3 its the export that throws the exception.
I'm not aware of an easier way to do this given the existing functionality of the existing components.
Any ideas ?
Al
Posted on:13 Dec 2021 14:56
Toby, for my work around I only need to add a Type 3 to a newly created PDF. For that I'm using iText7 which comes with a learning curve. Here is my combine files method.
using System; using System.Collections.Generic; using System.IO; using System.Text;
using iText.Kernel.Pdf; using iText.Kernel.Utils;
public static class PdfCombineFiles { public static bool MergePdfs(IEnumerable<string> fileNames, string targetPdf, ref string msg) { try { var sb = new StringBuilder(); var merged = true; using var stream = new FileStream(targetPdf, FileMode.Create); var doc = new PdfDocument(new PdfWriter(stream));
try { var merger = new PdfMerger(doc);
foreach (var file in fileNames) { if (File.Exists(file)) { var sourcePdf = new PdfDocument(new PdfReader(file)); merger.Merge(sourcePdf, 1, sourcePdf.GetNumberOfPages()); sourcePdf.Close(); } else { merged = false; sb.AppendLine(file + " does not exist."); } } } catch (Exception ex) { sb.AppendLine(ex.Message); merged = false; } finally { doc.Close(); msg += sb.ToString(); }
var length = new FileInfo(targetPdf).Length; if (length != 0) return merged;
Thank you for sharing your feedback with us. This request is currently with a high priority on our backlog and I forwarded your feedback to the product development. At this point, the functionality is not included in the planning for the next release due to more demanded tasks and I cannot share when it might be implemented. We will update this item as soon as we have information about its status. Continue following it so we can notify you about such changes. Please, accept our apologies for the inconvenience this missing functionality is causing you.
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/.
Toby
Posted on:08 Dec 2021 10:35
I too have just had this exact same problem reported to me by some users. In my case the exception thrown was GetItalicAngle is not supported by Type3FontSource, which is called internally when I perform an Export.
@Telerik - when will this get implemented / supported?
@ Anyone else - is there a workaround or can anyone suggest another PDF viewer component for C# which works and ideally has the ability to save rotated pages from the viewer ?
Kevin
Posted on:08 Dec 2021 10:19
Having to pay and to implement second library like PDFSharp because Telerik doesn't support Type 3 font pdf processing is really inconvenient.
We waited now 1 year for this feature, and it is still not available.
How much votes does this need that it gets scheduled for implementation?
ADMIN
Tanya
Posted on:07 Dec 2021 11:15
Hello Bruce,
The task is currently not scheduled for implementation, thus I cannot say when it might be available. Please, make sure to cast your vote to increase the priority of the request and continue following this item so you can be notified of status changes on it.