0

Iam dynamically generating a PDF report by writing a byte array to a file,I need to control the size of the margin which is generated .I would like to get this done without using any 3rd party dll's ,Please advise me how to proceed

Here is my code

byte[] bytes = reportViewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

string path = ReportPath +@"ErroReports";
System.IO.File.WriteAllBytes(path+@"ErrorReport"+DateTime.Now.ToLongDateString()+ ".pdf", bytes);

I have googled this but i am only seeing suggestions about using 3rd party dlls, I only need to know whether it is possible to alter that byte array to set margins

Hooked
  • 84,485
  • 43
  • 192
  • 261
Amarnath R Shenoy
  • 5,121
  • 8
  • 24
  • 32
  • 2
    You need to do it in the report before saving it. – Lasse V. Karlsen Sep 11 '14 at 06:46
  • Iam using RDLC report, And i have already set margins to 0 – Amarnath R Shenoy Sep 11 '14 at 06:53
  • A PDF is a very complicated file format. You can't modify something like the margin by just modifying the file as binary data. You need to set the margin when you generate the PDF, or use some program that provides the ability to fiddle with the PDF's innards. This thread might help: http://stackoverflow.com/questions/14070112/automate-editable-pdf – RenniePet Sep 11 '14 at 07:24

0 Answers0