Hi All,
I am using PdfFormatProvider to export PDF document. It throws the error "Index was outside the bounds of the array." in the line provider2.Export(bigbook, output);
The same code works fine with
XamlFormatProvider
TxtFormatProvider
HtmlFormatProvider
please see the below code for implementation
void ExportPDF2_Click(object sender, RoutedEventArgs e)
{
this.Cursor = Cursors.Wait;
RadDocument theContent = LoadContent();
RadDocument bigbook = new RadDocument();
Section section1 = new Section();
Paragraph paragraph1 = new Paragraph();
Span span1 = new Span(TVM.TOC3);
paragraph1.Inlines.Add(span1);
section1.Blocks.Add(paragraph1);
bigbook.Sections.Add(section1);
foreach (Section section in theContent.Sections)
{
Section copySection = section.CreateDeepCopy() as Section;
theContent.Sections.Remove(section);
bigbook.Sections.Add(copySection);
}
this.Cursor = Cursors.Arrow;
//-----------------------------------------------
PdfFormatProvider provider2 = new PdfFormatProvider();
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.DefaultExt = ".pdf";
saveDialog.Filter = "PDF Document|*.pdf";
bool? dialogResult = saveDialog.ShowDialog();
if (dialogResult == true)
{
using (System.IO.Stream output = saveDialog.OpenFile())
{
provider2.Export(bigbook, output); //Error at this line
MessageBox.Show("Saved Successfully!");
}
}
}
This code works fine with XamlFormatProvider, TxtFormatProvider, HtmlFormatProvider. Issue is only with PDFFormatProvider
Can anyone help me in this?
I am using PdfFormatProvider to export PDF document. It throws the error "Index was outside the bounds of the array." in the line provider2.Export(bigbook, output);
The same code works fine with
XamlFormatProvider
TxtFormatProvider
HtmlFormatProvider
please see the below code for implementation
void ExportPDF2_Click(object sender, RoutedEventArgs e)
{
this.Cursor = Cursors.Wait;
RadDocument theContent = LoadContent();
RadDocument bigbook = new RadDocument();
Section section1 = new Section();
Paragraph paragraph1 = new Paragraph();
Span span1 = new Span(TVM.TOC3);
paragraph1.Inlines.Add(span1);
section1.Blocks.Add(paragraph1);
bigbook.Sections.Add(section1);
foreach (Section section in theContent.Sections)
{
Section copySection = section.CreateDeepCopy() as Section;
theContent.Sections.Remove(section);
bigbook.Sections.Add(copySection);
}
this.Cursor = Cursors.Arrow;
//-----------------------------------------------
PdfFormatProvider provider2 = new PdfFormatProvider();
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.DefaultExt = ".pdf";
saveDialog.Filter = "PDF Document|*.pdf";
bool? dialogResult = saveDialog.ShowDialog();
if (dialogResult == true)
{
using (System.IO.Stream output = saveDialog.OpenFile())
{
provider2.Export(bigbook, output); //Error at this line
MessageBox.Show("Saved Successfully!");
}
}
}
This code works fine with XamlFormatProvider, TxtFormatProvider, HtmlFormatProvider. Issue is only with PDFFormatProvider
Can anyone help me in this?