We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to shrink that file

Thread ID:

Created:

Updated:

Platform:

Replies:

125980 Sep 15,2016 05:51 PM UTC Sep 21,2016 10:56 AM UTC ASP.NET MVC 5
loading
Tags: PDF
mvxyc
Asked On September 15, 2016 05:51 PM UTC

Hi, Iam looking for a way how to shrink that file(attachment), the picture/content is in the middle of the file.
I need to iterate throughout a pdf file with more than 30 of these page.content is at the same positon.
How?

Attachment: example_4302c8ed.7z

Chinnu Muniyappan [Syncfusion]
Replied On September 16, 2016 08:01 AM UTC

Hi Mvxyc, 

Thank you for contacting Syncfusion support. 

We have created a workaround sample for your requirement, please refer the below sample for more details. 
Sample link: 
 
Please let us know if the sample is full fill your actual requirement or provide us more details about your requirement so that we will provide you a prompt solution.  


Regards, 
Chinnu 


mvxyc
Replied On September 16, 2016 07:41 PM UTC

No, you missunderstood me. I need to shrink the pdf to the size of the image inside of that pdf. Resizing an existing pdf with many pages which look like the example i gave you

Chinnu Muniyappan [Syncfusion]
Replied On September 19, 2016 11:31 AM UTC

Hi Mvxyc, 
Thank you for your update. 
 
We have created a sample for reducing the PDF document size, for compressing the existing images and replace it. Please find the below code snippet and sample for more details. 
 
           //Loads the PDF document which c images 
            PdfLoadedDocument loadedDocument = new PdfLoadedDocument(Server.MapPath("../App_Data/example.pdf")); 
 
            //Disables the incremental update 
            loadedDocument.FileStructure.IncrementalUpdate = false; 
 
            //Iterates all the pages to replace images 
            foreach (PdfPageBase page in loadedDocument.Pages) 
            { 
                //Extracts the images from the document 
                Image[] extractedImages = page.ExtractImages(); 
 
                //Iterates all the image 
                for (int j = 0; j < extractedImages.Count(); j++) 
                { 
                    PdfBitmap img = new PdfBitmap(extractedImages[j]); 
 
                    //Reduces the quality of the image 
                    img.Quality = 50; 
 
                    //Replaces the compressed image with old image in the PDF document 
                    page.ReplaceImage(j, img); 
                } 
            } 
 
 
Sample link: 
 
 
Please let us know if you have any concern. 
 
Regards, 
Chinnu 


mvxyc
Replied On September 20, 2016 05:19 AM UTC

no, this not what iam looking for. Inside "example_4302c8ed.7z" there is a pdf, which contains an Image, the problem here is that the pdf is huge(i think 6000x6000), I want to extract that picture and save it to a new file.But I dont know how ?!

Chinnu Muniyappan [Syncfusion]
Replied On September 21, 2016 10:56 AM UTC

Hi Mvxyc, 
Thank you for your update. 

PdfPage.ExtractImages method helps to extract the images form the existing PDF document. We have created a sample for extracting the images from existing PDF document and save it to the new PDF document for your reference. Please refer the below sample for more details. 

Sample link: 

Regards, 
Chinnu 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;