2009-07-04 14 views
6

पीडीएफ निर्यात के लिए परिदृश्य सेट करने के लिए क्या करना है?रिपोर्ट दर्शक लैंडस्केप पीडीएफ निर्यात

सिस्टम का उपयोग कर। ड्रॉइंग.प्रिंटिंग। पेज रीसेट रीफ्रेश से पहले काम नहीं करता है।

 Type tip = reportViewer1.GetType(); 
     FieldInfo[] pr = tip.GetFields(BindingFlags.Instance | BindingFlags.NonPublic); 
     System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings(); 
     ps.Landscape = true; 

     // ps.PaperSource= 
     foreach (FieldInfo item in pr) 
     { 
      if (item.Name == "m_pageSettings") 
      { 
       item.SetValue(reportViewer1, ps); 

      } 
     } 
+0

इस पोस्ट को जांचें: http://stackoverflow.com/questions/25387415/export-rdlc-report-to-pdf-in- लैंडस्केप-मोड –

उत्तर

4

सबसे अच्छा तरीका निर्यात की प्रस्तुत करना दौरान DeviceInformation पारित करने के लिए है: यहाँ एक ही समस्या के साथ किसी है।

चेक बाहर http://msdn.microsoft.com/en-us/library/ms154682.aspx

आप तो आप अपने परिदृश्य प्रारूप के लिए 8.5x11 निर्दिष्ट कर सकते हैं, DeviceInformation रूप PageHeight और PageWidth पारित कर सकते हैं।

कोड नीचे दिए गए उदाहरण:

Dim warnings As Warning() = Nothing 
Dim streamids As String() = Nothing 
Dim mimeType As String = Nothing 
Dim encoding As String = Nothing 
Dim extension As String = Nothing 
Dim bytes As Byte() 
Dim deviceInf as String 

deviceInf = "<DeviceInfo><PageHeight>8.5in</PageHeight><PageWidth>11in</PageWidth></DeviceInfo>" 

bytes = ReportViewer1.LocalReport.Render("PDF", deviceInf, mimeType, encoding, extension, streamids, warnings) 
Dim fs As New FileStream(FILENAME, FileMode.Create) 
fs.Write(bytes, 0, bytes.Length) 
fs.Close() 
+1

बदलना '' और ' 'मेरे लिए पूरी तरह से काम किया। एक लाइन लाइन फिक्स! –

8

अपनी रिपोर्ट (rdlc) का चयन रिपोर्ट के डिज़ाइन दृश्य में और गुण में फलक सेट page size

width :11in 
height :8.5in 
+4

या, यूरोप में ए 4 का उपयोग करके सभी के लिए, चौड़ाई: 2 9, 7 सेमी, ऊंचाई: 21 सेमी। –

-1

में निम्नलिखित मदों दूसरा परम का उपयोग करना: deviceInf फ़ंक्शन में ReportViewer1.LocalReport.Render(..) सही है। इसके अलावा, यह पीडीएफ, टीआईएफ छवि को प्रस्तुत करने में सही है, लेकिन वर्ड

संबंधित मुद्दे