So for example, a single highly compressed JPEG image in your PowerPoint file can easily double in size when it is exported to the PDF and saved using Flate compression. Under certain circumstances some images which are saved as JPEG in the source presentation, are encoded into the PDF using a lossless compression format called Flate when it’s used in PDF files (its official name is Deflate).īeing lossless, Flate retains all of the image information but the downside is that the image size will be a lot bigger. We discovered that the main reason for bloated PDF files created from PowerPoint appears to be due to a little-known limitation of the PDF creator on Mac (“Quartz PDFContext”). Why are some PDF files bigger than PPTX on Mac? So we decided to run some experiments and share the results. On closer investigation we came to realise that something a little odd was going on. They had to compress it again with NXPowerLite before they could email it. They had compressed their PowerPoint file before exporting it to PDF and had been surprised to find the PDF was much larger. We first heard about this from a customer who had been troubled by this problem, and thought it might be an issue with our compression software NXPowerLite. In this post, we attempt to demystify this strange occurrence and give you some tools to help when it happens to you. In ASP.NET Core side, received the PDF stream and saved the converted PDF file.Sometimes you might experience an unexpected, and occasionally dramatic size increase when saving your PowerPoint presentation as a PDF on Mac.In ASP.NET Web API (service), the stream (input document) is converted into PDF in the service side and returned the response with resultant PDF.In ASP.NET Core sample, load the existing presentation document using Essential Presentation and send that document as stream to Web API (service) application.In this sample, the following things have been done: Return File(outputStream, "application/pdf", "Sample.pdf") OutputStream = new MemoryStream(await ()) Gets PDF from content stream if service got success Dispose the input stream and client instances Response = await client.PostAsync(requestUri, new StreamContent(inputStream)) Posts input presentation document to service and gets resultant PDF as content of HttpResponseMessage #region Service approach to send presentation document as stream and gets resultant converted PDF from it. MemoryStream inputStream = new MemoryStream() Saves a presentation into stream and close the presentation instance IPresentation presentation = Presentation.Open(fileStream) String rootPath = _hostingEnvironment.WebRootPath įileStream fileStream = new FileStream(rootPath + "/PPTX/TemplateFile.pptx", FileMode.Open) The following code snippet explains how to use the previously given web service to the ASP.NET Core applications to convert the PowerPoint file as a PDF document in ASP.NET Core application. HttpResponseMessage = new HttpResponseMessage(HttpStatusCode.ExpectationFailed) HttpResponseMessage = new HttpResponseMessage(HttpStatusCode.OK)Ĭontent = new StreamContent(memoryStream) MemoryStream memoryStream = new MemoryStream() Saves the PDF document to response stream ("Created by Syncfusion – Presentation library", pdfFont, PdfBrush pdfBrush = new PdfSolidBrush(Color.White) Create a new PDF brush to draw the rectangle PdfFont pdfFont = new PdfTrueTypeFont(font, false) Create PDF font and PDF font style using Fontįont font = new Font("Times New Roman", 12f, FontStyle.Regular) To remove this watermark, comment or delete the codes within below "if" statement Adds watermark at top left corner of first page in the generated PDF document to denote that it is generated using demo web service PdfDocument pdfDocument = PresentationToPdfConverter.Convert(presentation, settings) Converts PowerPoint presentation (PPTX) into PDF document PresentationToPdfConverterSettings settings = new PresentationToPdfConverterSettings Creates an instance of the PresentationToPdfConverterSettings Presentation.ChartToImageConverter = new ChartToImageConverter Initializes the ChartToImageConverter for converting charts during PPTX to PDF conversion ![]() Using (IPresentation presentation = Presentation.Open(stream)) Opens the PowerPoint presentation (PPTX) from stream Public HttpResponseMessage ConvertToPdf() / Converts the PowerPoint presentation (PPTX) to PDF document
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |