Patagames Software Support Forum
»
Pdfium.Net SDK
»
Common Questions
»
How can I crop pages in pdf while saving the pages as images
Rank: Newbie
Groups: Registered
Joined: 7/30/2018(UTC) Posts: 2  Location: Panama City, Florida Thanks: 1 times
|
I have no problems saving a pdf document to a series of imgages of the full page, but don't have any idea how to apply a crop to all pages and save the pages as images. Any examples you can offer would be helpful. I am using the trial version so if it can't be done in that, please let me know. Thanks for any help you can provide!
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
You may use standard .Net image to crop already rendererd pages. Code: using (var originalImage = Image.FromFile(@"d:\0\9\page01.PNG"))
{
var rectangleForCrop = new Rectangle(50, 50, 350, 350);
using (var croppedImage = new Bitmap(rectangleForCrop.Width, rectangleForCrop.Height))
{
using (var g = Graphics.FromImage(croppedImage))
{
g.DrawImageUnscaledAndClipped(originalImage, rectangleForCrop);
}
croppedImage.Save(@"d:\0\9\page01_cropped.png", ImageFormat.Png);
}
}
Or you can render the desired page area to an image of any size. An example of similar task may be found here https://forum.patagames....functionality-as-AcrobatEdited by user Monday, July 30, 2018 6:38:38 PM(UTC)
| Reason: Not specified
|
 1 user thanked Paul Rayman for this useful post.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/30/2018(UTC) Posts: 2  Location: Panama City, Florida Thanks: 1 times
|
Thanks! I had solved it another way that let me save it cropped as I rendered the pages. But I definately appreciate this code. I can use it too.
Thanks again!
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 9/25/2026(UTC) Posts: 1  Location: USA
|
If you need to crop PDF pages before saving them as images, I’d crop the unwanted margins or sections first and then export the pages. That way, the image contains only the area you actually need. To quickly crop a PDF, you can use the Softaken Crop PDF Tool, which is an offline utility and helps you effortlessly crop a PDF file. It is built to select the required crop area and save the adjusted PDF pages without manually editing each page. Then you can export the cropped pages as images as needed. Try it on one or two pages first to make sure the crop area is correct before processing the complete PDF. Edited by user Friday, September 25, 2026 2:30:18 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Patagames Software Support Forum
»
Pdfium.Net SDK
»
Common Questions
»
How can I crop pages in pdf while saving the pages as images
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close