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
|
|
|
|
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
|
|
|
|
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.