Search
 

Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Tags

[userimage] 64 bit Active Forums Analytics ARB asp.net asp.net validation AuthARB Authorize.NET Back Button Basecamp Blog blog posts Browser Back Browser Close Browser History Browser Script cascading style sheet chip levinson client side validation Close Browser Close Window completion event content localization Count Timer Countdown CRM css csv Cursor customer feedback Data Data Springs data springs collection datasprings Date Time JavaScript Debug Info default value Demonstration DNN DNN Authentication DNN Blog DNN Core Profile Property dnn html module dnn modules dnn schedule error dnn schedule multiple dotnetnuke dotnetnuke 5.4.4 DotNetNuke Forums DotNetNuke Modules dotnetnuke reporting dotnetnuke scheduler dotnetnuke user image DropDown Login dynamic Dynamic Data dynamic fields dynamic forms dynamic forms silent post Dynamic Forms Tutorial Dynamic Login Dynamic PDF Form Completion Event dynamic registration dynamic registration silent post dynamic registration user image dynamic user directory dynamic views DynamicRegistration_Question DynamicRegistration_QuestionResponse email email issues Event Viewer Excel Export Export to Excel Facebook Facebook Connect Form Post Formatting Forms Forum Flow guides hidden field Highrise Highrise API HTTP Post Integration Interface iPAD iPAD App for Highrise iPAD Highrise App Items JavaScript Lead Generation LinkedIn list import Live Blog localization Login login module login skin object Mandeeps Microsoft Live Writer module configuration Modules oAuth2 Open Web Studio opt in email OWS Part 1 Part 2 payment gateway paypal Phone Number Products profile question fields Recurring Billing Redirect registration replace html text report views reports resource files resx Sales Force SalesForce Script Scripting server side validation Silent Post Single Sign On skin object Springs sql 2005 pivot sql default value sql import sql query sql replace statement sql reports SQL Server sql server 2005 SSL SSO stored procedure style sheet stylesheet success story Support technical techwise research test credit card numbers testimonial thumbnail image Time Timer Transaction TSQL T-SQL Tutorial Twitter Update Highrise user user directory user profile image users online Web Based writer writing xls xlsx XML

In the Flow

rss

Data Springs, Inc. - An online diary and web log from staff and customers for premium DotNetNuke resources, Data Springs Modules, and Data Springs Services.


Useful PDF Completion Event extras using Dynamic Forms & Dynamic Registration for DotNetNuke

Having the ability to generate PDF documents from within Dynamic Forms and Dynamic Registration has always been a very powerful feature. In most cases you will have all that you need to create a great looking document right out of the box. However there are times where you need a bit more refinement before you get it just right for your SPEC. In this post I will outline some useful tips on how to get your Dynamic PDF exactly where you want it. In order to use any or all of these in your own completion event, simply append the event name with the terms in quotes below.  For example: If your PDF Completion Event Name = “MyPDF” and you needed your document to auto size; you would change the name to “AutoSize_MyPDF”. That’s all there is to it!

If your Completion event name contains the term "LandScape", the pdf orientation will be changed to landscape. Default is Portrait.
    This sets the specific pdf creator function below:
        pdfConverter.PdfDocumentOptions.PdfPageOrientation = ExpertPdf.HtmlToPdf.PDFPageOrientation.Landscape
           
If your Completion event name contains the term "Stretch", the pdf inner document element will be stretched to fit the default pdf page size (8.5" x 11" Letter). The default value is False.
    This sets the specific pdf creator function below:
        pdfConverter.PdfDocumentOptions.StretchToFit = True

If your Completion event name contains the term "FitWidth", the pdf inner document element will be resized to fit the default pdf page width (8.5" for Letter or Legal) regardless of the height. The default value is False.
    This sets the specific pdf creator function below:
        pdfConverter.PdfDocumentOptions.FitWidth = True

If your Completion event name contains the term "AutoSize", the pdf page size will auto adjust based on the fixed sized declared for the inner html of your template. For instance if you set an outer div within your PDF template measuring 612px wide by 796px high you would get 8.5" x 11" for a page size. 612px wide by 1008px high would equal 8.5" x 14" Legal paper size @72 DPI. You can easily find the pixel equivalent for any page size by multiplying inches by DPI. For example:

  • 8.5" x 11" @300 DPI would be
    • 300*8.5=2550px
    • 300*11=3300px

whereas the same dimension page

  • 8.5" x 11" @72 DPI would be
    • 72*8.5=612px
    • 72*11=796px.

The default value is False.
    This sets the specific pdf creator function below:
                pdfConverter.PdfDocumentOptions.AutoSizePdfPage = True

If your Completion event name contains the term "ScriptsEnabled", the pdf will now include any JavaScript contained within the inner html. The default value is False
    This sets the specific pdf creator function below:
        pdfConverter.ScriptsEnabled = True

 

Closing notes are sourced from http://www.html-to-pdf.net/ and touch on setting dedicated page breaks and keeping images from being split between two pages.

The HTML to PDF converter supports custom page breaks with standard CSS styles like page-break-before:always and page-break-after:always applied to any HTML object. The page-break-inside:avoid style can be applied to a element to prevent splitting the content inside the element between pages.

To specify to the converter to not break (keep together on the same page) a HTML region between PDF pages you can apply inline the page-break-inside:avoid CSS style to the HTML element you want to keep appear in the rendered PDF document on same page. Of course the element height must be less than the page height, otherwise the style will be ignored by the converter. Please note that unlike the page-break-before and page-break-after , the page-break-inside:avoid style must be specified inline as in the example below:

<table>
    <tr style="page-break-inside : avoid">
        <td>
            <img width="100" height="100" src="img1.jpg">
        td>
        <td>My text 1td>
    tr>
    <tr style="page-break-inside : avoid">
        <td>
            <img width="100" height="100" src="img2.jpg">
        td>
        <td>My text 2td>
    tr>
table>


In this example the table can contain a large number of rows, each row containing an image in the left and a text in the right and we don't want such a row to span on two pages. This can be easily achieved by specifying the page-break-inside:avoid style inline for the table row. You can also set the page-break-inside:avoid CSS style inline on the IMG tag to achieve the same result.

I hope this helps some of you get that last bit of fine tuning needed to knock your project out of the park!

The Data Springs Module Suite uses ExpertPDF to handle the PDF creation features. Some of the information above was sourced directly from http://www.html-to-pdf.net/











   



Showing 0 Comment
 
 

Join our mailing list...

Get current news and events the easy way

 

 

   
Subscribe Me

Recent Blogs...

 
Copyright 2005 - 2011 by Data Springs, Inc.