How to convert a page . aspx to PDF and attach in email in VB.NET

Asked

Viewed 1,101 times

0

I have a Link that opens a boleto on a .aspx. I need to convert this link to PDF, IE, convert the Boleto in PDF and attach it in the email I send via VB. I tried the steps of this tutorial: http://www.aspsnippets.com/Articles/Generate-Create-PDF-and-send-as-email-attachment-in-ASPNet.aspx

But it only explains how to convert when HTML is on the same page, and I need to convert another link, which contains the boleto.

I’m using itextSharp, ASP/VB.NET

Could you help me?

Thanks in advance.

=============================EDITION=====================================

I’ve tried so many ways, this is the last one I’ve tried:

Dim pdfDoc As New Document()
Dim wr As PdfWriter = PdfWriter.GetInstance(pdfDoc, New FileStream(pdfPath,   FileMode.Create))
pdfDoc.Open()
pdfDoc.Add(wr)
pdfDoc.Close()

The exception I get is this: No support for URI formats.

I need a way to interpret the URL and convert Boleto to PDF, the examples I found only show how to create a new PDF from the HTML of the page itself. =[

Thank you!

  • you have no idea how to do or started anything?

  • I have never been very happy when using libraries . NET converting HTML to PDF, so I advise you to take a look at Phantomjs, you can integrate it into your application using the following wrapper, or using the Edgejs which is available in the following nuget.

  • @Rafaelacioly I never did anything like this, my starting point was the tutorial of the link I posted, the part of the email is functional, the question is only the conversion of the link and attach it in the email depending on how it is saved.

  • @Tobymosque I’ll take a look at that, thank you!

  • It’s just that usually people can help you better if you already have some piece of code or some idea of how to do it, the right question/post would be, "I’m trying to do it this way...?"

  • @Rafaelacioly I edited with the excerpt I just tested.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.