Saving an email to PDF without oversized embedded images

I’m trying to save e-mail body to PDF, which works.

But when there are oversized inline/embedded images present in the body, the resulting PDF is not nice to view and also the oversized images are not shown completely.

Is there a way to remove these oversized images from the linkedresources?

I now check the linked resource and remove it from the collection, but the resulting PDF has grey squares in the location of the oversized images…

Hi Jonathan,


Thank you for writing to Aspose Support team.

There is no such way to remove the image links from the message body using Aspose.Email API. LinkedResources.Clear just removes all the linked resources from the message, but the traces will be there in the message body.

Alternatively, may be you can use Aspose.Words API to remove the image node from the MHTML document. I am moving this query to Aspose.Total forum so that our fellow team members can further assist you in this regard if there exists such a possibility. We appreciate your little patience until then.

Hi Jonathan,


Thanks for your inquiry. Please attach the following resources here for testing:

  • Your input email file
  • Aspose.Email generated MHTML file
  • Aspose.Words generated PDF file showing the undesired behavior
  • Please attach your expected PDF document showing the desired output here for our reference. You can create expected document from MHTML using Microsoft Word.
  • Please create a standalone console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,

Just create an e-mail with inline images. These will be translated to LinkedResources.




For the moment it is possible to add/delete items from the list of LinkedResources, but that doesn’t change anything at the output side. The BodyHtml property from the MailMessage object will keep a reference to the specific ContentId.




This will result in a grey box for deleted content (removed from LinkedResources) or a ‘no show’ for added content (add to LinkedResources).




I Actually see no viable use for the ability to add/remove items from the LinkedResources if there is no API-way to create/change/delete them from the output.




I now resolved it by changing the BodyHtml property of the MailMessage object myself prior to generating the output… I can even replace it with a text/image placeholder…




Maybe this functionality can be added to the API?

Hi Jonathan,


Thank you for sharing your further concerns.

At present, there is no such way to remove references of linked resources from html body. An enhancement ticket with id: EMAILNET-38524 has been logged for any such possible implementation. This will provide an option for modifying message’s html body when a linked resource is removed from the linked resources collection. We’ll update you here once there is some information available in this regard.

The issues you have found earlier (filed as EMAILNET-38524) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.