PrintToPrinter, ExportToDisk Problem
I am using Crystal Reports 2008 inside VS2005 and I wanna get the report in PDF format.
The first thing i tried was exporting the report using the ExportToDisk function. It works ok, but the fonts of the PDF generated werent the same as the fonts i was using in my report and the quality of the images wasnt as good as i expected, they were converted to 256 color images. The result was exactly the same when i was using the Export option from Crystal Interface.
Then i printed the report from Crystal interface using the Adobe PDF printer. I got the right fonts and quality for the images so i decided to implement that in code. Using the code below all the PDF files i got are damaged or at least Acrobat Reader tells me that when opening them and the size of the generated files are much larger than the one i got when directly printing from the Crystal interface (so another thing that makes me thought they are really damaged).
Does anyone could help me to get the PDF?
The code is shown below. I am doing the test with a report with one page with one of the images i am using in my final report.
Thanks very much in advance, Diego
ReportDocument inf = new ReportDocument();
inf.SetDatabaseLogon("sa", "XXXXXXXX", @"localhost\SQLEXPRESS", "InformesUF");
//inf.ExportToDisk(ExportFormatType.PortableDocFormat, filename); //The PDF generated is with bad quality
PrinterSettings ps = new PrinterSettings();
PageSettings pg = new PageSettings();
pg.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);
ps.PrinterName = "Adobe PDF";
ps.Copies = 1;
ps.PrintToFile = true;
ps.PrintFileName = "C:
inf.PrintToPrinter(ps, pg, true);
//inf.PrintToPrinter(ps, ps.DefaultPageSettings, true);