0

I have a page with a fax button on it... when clicked it uses a dialog to capture the destination of the fax from a drop down list.

What I need to do is apply the print stylesheet and capture the webpage.

I am using RightFax webservice "OpenText" to send the fax.

How do I:

1: capture the HTML and style for the webpage 2: serialize the HTML into a byte array so I can add it as an attachment

using MVC 5 and c#

Thanks in anticipation.

WeePecky
  • 57
  • 1
  • 8
  • Fax a webpage <> :). Does OpenText expect HTML? If so, I don't see how you can apply the print style sheet, do you mean you want to link to a print style sheet in the HTML? Or is OpenText expecting a BMP? You know you can access the HTML with `document.documentElement.innerHTML` – Jim W Oct 12 '17 at 03:33
  • Shudder indeed... OpenText takes a byte array into a property called "Attachment" ... I have a serialization method that takes an object and returns byte[]. It does not like string or htmlstring but it does like PDF. I don't want to save to disk, as I want this to be a seemless experience. I am thinking xml ... but I am at a loss. – WeePecky Oct 12 '17 at 08:47

1 Answers1

1

I think you have to base your solution server side. You'll need a page or service that takes a URL as a parameter, it will then need to

  1. Use WebClient to load the website HTML from the URL

--If you can send a BMP byte[] to OpenText--

  1. Use a toolkit like WebKit https://github.com/webkitdotnet/webkitdotnet to render the HTML to an image.

  2. Send the BMP byte[] to OpenText

--If you can't send a BMP byte[] to OpenText--

  1. Use a HTML to PDF converter Convert HTML to PDF in .NET

  2. Send the PDF to OpenText

The main point is that you'll be converting HTML to a binary object server side, and making the call to OpenText from the server too.

Jim W
  • 4,866
  • 1
  • 27
  • 43