7317ed58db03598dc150ecf4f9fa1b7b3e5c598a
API/CodeSamples/PdfPageMargin.md
| ... | ... | @@ -0,0 +1,54 @@ |
| 1 | +#PdfPageMargin |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##About |
|
| 6 | + |
|
| 7 | +Gets or sets the printed page margin on PDF export. This setting was added in version 6.10.0.42. |
|
| 8 | + |
|
| 9 | +**Default Value:** |
|
| 10 | + |
|
| 11 | +PdfPageMargin(30, 30, 30, 30) |
|
| 12 | + |
|
| 13 | +##Global.asax (C♯) |
|
| 14 | + |
|
| 15 | +```csharp |
|
| 16 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 17 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 18 | +{ |
|
| 19 | + // Configure settings |
|
| 20 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 21 | + public static void InitializeReporting() { |
|
| 22 | + //Check to see if we've already initialized. |
|
| 23 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 24 | + return; |
|
| 25 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 26 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 27 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 28 | + AdHocSettings.PdfPageMargin = PdfPageMargin(50, 50, 50, 50); //The relevant setting |
|
| 29 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 30 | + } |
|
| 31 | +} |
|
| 32 | +``` |
|
| 33 | + |
|
| 34 | +##Global.asax (VB.NET) |
|
| 35 | + |
|
| 36 | +```visualbasic |
|
| 37 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 38 | +Public Class CustomAdHocConfig |
|
| 39 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 40 | + |
|
| 41 | + Shared Sub InitializeReporting() |
|
| 42 | + 'Check to see if we've already initialized |
|
| 43 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 44 | + Return |
|
| 45 | + 'Initialize System |
|
| 46 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 47 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 48 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 49 | + AdHocSettings.PdfPageMargin = PdfPageMargin(50, 50, 50, 50) 'The relevant setting |
|
| 50 | + HttpContext.Current.Session("ReportingInitialized") = True |
|
| 51 | + End Sub |
|
| 52 | +End Class |
|
| 53 | +``` |
|
| 54 | + |