This question is locked. New answers and comments are not allowed.
Hello,
I get the following error when trying to export to PDF:
http://i230.photobucket.com/albums/ee248/masteratt/exportPDFerror.png
Here is my code:
I have referenced all FormatProviders and document and documentFixed. Is it a case of missing reference or is something else going on?
I get the following error when trying to export to PDF:
http://i230.photobucket.com/albums/ee248/masteratt/exportPDFerror.png
Here is my code:
var saveDialog = new SaveFileDialog { DefaultExt = "*.pdf", Filter = "Adobe PDF Document (*.pdf)|*.pdf" }; if (saveDialog.ShowDialog() != true) return; var table = new Table(1, CheckGrid1.Columns.Count); var document = new RadDocument(); document.Sections.Add(new Section()); document.Sections.First.Blocks.Add(table); TableCell headerCell = table.Rows.First.Cells.First; AddCellDataSpan(headerCell, "ID", Colors.DarkGray, Colors.White, RadTextAlignment.Center); headerCell = (TableCell) headerCell.NextSibling; AddCellDataSpan(headerCell, "Check Date", Colors.DarkGray, Colors.White, RadTextAlignment.Center); headerCell = (TableCell) headerCell.NextSibling; AddCellDataSpan(headerCell, "Check Description", Colors.DarkGray, Colors.White, RadTextAlignment.Center); var everyTwo = 0; var doubleChecker = 1; foreach (var item in CheckGrid1.Items.OfType<GridBinding>()) { var row = table.AddRow(); var index = 0; foreach (var cell in row.Cells) { switch (index) { case 0: AddCellDataSpan(cell, item.CheckIDColumn.ToString(CultureInfo.InvariantCulture), everyTwo == doubleChecker ? Colors.LightGray : Colors.White, Colors.Black, RadTextAlignment.Center); break; case 1: AddCellDataSpan(cell, item.checkDateColumn, everyTwo == doubleChecker ? Colors.LightGray : Colors.White, Colors.Black, RadTextAlignment.Center); break; case 2: AddCellDataSpan(cell, item.CheckDescColumn, everyTwo == doubleChecker ? Colors.LightGray : Colors.White, Colors.Black, RadTextAlignment.Center); break; } index++; } if (everyTwo == doubleChecker) doubleChecker += 2; everyTwo++; } document.LayoutMode = DocumentLayoutMode.Paged; document.Measure(RadDocument.MAX_DOCUMENT_SIZE); document.Arrange(new RectangleF(PointF.Empty, document.DesiredSize)); var extension = Path.GetExtension(saveDialog.SafeFileName); var provider = DocumentFormatProvidersManager.GetProviderByExtension(extension); if (provider == null) { MessageBox.Show("Unsupported file format."); return; } try { using (var output = saveDialog.OpenFile()) { provider.Export(document, output); } MessageBox.Show("File '" + provider.Name + "' has been saved.", "PDF Success", MessageBoxButton.OK); } catch (Exception ex) { MessageBox.Show("Unable to save the file: " + ex); }I have referenced all FormatProviders and document and documentFixed. Is it a case of missing reference or is something else going on?