Skip to content

PDF creation programmatically

New Discussion
Stefan Roehrich
Stefan Roehrich asked on Apr 20, 2021 6:43 AM

Hi,

I want to create a PDF from C# in my Windows Forms application. I am using Infragistics for the UI, so I thought there might be “somehting” in Infragtistics that I can use for that.

I have some plain text data, that is just in a “.txt” file and not in some control in the UI. How can I create a simple PDF with just “Hello world”, to start easy. Is there an example available for C#?

Regards
Stefan

Sign In to post a reply

Replies

  • 0
    Bozhidara Pachilova
    Bozhidara Pachilova answered on Apr 16, 2021 8:40 AM
    Hello Stefan,
    Thank you for posting to Infragistics Community.
    I have been looking into your question and prepared a small sample, where a simple image and text are exported to a PDF file with the help of Infragistics Document Engine.
    Report report = new Report();
                ISection section = report.AddSection();
                section.PagePaddings = new Paddings(50, 50, 50, 0);
                IImage image = section.AddImage(new Infragistics.Documents.Reports.Graphics.Image(@"..\..\Images\infragistics-logo.png"));
                IText text = section.AddText();
                text.AddContent(this.label1.Text);
                text.Margins.All = 15;
                report.Publish(Form1.FILE_NAME, FileFormat.PDF);
                Process.Start(Form1.FILE_NAME);
    For further details, please refer to our documentation regarding Reports here and Sections – here.
    You can find the sample attached below. Please, test it on your side and in case of any other questions, do not hesitate to address them.
    Sincerely,
    Bozhidara Pachilova
    Associate Software Developer
    • 0
      Stefan Roehrich
      Stefan Roehrich answered on Apr 16, 2021 1:12 PM

      Thanks Bozhidara, that helped a lot.

      I have another question regarding Report, maybe you can help me again: Now I wonder how can I visually design a layout for the report and use this as a "template" for the report and fill in the data with the Infragistics document API? Is there some documentation about this, maybe also a video?

      And an additional question: Can I create the program on a Windows machine and let it run on a Linux machine with .NET Core?

      Regards
      Stefan

      • 0
        Bozhidara Pachilova
        Bozhidara Pachilova answered on Apr 19, 2021 6:27 AM
        Hello Stefan,

         

        I am glad that you find my answer helpful.

         

        Report layouts are documented in dedicated documentation topics here. You will find examples, sample code and visualizations of the various elements that can be placed within a Report Layout. For example, here you can find all details regarding the Section element, which is the base for building any layout in a Report.

         

        Regarding your second query, I am afraid such a question is considered out of the scope of Infragistics Developer Support, however, I can suggest searching the web for additional information. For example, there is this Stackoverflow thread or this Microsoft Questions thread, where similar questions have been discussed.

         

        Best regards,
        Bozhidara Pachilova
        Associate Software Developer
      • 0
        Stefan Roehrich
        Stefan Roehrich answered on Apr 19, 2021 12:56 PM

        Thanks again.

        I found the documentation for the document engine. So I guess there is no graphical desginer, where I can design the layout of the report with a GUI? I have to do it all by coding as showed in your example, right?

        Regarding the Infragistics DLL's: Do they run in Linux under .NET Core? Are there special libraries available for Linux? Or are that the same as for Windows?

        Regards
        Stefan

      • 0
        Bozhidara Pachilova
        Bozhidara Pachilova answered on Apr 20, 2021 6:43 AM
        Hello Stefan,

         

        You are right that there is currently no visual designer for document reports and the layout can be programmatically constructed. The help topics in the documentation can guide you through the process.

         

        Regarding your question about using Infragistics on Linux, I suppose the answer would be the same as to the question about deploying any .NET applications over a non-Windows platform. Our team has not really dealt with using Infragistics for Windows Forms controls under Linux. Non-Windows operating systems are not officially supported for Ultimate UI for Windows Forms. Please, refer to the list of supported environments here.

         

        Additionally, even if it is possible to deploy a .NET app on Linux, either using some third party tools as suggested in the linked threads above, or with another approach, we cannot guarantee that our controls will run correctly on Linux, as there are certain operating system-specific pieces of the internal code of our Windows Forms controls that may not run correctly on other operating systems. Having said this, in case of any issues found on another operating system and not reproducible on Windows, fixes or support will not be provided.

         

        Should you have any other questions about Infragistics controls, we will be glad to assist you.

         

        Best regards,
        Bozhidara Pachilova
  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Stefan Roehrich
Favorites
0
Replies
5
Created On
Apr 20, 2021
Last Post
4 years, 10 months ago

Suggested Discussions

Created by

Created on

Apr 20, 2021 6:43 AM

Last activity on

Feb 12, 2026 7:51 PM