Convert vcf file to pdf file

Hello,

Can I convert a vCard file to a pdf file?

Regards.

Hi Marc,

Thank you for writing to Aspose support team.

I would like to share that Aspose.Email API doesn’t support conversion of message or any format to PDF. You can only convert messages to MHTML output and then use Aspose.Words to convert the MHTML to PDF. Please let us know if we can be of any additional help to you in this regard.

Hi,

Please, could you help me?

I suppose this code:

VCardContact vCard = VCardContact.Load("contact.vcf", Encoding.UTF8);
MemoryStream ms = new MemoryStream();
vCard.Save(ms, ContactSaveFormat.Msg);

But it’s not possible to save in Mhtml format…

Where is my error?

Regards,

Hi Marc,

At present, the VCard doesn’t support saving to MSG format. In addition, Aspose.Email provides the conversion to MHTML only for messages of type IPM.Note. Though you can use the following code for conversion to MHTML, most of the information won’t be available in the output. Please let us know if we can be of any additional help to you in this regard.

Sample Code:


MapiContact contact = MapiContact.FromVCard(“Sebastian.vcf”);


MemoryStream ms = new MemoryStream();


contact.Save(ms, ContactSaveFormat.Msg);


ms.Position = 0;


MapiMessage mapi = MapiMessage.FromStream(ms);


MailMessageInterpretor mi = MailMessageInterpretorFactory.Instance.GetIntepretor(mapi.MessageClass);

MailMessage mailMsg = mi.Interpret(mapi);


mailMsg.Save(“Sebastian.mhtml”, MailMessageSaveType.MHtmlFormat);

Thank you very much.

Hi Marc,


You are welcome and please feel free to write us back if you have any other query related to Aspose.Email.