This is a migrated thread and some comments may be shown as answers.

PDF Generation from DLL

6 Answers 204 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 18 Aug 2007, 09:20 PM
Hi. I have built a DLL that generates  a PDF. The problem is that the error message "PDF rendering format is not available" appears, unless the Telerik dlls are referenced in the calling application.

How do I need to proceed?

Here is the code in the Calling Application:
            byte[] b = conv.GeneratePDF();  
 
            FileStream oFile = File.Open("C:\\test.pdf",FileMode.OpenOrCreate,FileAccess.Write,FileShare.None);  
            oFile.Write(b, 0, b.Length);  
            oFile.Close(); 

This is the code that is failing in the DLL:
        public byte[] GeneratePDF(List<FieldDescriptor> fieldList, DataTable dtFields, string reportName)  
        {  
            ReportDataTable = dtFields;  
            FieldList = fieldList;  
            ReportName = reportName;  
            Telerik.Reporting.Report report = GetReport();  
              
            string mimeType = string.Empty;  
            string extension = string.Empty;  
            Encoding encoding = null;  
            byte[] buffer = Telerik.Reporting.Processing.ReportProcessor.Render("PDF", report, null, out mimeType, out extension, out encoding);  
 
            return buffer;  
 
        }  
 

Of course, it fails on the "Render" call.

6 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 20 Aug 2007, 07:42 AM
Hi Tom,

In fact, you do not need to reference the Telerik.Reporting.ImageRendering.dll assembly in your application. You only need to put it in the bin folder of your application. Then you will be able to export your report to PDF.

 
Greetings,
Rossen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
sami
Top achievements
Rank 1
answered on 22 Aug 2007, 10:38 PM
Tom
If i want to print jpeg image on pdf . how can i do it.
0
Rossen Hristov
Telerik team
answered on 23 Aug 2007, 08:45 AM
Hi sami,

Place a PictureBox in your report, click on its Value property and select the desired JPEG. Then run the report and export it to PDF. The image will be in the PDF just as you placed it.

Regards,
Rossen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
sami
Top achievements
Rank 1
answered on 23 Aug 2007, 03:32 PM
myReport.mypic.Value = "C:\\temp\\picture.jpeg";

myReport is the report and mypic is the picturebox.

i have created a picture box on the report and
on the calling aspx file i give like this.
but the report is not opening that picture.
is there any thing else i have to do.
0
Rossen Hristov
Telerik team
answered on 23 Aug 2007, 05:20 PM
Hello sami,

If the PictureBox Value property is a string, then this PictureBox is bound to a column from the data source and the value should be a data binding expression, such as "=ProductPhoto", and not a file name.

The other object that the Value property accepts is a System.Drawing.Image, so you will either have to create a Bitmap object manually from your file and assign it:

myReport.mypic.Value = Bitmap.FromFile("C:\\temp\\picture.jpeg");

Or use the report designer and click on the Value property then choose a file form the file system. This will embed the image in the report's .resx file and bind it to the PictureBox Value property automatically in the InitializeComponent method.

We hope this helps.


Kind regards,
Rossen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mandar
Top achievements
Rank 1
answered on 15 Oct 2012, 10:34 AM
Hello,
I am new to telerik and wanted to use Telerik.Pdf.PdfDocument to CREATE a PDF file. I don't want to use any RadControl or Report in my project. My requirement is say, just to create a pdf file from a string. Is it supported? If yes, how can i implement the same?
Thanks.
Tags
General Discussions
Asked by
Tom
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
sami
Top achievements
Rank 1
Mandar
Top achievements
Rank 1
Share this question
or