I just want to put some values from my database on an A4 page (I have a JPG template)
and create a PDF book/report with an insert per page.
I have easily done it with NetBeans Java Jasper Reports using iReport editor.
It seems so much more difficult in Visual Studio C# Crystal Reports.
I’ve really searched for tutorials for Crystal Reports and none of them
is using an A4 image as a template. Please help me if you know any such tutorials.
I prefer a solution which works programmatically and not through a wizard.
I already manage my database with my program. I just need the report and some
documentation of how to give input values to the report. I don’t even
need for the report to access the database. I can get all the values in my
program. The best solution for me is a template with my JPG file as background
and boxes (like textboxes) where I give text from my program through parameters
of a function. Like Jasper Reports / iReport.
OK, I spend some time to find an easy solution and I got the following:
First of all I didn’t use Crystal Reports, but Windows Reports (rdlc files).
Windows Reports are more simple and easy and it is possible to add an image as a background
and above this image some TextBoxes that refer to String parameters (exactly what I needed). They are in Visual Studio by default and you design your report in Visual Studio (right click in Solution Explorer –> Add Report)
Then I found a code sample which converts the report to PDF files and I used it to write the following Class:
It works. Try it. Be careful with 2 things:
Use correct paths for reportFilePath and pdfFilePath. (pdfFilePath worked only with non-relative path for me)
Make sure that you have added all parameters with their correct names in your rdlc report. You can add them at View –> Report Data –> Add New Parameter (right click at Parameters). Also see this: Create a parameter in rdlc report
Hope I helped. It worked for me great.