File tree 2 files changed +10
-8
lines changed
common/pdf-jpg-export-js/PdfExportJS 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 9
9
10
10
<div @ref =" @ElementToExport" >
11
11
<TelerikGrid Data =" @GridData"
12
- Pageable =" true"
13
- Sortable =" true"
14
- FilterMode =" @GridFilterMode.FilterRow"
12
+ FilterMode =" @GridFilterMode.FilterMenu"
15
13
Groupable =" true"
14
+ Pageable =" true"
16
15
Resizable =" true"
17
- Reorderable =" true" >
16
+ Reorderable =" true"
17
+ Sortable =" true" >
18
18
<GridToolBarTemplate >
19
19
<TelerikButton OnClick =" @ExportJpg"
20
20
ThemeColor =" @ThemeConstants.Button.ThemeColor.Primary"
27
27
<GridColumn Field =" @(nameof(SampleData.Id))" Width =" 120px" />
28
28
<GridColumn Field =" @(nameof(SampleData.Name))" Title =" Employee Name" Groupable =" false" />
29
29
<GridColumn Field =" @(nameof(SampleData.Team))" Title =" Team" />
30
- <GridColumn Field =" @(nameof(SampleData.HireDate))" Title =" Hire Date" />
30
+ <GridColumn Field =" @(nameof(SampleData.HireDate))" Title =" Hire Date" DisplayFormat = " {0:d} " />
31
31
</GridColumns >
32
32
</TelerikGrid >
33
33
</div >
45
45
46
46
private async Task ExportPdf ()
47
47
{
48
+ // Define PDF export options
49
+ object pdfOptions = new { Landscape = true , PaperSize = " A4" };
48
50
// Create a data URI from the element reference
49
- var data = await DrawingService .ExportPDF (ElementToExport );
51
+ string data = await DrawingService .ExportPDF (ElementToExport , pdfOptions );
50
52
// Save the Data URI to a file
51
53
await DrawingService .SaveAs (data , " grid-pdf-export.pdf" );
52
54
}
Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ public async ValueTask<string> ExportImage(ElementReference elementRef) =>
27
27
/// </summary>
28
28
/// <param name="elementRef"></param>
29
29
/// <returns>Data URI as a string</returns>
30
- public async ValueTask < string > ExportPDF ( ElementReference elementRef ) =>
31
- await Js . InvokeAsync < string > ( $ "{ JsNamespace } .exportPDF", elementRef ) ;
30
+ public async ValueTask < string > ExportPDF ( ElementReference elementRef , object ? options ) =>
31
+ await Js . InvokeAsync < string > ( $ "{ JsNamespace } .exportPDF", elementRef , options ) ;
32
32
33
33
/// <summary>
34
34
/// Invokes the browser to save a Data URI formatted string to a file.
You can’t perform that action at this time.
0 commit comments