PdfSharpCore icon indicating copy to clipboard operation
PdfSharpCore copied to clipboard

Paragraph.AddImage Broken

Open mbarnet opened this issue 3 years ago • 5 comments

I consistently get an exception (without useful detail) when Paragraph.Addimage is executed. I have tried several iterations of this method call without success AddImage Bug.pdf .

mbarnet avatar Jun 03 '22 20:06 mbarnet

Hi @mbarnet, looking at the src code, you are using the abstract ImageSource class and the ImageSourceImpl is probably null. Try setting it to something like

ImageSource.ImageSourceImpl = new ImageSharpImageSource<Rgba32>();

before you call ImageSource.FromFile

jafin avatar Jun 05 '22 12:06 jafin

Thanks. Is there any code documentation for this suite? Even an xml built by VS compiler would be helpful in understanding how the parts work together. So far I’ve muddled along using the public names of classes, variables, and methods. This example shows why that isn’t sufficient.

  • Mark

From: Jason @.> Sent: Sunday, June 5, 2022 5:53 AM To: @.> Cc: @.>; @.> Subject: Re: [ststeiger/PdfSharpCore] Paragraph.AddImage Broken (Issue #258)

@mbarnethttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmbarnet&data=05%7C01%7C%7C0b53a2e5b07a464e263b08da46f2650e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637900304130937810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MayBZLR%2Fr%2B8CNNR5fUJv7f8dQxnI0AAasZbrV%2Fq6C2A%3D&reserved=0, looking at the src code, you are using the abstract ImageSource class and the ImageSourceImpl is probably null. Try setting it to something like before you call ImageSource.FromFile

ImageSource.ImageSourceImpl = new ImageSharpImageSource<Rgba32>();

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fststeiger%2FPdfSharpCore%2Fissues%2F258%23issuecomment-1146799420&data=05%7C01%7C%7C0b53a2e5b07a464e263b08da46f2650e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637900304130937810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KoUGLuvkwHte56adn5Lrp2gFJk9DunhVwZNP3o3f9Kk%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABY5W25FFJ7IR5JSAGSCIOLVNSPMXANCNFSM5X2BEKJQ&data=05%7C01%7C%7C0b53a2e5b07a464e263b08da46f2650e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637900304130937810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ukdtquDM%2BdmeZv1De6ujUdXFQqmxHgKu4M7xhOOadX4%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

mbarnet avatar Jun 05 '22 14:06 mbarnet

Re documentation see thread #244 . Contributors are working on porting over the docs from the empira wiki. For most things the original docs should still be valid. PRs also welcome.

jafin avatar Jun 05 '22 23:06 jafin

I have an html document in my project that I would like to include in a PDF document. I’m using both the Rendering and MigraDocCore stuff. How can I add the document as it would appear in a browser?

  • Mark

From: Jason @.> Sent: Sunday, June 5, 2022 4:28 PM To: @.> Cc: @.>; @.> Subject: Re: [ststeiger/PdfSharpCore] Paragraph.AddImage Broken (Issue #258)

Re documentation see thread #244https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fststeiger%2FPdfSharpCore%2Fissues%2F244&data=05%7C01%7C%7C93c4002758a04a53cb5008da474b18c0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637900685112519259%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=YvyJtUiTvFHKsZ7pVqZKaF93mfKdd7NjFSoC3iVuLx8%3D&reserved=0 . Contributors are working on porting over the docs from the empira wiki. For most things the original docs should still be valid. PRs also welcome.

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fststeiger%2FPdfSharpCore%2Fissues%2F258%23issuecomment-1146906233&data=05%7C01%7C%7C93c4002758a04a53cb5008da474b18c0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637900685112519259%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uFB56kYN%2BLgNGu2Uw3bc0%2Bo45e%2FfJLenjSi3W9CflE8%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABY5W22YXYKARS7IWALBWNTVNUZZZANCNFSM5X2BEKJQ&data=05%7C01%7C%7C93c4002758a04a53cb5008da474b18c0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637900685112519259%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=idbaj48Jv5YmtctggZnbN4pShxfAoESsIyAFjyvzioQ%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

mbarnet avatar Jun 15 '22 18:06 mbarnet

Is there a way to either convert a System.Windows.Media.ImageSource (which can get project resource images) to a MigraDocCore.DocumentObjectModel.Migradoc.Docum entObjectModel.Shapre.ImageSource? Alternately, is there a way to get an image from a project's Resources rather than a filesystem file?

mbarnet avatar Jul 10 '22 15:07 mbarnet