PHP and C# communication on IIS7 (to generate dynamic PDF)

Posted by David Murdoch on Stack Overflow See other posts from Stack Overflow or by David Murdoch
Published on 2010-05-07T17:46:42Z Indexed on 2010/05/07 20:38 UTC
Read the original article Hit count: 466

Filed under:
|
|
|

Background:

I couldn't find any decent free HTML to PDF conversion utilities in C#. There are 100s of them for PHP with extensive documentation, support, and CSS support. So I am using html2ps and html2pdf (php).

I have PHP 5.2 installed on IIS7 and its working beautifully to create PDFs.

I have the following in getPDF.aspx

<!-- Output the header -->
<DM:header runat="server" ID="header" />

<asp:Placeholder id="content" runat="server" />

<!-- Output the footer -->
<DM:footer runat="server" ID="footer" />

and in getPDF.aspx.cs:

protected void Page_Load(object sender, EventArgs e){
    // AddContentControl simples adds a controls to the content Placeholder.

    AddContentControl("controls/page1.ascx");
    AddContentControl("controls/page2.ascx");
    AddContentControl("controls/page3.ascx");
}

and in generatePDF.php:

<?php
    /* ... includes and stuff here ... */

    $data = "THE HTML GOES HERE!";
    // creates the PDF from the $data and Outputs the created file.
    convert_to_pdf($data);
?>

-- getPDF.aspx works perfectly...except the output is HTML.

So how can I get getPDF.aspx to output its HTML as PDF generated by generatePDF.php?

© Stack Overflow or respective owner

Related posts about php

Related posts about c#