This is a migrated thread and some comments may be shown as answers.

Questions about pdf exports

5 Answers 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 08 Oct 2011, 08:14 PM
Hi,


I am doing some works with RadGrid to export pdf format, have questions:
(1) Is there a way to output graphics in pdf's header area? I tried to use html img tag  in PageTitle property without success
(2) Is there a way to output "Page x of y"? I would prefer to output this into footer area.
(3) I can not get rid of page margins on header and footer areas no matter what values I set PageTopMargin and PageBottomMargin properties to. PageRightMargin and PageLeftMargin seem to function well.

TIA

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Oct 2011, 11:48 AM
Hello Ed,

Straight to your questions.

1) To set graphics in pdf's header area you can go through the following demo.
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/pdfexport/defaultcs.aspx

2) As far as my knowledge it is not possible to export page numbers while exporting to pdf. Check out the following forum discussion:
Need urgent help in PDF export

3) I have tried to set the PageTopMargin and PageBottomMargin in pdf export and it worked as expected.

ASPX:
<telerik:RadGrid ID="grid1" runat="server" DataSourceID="SqlDataSource1" AllowPaging="True"
          CellSpacing="0" GridLines="None" PageSize="3">
          <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
              <Pdf PageHeight="210mm" PageWidth="297mm" PageTitle="Employee Details" DefaultFontFamily="Arial Unicode MS"
                  PageBottomMargin="10mm" PageTopMargin="100mm" PageLeftMargin="20mm" PageRightMargin="20mm" />
          </ExportSettings>
</
telerik:RadGrid>
Here is the screenshot with different top and bottom margins.

Thanks,
Princy.
0
Ed
Top achievements
Rank 1
answered on 10 Oct 2011, 04:47 PM
About your answer:
(1) The demo at: http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/pdfexport/defaultcs.aspx,
does not use header to output graphics, instead graphics is part of the grid, which is fine if there is a way completely get rid of header.
(3) I want to get rid of header, not enlarge it. Try this:
<telerik:RadGrid ID="grid1" runat="server" DataSourceID="SqlDataSource1" AllowPaging="True"
          CellSpacing="0" GridLines="None" PageSize="3">
          <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
              <Pdf PageHeight="8.5in" PageWidth="11in" PageTitle="Employee Details" DefaultFontFamily="Arial Unicode MS"
                  PageBottomMargin="0.1in" PageTopMargin="0.1in" PageLeftMargin="0.1in" PageRightMargin="0.1in" />
          </ExportSettings>
</telerik:RadGrid>
The left and right margins will be narrowed to about 0.1 inch as expected, but header and footer remain the same to about 1 inch
0
Ed
Top achievements
Rank 1
answered on 13 Oct 2011, 04:09 AM
Does anyone know how to get rid of pdf header and footer in this case, I've been working on this for 1 week, when I showed it to my boss, he immediately said get rid of header and footer. It's wasting a lot of spaces,  on a letter paper landscape mode, height is only 8.5 inch, with header and footer, there is only 6.5 inch left .

Thanks again
0
Accepted
Princy
Top achievements
Rank 2
answered on 13 Oct 2011, 06:12 AM
Hello Ed,

You can set the PageBottomMargin and PageTopMargin  as "0" that worked as expected at my end.

Thanks,
Princy.
0
Daniel
Telerik team
answered on 13 Oct 2011, 01:05 PM
Hello Ed,

You can find all PDF-specific properties listed in the following link:
PDF export

Regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Ed
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ed
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or