Setup my asp.net server to accept php scripts. This is relatively easy. There is plenty of information about this online. Many asp.net hosting companies allow for both technologies to run at the same time.
Generated HTML in my asp.net code and wrote it to a text file. Then called the php script / file to read my text file and generate a PDF document.
Asp.net code
// create my html document to generate into PDF
string html = "";
html += " ;
html += "";
// create the file name
string filename = string.Format(this.Server.MapPath("temp//data{0}.txt", System.Guid.NewGuid().ToString());
// create a writer and open the file
TextWriter tw = new StreamWriter(filename, false, System.Text.Encoding.ASCII);
// write a line of text to the file
tw.WriteLine(data);
// close the stream
tw.Close();
// redirect to the php file that will generate the PDF
Response.Redirect("pdf.php?pdfID=" + filename);
Php code:
if(isset($_GET['pdfID']))
$pdfID = $_GET['pdfID'];
$filename=$pdfID;
$output="";
$file = fopen($filename, "r");
while(!feof($file)) {
//read file line by line into variable
$output = $output . fgets($file, 4096);
}
fclose ($file);
//unlink($filename);
$html = $output;
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("pdf.pdf");
Issues one may face:
The php scripting has to have various functions allowed to run domPDF. If you have php error logging on you can quickly identify which functions and settings need to be enabled in the php.ini file.


