<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Itthirit Technology - Medium]]></title>
        <description><![CDATA[Itthirit Technology is the one of Thailand’s IoT Leaders, we connected IoT with the people. - Medium]]></description>
        <link>https://medium.com/itthirit-technology?source=rss----c105ab8d0b76---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Itthirit Technology - Medium</title>
            <link>https://medium.com/itthirit-technology?source=rss----c105ab8d0b76---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 04:07:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/itthirit-technology" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Challenge of Finding a Free Excel to PDF Converter: My Journey and Solution]]></title>
            <link>https://medium.com/itthirit-technology/the-challenge-of-finding-a-free-excel-to-pdf-converter-my-journey-and-solution-f36731cb6752?source=rss----c105ab8d0b76---4</link>
            <guid isPermaLink="false">https://medium.com/p/f36731cb6752</guid>
            <category><![CDATA[pdf]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[Weerayut Teja]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 02:15:55 GMT</pubDate>
            <atom:updated>2025-01-27T02:13:52.335Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BL90h6wyciUWRggxyGIy_w.png" /></figure><p>Converting Excel files to PDF is a common necessity in various projects, whether for generating reports, sharing data, or preparing official documents. Like many developers, I initially assumed this would be a straightforward task to automate. However, my search for a free and reliable solution quickly turned into a frustrating experience filled with limitations, compatibility issues, and costly software.</p><p>Here’s how I tackled these challenges, built my own <strong>Excel-to-PDF converter</strong>, and made it available as an open-source tool for others who might be facing the same struggles.</p><h3>The Struggle</h3><h3>Paid Solutions</h3><p>My initial search led me to premium solutions like Aspose.Cells, Syncfusion, and others. While these tools offered comprehensive features, they came with high licensing costs — far beyond what I could justify for small-scale or personal projects.</p><h3>Online Converters</h3><p>Free online converters seemed like a viable alternative, but they weren’t suitable for automation. These services often presented <strong>privacy risks</strong> (since files are uploaded to external servers), had <strong>file size limits</strong>, and lacked programmatic APIs.</p><h3>Open-Source Libraries</h3><p>I also explored open-source libraries, but most lacked the capability to convert Excel files to PDF. Even those that did often failed to support <strong>modern Microsoft Office formats</strong> or lacked reliability.</p><h3>Discovering LibreOffice in Headless Mode</h3><p>After weeks of searching, I came across an alternative: using <strong>LibreOffice in headless mode</strong>. LibreOffice, a free and open-source office suite, supports multiple file conversions, including Excel to PDF. Running it in headless mode allows execution via command line, making it perfect for automation.</p><h3>How My Solution Works</h3><p>To make this approach developer-friendly, I created a lightweight <strong>Go-based HTTP server</strong> that functions as a REST API. This server acts as a wrapper around LibreOffice’s conversion capabilities, enabling any programming language to interact with it via HTTP requests.</p><h3>Key Features</h3><ol><li><strong>Multi-Format Support</strong>: Handles .xlsx, .xls, .csv, .docx, .pptx, and more.</li><li><strong>Automatic Cleanup</strong>: Temporary files are deleted after one hour to conserve disk space.</li><li><strong>Custom Fonts</strong>: Users can mount custom fonts via the GitHub repository or Docker volumes.</li><li><strong>Cross-Language Integration</strong>: Works with any language that supports HTTP requests.</li></ol><h3>Handling Temporary Files</h3><p>Instead of relying on system temporary directories, I implemented a <strong>custom </strong><strong>./tmp directory</strong>. This ensures consistent behavior, avoiding unpredictable permission issues on different systems.</p><h3>Implementation Details</h3><h3>How It Works</h3><ol><li><strong>File Upload</strong>: Users send an Excel file via the /convert endpoint using a POST request.</li><li><strong>Temporary Storage</strong>: The server stores the file in the ./tmp directory with a timestamped filename.</li><li><strong>Conversion</strong>: LibreOffice (in headless mode) converts the file to PDF and saves the result.</li><li><strong>File Cleanup</strong>: A background process deletes files older than one hour.</li><li><strong>Response</strong>: The converted PDF is sent back as an HTTP response.</li></ol><h3>Getting Started</h3><h3>GitHub Repository</h3><p>Find the source code here: <a href="https://github.com/wteja/pdf-converter"><strong>https://github.com/wteja/pdf-converter</strong></a>.</p><h3>Docker Image</h3><p>Available on Docker Hub: <a href="https://hub.docker.com/r/wteja/pdf-converter"><strong>wteja/pdf-converter</strong></a>.</p><h4>Running the Docker Container</h4><pre>docker pull wteja/pdf-converter<br>docker run -p 5000:5000 wteja/pdf-converter</pre><h3>Examples of Integration with Different Languages</h3><p>Since this service is accessible via HTTP, it can be used with any programming language.</p><h3>C#</h3><pre>var client = new HttpClient();<br>var fileContent = new ByteArrayContent(File.ReadAllBytes(&quot;example.xlsx&quot;));<br>var formData = new MultipartFormDataContent { { fileContent, &quot;file&quot;, &quot;example.xlsx&quot; } };<br><br>var response = await client.PostAsync(&quot;http://localhost:5000/convert&quot;, formData);<br>var pdfBytes = await response.Content.ReadAsByteArrayAsync();<br>File.WriteAllBytes(&quot;output.pdf&quot;, pdfBytes);</pre><h3>Node.js</h3><pre>const axios = require(&quot;axios&quot;);<br>const FormData = require(&quot;form-data&quot;);<br>const fs = require(&quot;fs&quot;);<br><br>const form = new FormData();<br>form.append(&quot;file&quot;, fs.createReadStream(&quot;example.xlsx&quot;));<br><br>axios.post(&quot;http://localhost:5000/convert&quot;, form, { headers: form.getHeaders() })<br>  .then(response =&gt; fs.writeFileSync(&quot;output.pdf&quot;, response.data))<br>  .catch(console.error);</pre><h3>Python</h3><pre>import requests<br><br>with open(&quot;example.xlsx&quot;, &quot;rb&quot;) as f:<br>    response = requests.post(&quot;http://localhost:5000/convert&quot;, files={&quot;file&quot;: f})<br><br>with open(&quot;output.pdf&quot;, &quot;wb&quot;) as f:<br>    f.write(response.content)</pre><h3>Go</h3><pre>ackage main<br><br>import (<br> &quot;bytes&quot;<br> &quot;io&quot;<br> &quot;mime/multipart&quot;<br> &quot;net/http&quot;<br> &quot;os&quot;<br>)<br><br>func main() {<br> file, _ := os.Open(&quot;example.xlsx&quot;)<br> defer file.Close()<br><br> body := &amp;bytes.Buffer{}<br> writer := multipart.NewWriter(body)<br> part, _ := writer.CreateFormFile(&quot;file&quot;, &quot;example.xlsx&quot;)<br> io.Copy(part, file)<br> writer.Close()<br><br> req, _ := http.NewRequest(&quot;POST&quot;, &quot;http://localhost:5000/convert&quot;, body)<br> req.Header.Set(&quot;Content-Type&quot;, writer.FormDataContentType())<br><br> resp, _ := http.DefaultClient.Do(req)<br> defer resp.Body.Close()<br><br> out, _ := os.Create(&quot;output.pdf&quot;)<br> defer out.Close()<br> io.Copy(out, resp.Body)<br>}</pre><h3>Challenges and Trade-Offs</h3><h3>Docker Image Size</h3><p>The Docker image is <strong>2.67 GB</strong> due to LibreOffice dependencies. I experimented with smaller images like Alpine, but they used older LibreOffice versions that lacked support for modern Microsoft Office formats. Debian, while offering the latest LibreOffice, resulted in an even larger image (~3 GB).</p><h3>Why It’s a Worthwhile Trade-Off</h3><p>Despite its size, this solution is a cost-effective alternative to commercial tools. Once set up, the image can be reused across multiple projects without incurring licensing fees.</p><h3>Conclusion</h3><p>My frustrating search for a free Excel-to-PDF converter led me to build my own solution using LibreOffice in headless mode. While not perfect, it’s free, reliable, and flexible. If you’re facing similar challenges, I hope this project saves you time and effort.</p><p>Check out the project on <a href="https://github.com/wteja/pdf-converter"><strong>GitHub</strong></a> or pull the Docker image from <a href="https://hub.docker.com/r/wteja/pdf-converter"><strong>Docker Hub</strong></a>. Let me know if you have suggestions for improvement!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f36731cb6752" width="1" height="1" alt=""><hr><p><a href="https://medium.com/itthirit-technology/the-challenge-of-finding-a-free-excel-to-pdf-converter-my-journey-and-solution-f36731cb6752">The Challenge of Finding a Free Excel to PDF Converter: My Journey and Solution</a> was originally published in <a href="https://medium.com/itthirit-technology">Itthirit Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use Interfaces to Create Abstract Classes in .NET Core]]></title>
            <link>https://medium.com/itthirit-technology/how-to-use-interfaces-to-create-abstract-classes-in-net-core-d5651e84df7e?source=rss----c105ab8d0b76---4</link>
            <guid isPermaLink="false">https://medium.com/p/d5651e84df7e</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Weerayut Teja]]></dc:creator>
            <pubDate>Sat, 04 Nov 2023 14:45:26 GMT</pubDate>
            <atom:updated>2023-11-04T04:34:09.787Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Use Interfaces to Create Abstract Classes in .NET Core</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CFqu5ycnlMNo_KJAzK4uBA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@caipod?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Cai Fang</a> on <a href="https://unsplash.com/photos/a-blue-abstract-background-with-lines-and-shapes-zkcFnFOKUFk?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>Abstract classes and interfaces are two powerful features of the .NET Core programming language that can be used to create more maintainable, testable, and reusable code.</p><h3>What is an Abstract Class?</h3><p>An abstract class is a class that cannot be instantiated directly. Instead, it is used to define a common base class for other classes. Abstract classes can contain abstract methods, which are methods that must be implemented by the derived classes.</p><h3>What is an Interface?</h3><p>An interface is a reference type that defines a contract that other types must implement. This contract specifies the members (properties, methods, events, etc.) that the implementing type must provide.</p><h3>How to Use Interfaces to Create Abstract Classes</h3><p>To create an abstract class using an interface, you can follow these steps:</p><ol><li>Define an interface that specifies the common functionality that you want to provide in the abstract class.</li><li>Define the abstract class and inherit it from the interface.</li><li>Implement the abstract methods in the abstract class.</li><li>Create concrete classes that derive from the abstract class and implement the abstract methods.</li></ol><p>Here is an example of an abstract class that uses an interface:</p><pre>public interface IShape<br>{<br>    double GetArea();<br>}<br><br>public abstract class Shape : IShape<br>{<br>    public abstract double GetArea();<br>}<br><br>public class Circle : Shape<br>{<br>    public double Radius { get; set; }<br><br>    public override double GetArea()<br>    {<br>        return Math.PI * Radius * Radius;<br>    }<br>}<br><br>public class Rectangle : Shape<br>{<br>    public double Length { get; set; }<br>    public double Width { get; set; }<br><br>    public override double GetArea()<br>    {<br>        return Length * Width;<br>    }<br>}</pre><p>In this example, the IShape interface defines the GetArea() method, which must be implemented by any class that implements the interface. The Shape abstract class inherits from the IShape interface and implements the GetArea() method in an abstract way. The Circle and Rectangle classes derive from the Shape abstract class and implement the GetArea() method in a concrete way.</p><h3>Benefits of Using Interfaces to Create Abstract Classes</h3><p>There are several benefits to using interfaces to create abstract classes:</p><ul><li><strong>Loose coupling</strong>: Interfaces allow you to decouple the implementation of the abstract class from its usage. This means that you can change the implementation of the abstract class without affecting the code that uses it.</li><li><strong>Code reuse</strong>: Interfaces allow you to write code that is more reusable. For example, you can create an interface for a shape and then implement the interface for different types of shapes, such as circles, rectangles, and triangles. This allows you to write code that can work with any type of shape, as long as it implements the interface.</li><li><strong>Maintainability</strong>: Interfaces can help to make your code more maintainable. By decoupling the implementation of the abstract class from its usage, you make it easier to change or replace parts of the abstract class without affecting the rest of the code.</li><li><strong>Testability</strong>: Interfaces can help to make your code more testable. By using interfaces, you can mock or stub dependencies in your tests, which makes it easier to isolate and test individual units of code.</li></ul><h3>Conclusion</h3><p>Using interfaces to create abstract classes is a powerful technique that can help you to write more maintainable, testable, and reusable code in .NET Core. By using interfaces, you can decouple the implementation of your code from its usage and promote loose coupling.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5651e84df7e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/itthirit-technology/how-to-use-interfaces-to-create-abstract-classes-in-net-core-d5651e84df7e">How to Use Interfaces to Create Abstract Classes in .NET Core</a> was originally published in <a href="https://medium.com/itthirit-technology">Itthirit Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Interface in .NET Core and Why is it Important?]]></title>
            <link>https://medium.com/itthirit-technology/what-is-interface-in-net-core-and-why-is-it-important-40d57ecc8025?source=rss----c105ab8d0b76---4</link>
            <guid isPermaLink="false">https://medium.com/p/40d57ecc8025</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Weerayut Teja]]></dc:creator>
            <pubDate>Sat, 04 Nov 2023 14:45:13 GMT</pubDate>
            <atom:updated>2023-11-04T04:23:03.281Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Interface in .NET Core and Why is it Important?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gmj1u96lMWLldMCPvVhTVg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ahmeyer?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Mike Winkler</a> on <a href="https://unsplash.com/photos/a-close-up-of-a-metal-and-wood-cabinet-nZpdgvV92BY?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>Interfaces are a powerful feature of the .NET Core programming language that allows you to define contracts between different parts of your code. This can help you to write more maintainable, testable, and reusable code.</p><h3>What is an Interface?</h3><p>An interface is a reference type that defines a contract that other types must implement. This contract specifies the members (properties, methods, events, etc.) that the implementing type must provide.</p><h3>Why are Interfaces Important?</h3><p>Interfaces are important for a number of reasons. They can help you to:</p><ul><li>Achieve loose coupling: Interfaces allow you to decouple the implementation of a class from its usage. This means that you can change the implementation of a class without affecting the code that uses it.</li><li>Facilitate dependency injection: Interfaces are essential for dependency injection, a design pattern that allows you to decouple the creation of objects from their usage.</li><li>Promote code reuse: Interfaces allow you to write code that is more reusable. For example, you can create an interface for a data repository and then implement the interface for different types of data repositories, such as a database repository or a file repository. This allows you to write code that can work with any type of data repository, as long as it implements the interface.</li></ul><h3>How to Use Interfaces in .NET Core</h3><p>To use an interface in .NET Core, you first need to define the interface. This can be done using the interface keyword. For example, the following code defines an interface for a data repository:</p><pre>public interface IRepository&lt;T&gt;<br>{<br>    IEnumerable&lt;T&gt; GetAll();<br>    T GetById(int id);<br>    void Add(T entity);<br>    void Update(T entity);<br>    void Delete(T entity);<br>}</pre><p>Once you have defined the interface, you can then implement it for different types of data repositories. For example, the following code implements the IRepository interface for a database repository:</p><pre>public class DatabaseRepository&lt;T&gt; : IRepository&lt;T&gt;<br>{<br>    private readonly DbContext _context;<br><br>    public DatabaseRepository(DbContext context)<br>    {<br>        _context = context;<br>    }<br><br>    public IEnumerable&lt;T&gt; GetAll()<br>    {<br>        return _context.Set&lt;T&gt;().ToList();<br>    }<br><br>    public T GetById(int id)<br>    {<br>        return _context.Set&lt;T&gt;().Find(id);<br>    }<br><br>    public void Add(T entity)<br>    {<br>        _context.Set&lt;T&gt;().Add(entity);<br>        _context.SaveChanges();<br>    }<br><br>    public void Update(T entity)<br>    {<br>        _context.Set&lt;T&gt;().Update(entity);<br>        _context.SaveChanges();<br>    }<br><br>    public void Delete(T entity)<br>    {<br>        _context.Set&lt;T&gt;().Remove(entity);<br>        _context.SaveChanges();<br>    }<br>}</pre><p>Now that you have implemented the interface, you can use it to write code that is decoupled from the specific implementation of the data repository. For example, the following code uses the IRepository interface to get all products from the data repository:</p><pre>IRepository&lt;Product&gt; productRepository = new DatabaseRepository&lt;Product&gt;(new MyDbContext());<br><br>IEnumerable&lt;Product&gt; products = productRepository.GetAll();</pre><p>This code can now work with any type of data repository that implements the IRepository interface, without having to change the code itself.</p><h3>Conclusion</h3><p>Interfaces are a powerful feature of the .NET Core programming language that can help you to write more maintainable, testable, and reusable code. By using interfaces, you can decouple the implementation of your code from its usage, facilitate dependency injection, and promote code reuse.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40d57ecc8025" width="1" height="1" alt=""><hr><p><a href="https://medium.com/itthirit-technology/what-is-interface-in-net-core-and-why-is-it-important-40d57ecc8025">What is Interface in .NET Core and Why is it Important?</a> was originally published in <a href="https://medium.com/itthirit-technology">Itthirit Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create REST API using .NET Core and Entity Framework with PostgreSQL]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/itthirit-technology/create-rest-api-using-net-core-and-entity-framework-with-postgresql-7a06fe29b81b?source=rss----c105ab8d0b76---4"><img src="https://cdn-images-1.medium.com/max/1920/1*OoHyx04JbLPcekkxcUi4NA.jpeg" width="1920"></a></p><p class="medium-feed-snippet">Setting the Foundation: Integrating&#xA0;.NET Core with PostgreSQL</p><p class="medium-feed-link"><a href="https://medium.com/itthirit-technology/create-rest-api-using-net-core-and-entity-framework-with-postgresql-7a06fe29b81b?source=rss----c105ab8d0b76---4">Continue reading on Itthirit Technology »</a></p></div>]]></description>
            <link>https://medium.com/itthirit-technology/create-rest-api-using-net-core-and-entity-framework-with-postgresql-7a06fe29b81b?source=rss----c105ab8d0b76---4</link>
            <guid isPermaLink="false">https://medium.com/p/7a06fe29b81b</guid>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Weerayut Teja]]></dc:creator>
            <pubDate>Sun, 13 Aug 2023 14:29:59 GMT</pubDate>
            <atom:updated>2023-08-13T14:42:56.521Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Building Your First .NET Core Web App: A Step-by-Step Guide]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/itthirit-technology/building-your-first-net-core-web-app-a-step-by-step-guide-a69af3f55105?source=rss----c105ab8d0b76---4"><img src="https://cdn-images-1.medium.com/max/1920/1*VCKNBpic_PXu8GcypgPgQw.jpeg" width="1920"></a></p><p class="medium-feed-snippet">Step-by-Step Success: The Newbie&#x2019;s Guide to&#xA0;.NET Core Web Applications.</p><p class="medium-feed-link"><a href="https://medium.com/itthirit-technology/building-your-first-net-core-web-app-a-step-by-step-guide-a69af3f55105?source=rss----c105ab8d0b76---4">Continue reading on Itthirit Technology »</a></p></div>]]></description>
            <link>https://medium.com/itthirit-technology/building-your-first-net-core-web-app-a-step-by-step-guide-a69af3f55105?source=rss----c105ab8d0b76---4</link>
            <guid isPermaLink="false">https://medium.com/p/a69af3f55105</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Weerayut Teja]]></dc:creator>
            <pubDate>Sun, 13 Aug 2023 14:29:08 GMT</pubDate>
            <atom:updated>2023-08-13T14:15:08.189Z</atom:updated>
        </item>
    </channel>
</rss>