PDF Generation from DLL

7 posts, 0 answers
  1. Tom
    Tom avatar
    3 posts
    Member since:
    Aug 2007

    Posted 18 Aug 2007 Link to this post

    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.
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 20 Aug 2007 Link to this post

    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
  3. sami
    sami avatar
    13 posts
    Member since:
    Aug 2007

    Posted 22 Aug 2007 Link to this post

    Tom
    If i want to print jpeg image on pdf . how can i do it.
  4. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 23 Aug 2007 Link to this post

    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
  5. sami
    sami avatar
    13 posts
    Member since:
    Aug 2007

    Posted 23 Aug 2007 Link to this post

    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.
  6. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 23 Aug 2007 Link to this post

    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
  7. Mandar
    Mandar avatar
    1 posts
    Member since:
    Oct 2012

    Posted 15 Oct 2012 Link to this post

    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.
Back to Top