Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'v saved the current grid as a image to disk. and also now exporting the image to the pdf.
everything in the exporting is going on very well.
bt issue arises when.. the image wat I've exported to the pdf, the background is black which is overridden with black background when i open pdf.

I'm using the telerik raddocument ....
Image is saved to disk as BMP format, which is having proper black background.

can anyone please help me out for this.

C#
private void PrepareDocument(RadDocument document)
       {
          // document.Style = Colors.Black;
           document.SectionDefaultPageOrientation = PageOrientation.Landscape;
           document.LayoutMode = DocumentLayoutMode.Flow;
           document.Measure(RadDocument.MAX_DOCUMENT_SIZE);

           document.Arrange(new Telerik.Windows.Documents.Model.RectangleF(new Telerik.Windows.Documents.Model.PointF(10,10), document.DesiredSize));

       }


C#
  private void CreateChartDocumentPart(RadDocument document, Grid whGrid, Grid companysnapshot, Grid chartgridimage)
      {
          Telerik.Windows.Documents.Model.Section section1 = new Telerik.Windows.Documents.Model.Section();
          Telerik.Windows.Documents.Model.Section section2 = new Telerik.Windows.Documents.Model.Section();
          Telerik.Windows.Documents.Model.Section section3 = new Telerik.Windows.Documents.Model.Section();

          Telerik.Windows.Documents.Model.Paragraph paragraph1 = new Telerik.Windows.Documents.Model.Paragraph();
          Telerik.Windows.Documents.Model.Paragraph paragraph2 = new Telerik.Windows.Documents.Model.Paragraph();
          Telerik.Windows.Documents.Model.Paragraph paragraph3 = new Telerik.Windows.Documents.Model.Paragraph();

          Telerik.Windows.Documents.Model.Span span1;
          Telerik.Windows.Documents.Model.Span span2;
          Telerik.Windows.Documents.Model.Span span3;

          using (MemoryStream ms = new MemoryStream())
          {

              paragraph1.LeftIndent = 30;
              paragraph1.RightIndent = 30.0;
              FileStream filestrmtest = File.Open(@"C:\Users\Admin\Desktop\logoall.bmp", FileMode.Open);
              ImageInline image1 = new ImageInline(filestrmtest, new System.Windows.Size(1100, (int)Math.Round(whGrid.ActualHeight)+20), "bmp");

              paragraph1.FlowDirection = FlowDirection.LeftToRight;
              paragraph1.Inlines.Add(image1);

              paragraph2.LeftIndent = 30;
              paragraph2.RightIndent = 30.0;
              filestrmtest = File.Open(@"C:\Users\Admin\Desktop\companyss.bmp", FileMode.Open);
              companysnapshot.Background = new ImageBrush(image1.ImageSource);

              ImageInline image2 = new ImageInline(filestrmtest, new System.Windows.Size(900, (int)Math.Round(companysnapshot.ActualHeight)), "bmp");

              paragraph2.FlowDirection = FlowDirection.LeftToRight;
              paragraph2.Inlines.Add(image2);
              filestrmtest.Close();
span1.
              //Span spacespan = new Span("  ");
              //paragraph.Inlines.Add(spacespan);
          }

          try
          {

              section1.Blocks.Add(paragraph1);
              document.Sections.Add(section1);
              section2.Blocks.Add(paragraph2);
              document.Sections.Add(section2);
            // paragraph1.Background = new )

          }
          catch (Exception)
          {
          }

         // paragraph.Inlines.Add(new Span(FormattingSymbolLayoutBox.));

      }
Posted
Comments
Sergey Alexandrovich Kryukov 19-Sep-14 11:45am    
No transparency or "background" notion is supported by BMP. Do you want to see page background instead of black? You cannot have it with this file.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900