Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Mar 10, 2022 11:04 am

Hello,

I use spire pdf in c# for cutting pdf.
I' cutting pdf because we have trouble to display them on our tablets.

This my code :
Code: Select all
            PdfDocument doc = new PdfDocument();
            doc.LoadFromFile(inputFileName);
            PdfPageBase page = doc.Pages[0];
            float width = page.Size.Width;
            float height = page.Size.Height;
            SizeF sizeF = new SizeF(this.largeurPC * height, this.hauteurPC * width);
            PdfDocument newDoc1 = new PdfDocument();
            PdfPageBase newPage1 = newDoc1.Pages.Add(sizeF, new Spire.Pdf.Graphics.PdfMargins(0));
            page.CreateTemplate().Draw(newPage1.Canvas, new PointF(-this.decLargeurPC * height, -this.decHauteurPC * width));
            newDoc1.SaveToFile(outputileName);


It's working weel but the cut files have exactely the same weight than the original file.
it's like all the data are keep inside the pdf, even the data "outside of the screen".

Is-it possible to delete the data "outside of the screen" ?

Thanks a lot for your help.

Best regards,

camille_59
 
Posts: 12
Joined: Mon Feb 01, 2021 4:21 pm

Fri Mar 11, 2022 2:18 am

Hello,

Thank you for your inquiry.
I did an initial test with your code, but didn't reproduce the issue you mentioned. The version I used is the latest Spire.PDF (Spire.PDF Pack(Hot Fix) Version:8.2.2). If you were not using the latest version, please first give it a try. If the issue still exists after trying, please provide the following information. You could attach them here or send them to us via email ([email protected]). Thanks in advance.
1) Your input PDF file.
2) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).
3) Your application type, such as Console app (. Net Framework 4.5).

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Fri Mar 11, 2022 10:34 am

Hello,

Thanks for your reply.

I updated FreeSpire.pdf to 8.2.0 version. The result is the same.
1) Your input PDF file. -> I will send it by mail.
2) Your test environment (-> Windows 10 Entreprise, 64-bit) and region setting (french).
3) Your application type -> Console app (. Net Framework 4.8).

Best regards,

camille_59
 
Posts: 12
Joined: Mon Feb 01, 2021 4:21 pm

Mon Mar 14, 2022 2:24 am

Hello,

Thank you for your sharing.
I'm sorry for misunderstanding your issue earlier. Kindly note that when our Spire.PDF splits the document, it only clips the document to display the content that needs to be displayed, and the actual content of the entire page does not change, so the document size is basically the same. Even with Adobe for page cutting, the result is the same. Hope you can understand.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.PDF