Welcome Guest Search | Active Topics | Sign In | Register

problem with afterRenderPage Options
Becky
Posted: Monday, May 28, 2012 2:35:37 PM
Rank: Advanced Member
Groups: Member

Joined: 5/24/2012
Posts: 45
Hi,
I tried to plug in your sample code to use the after render page to make some changes to my headers and I am receiving a syntax error on the setting of the options.AfterRenderPage to pdfPgeEventHandler(On_AfterRenderPage) setting.

my code to set the option is:
Code: Visual Basic.NET
HtmlToPdf.Options.AfterRenderPage = New PdfPageEventHandler(On_AfterRenderPage)


The On_AfterRenderPage in the parenthesis is underlined in blue and the error is: 'pdfpageeventhandler' is a delegate type and requires a single 'address of' expression as the only argument to the constructor.

and my sub code is:
Code: Visual Basic.NET
Private Sub On_AfterRenderPage(ByVal sender As Object, ByVal e As EO.Pdf.PdfPageEventArgs)
        'Set the output area to the top portion of the page. Note
        'this does not change the output area of the original
        'conversion from which we are called
        EO.Pdf.HtmlToPdf.Options.OutputArea = New RectangleF(0, 0, 8.5F, 1.0F)

        'Render an image and a horizontal line. Note the
        'second argument is the PdfPage object
        EO.Pdf.HtmlToPdf.ConvertHtml(vbCr & vbLf & _
            "    <img src='http://www.essentialobjects.com/images/logo.gif' >" & vbCr & vbLf & _
            "    <br />", _
             e.Page)
    End Sub


Can you see what I am doing wrong?
Thanks,
Becky
eo_support
Posted: Monday, May 28, 2012 2:52:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

The syntax in our help file about this is wrong. The correct syntax should be:

Code: Visual Basic.NET
HtmlToPdf.Options.AfterRenderPage = _ 
    New PdfPageEventHandler(AddressOf On_AfterRenderPage)

Note the "AddressOf" keyword before On_AfterRenderPage.

Thanks!
Becky
Posted: Monday, May 28, 2012 3:26:38 PM
Rank: Advanced Member
Groups: Member

Joined: 5/24/2012
Posts: 45
Thank you - it's working much better now!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.