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. Image for the cookie policy date

How to shrink that file

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

5 Replies

CM Chinnu Muniyappan Syncfusion Team 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 



MV mvxyc 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


CM Chinnu Muniyappan Syncfusion Team 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 



MV mvxyc 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 ?!


CM Chinnu Muniyappan Syncfusion Team 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 


Loader.
Live Chat Icon For mobile
Up arrow icon