This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
service-it-01  
#1 Posted : Sunday, April 15, 2018 11:03:16 PM(UTC)
service-it-01

Rank: Newbie

Groups: Guest
Joined: 4/15/2018(UTC)
Posts: 9

Thanks: 1 times
Hello,

I have some pdf with picture in it. How can I open pdf and extract the jpg ?

Thx, David

Eugene Kosmin  
#2 Posted : Monday, April 16, 2018 6:19:38 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Guest
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Hi,

you can use BeforeDrawImage event:

Code:
var pdfPath = "myPDF.pdf";
const float dpi = 150;

using (var pdfReader = new PdfReader(pdfPath, dpi, dpi))
using (var content = pdfReader.Frames[0].GetContent())
using (var dumpContainer = new GraphicsContainer(pdfReader.Frames[0]))
using (var gr = dumpContainer.GetGraphics())
{
    int index = 0;

    gr.BeforeDrawImage += (sender, args) =>
    {
        args.Bitmap.Save($"Image_{index}.tif");
        index++;
        args.Cancel = true;
    };

    gr.DrawContainer(content, 0, 0);
}
Best regards,

Eugene Kosmin

The Aurigma Development Team

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.