Populating PDF with Image & Text Not From Database

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v6)  /  Populating PDF with Image & Text Not From Database

DynamicPDF CoreSuite for .NET (v6) Forum

Is there a way to populate a pdf using report writer without using a query, stored procedure, etc to populate the pdf? I have one image and a bunch of data, just strings in code actually, that I want to place in specific locations in the pdf. This image and info/data is not in a database. Any help would be greatly appreciated.

Thanks,

Mac
Posted by a ceTe Software moderator
Hello,

Yes, it is possible to populate PDF without needing to use a query or stored proc. Your data should be in the form of a data table or a list of objects. Using the .Net API you would need to put your data in a data table or a list of objects and populate the template during runtime as shown in the below examples.

Event driven query using list of custom objects

Event driven query using Data Table

In order to add an image you would need to use a placeholder on the template (dplx) file and use the LaidOut event handler on the place holder to add an image to the PDF. The event handling topic shows how to do this but adds a barcode instead. In your case you can replace the event handler code that adds a barcode with the below sample code to add an image.

public void BarcodePlaceHolder_LaidOut( object sender, PlaceHolderLaidOutEventArgs e )
{
  Image image = new Image(@"C:\MyImage.jpg", 0, 0);
  e.ContentArea.Add(image);
}

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 10:24 AM.