<?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[Stories by Rajan Panchal on Medium]]></title>
        <description><![CDATA[Stories by Rajan Panchal on Medium]]></description>
        <link>https://medium.com/@rajanpanchal51196?source=rss-16d634aaecdc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*PAurf3t4WxBdu5n2.jpg</url>
            <title>Stories by Rajan Panchal on Medium</title>
            <link>https://medium.com/@rajanpanchal51196?source=rss-16d634aaecdc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 17:55:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajanpanchal51196/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Top 5 : Best open-source PDF generation libraries for PHP]]></title>
            <link>https://rajanpanchal51196.medium.com/top-5-best-open-source-pdf-generation-libraries-for-php-ec02c96ca3ad?source=rss-16d634aaecdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec02c96ca3ad</guid>
            <category><![CDATA[pdf]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[trending]]></category>
            <category><![CDATA[dependencies]]></category>
            <dc:creator><![CDATA[Rajan Panchal]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 10:43:02 GMT</pubDate>
            <atom:updated>2023-01-24T10:43:02.969Z</atom:updated>
            <content:encoded><![CDATA[<h3>Top 5 : Best open-source PDF generation libraries for PHP</h3><p>See our collection from 5 of the best PDF generator libraries for PHP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/0*cWOZFjoc4Z8Wa4lg.png" /></figure><p>The automatic creation of PDF files is one of the most important points of a project (commercial or not). As probably, the generated PDF’s are not for you or team but for your demanding clients, you need to provide a solution that meets all expectations and requirements.</p><p>In some cases, not because of exaggerated customer requirements but the library you use to generate PDF’s, you’ll find yourself limited and most likely in problems to provide a solution for the client.</p><p>In this article, we are going to show 5 of the most imponent PDF generation libraries that will help you to achieve those complex and extense PDF’s.</p><p>This top is based in different points as how easy are they to implement, use cases, library users, functions and development status.</p><h3>5. <a href="http://www.fpdf.org/">FPDF</a></h3><p><a href="http://www.fpdf.org/">Examples</a></p><p>FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.</p><p>FPDF has other advantages: high level functions, between its main features are:</p><ul><li>Choice of measure unit, page format and margins.</li><li>Page header and footer management.</li><li>Automatic page break.</li><li>Automatic line break and text justification.</li><li>Image support (JPEG, PNG and GIF).</li><li>Colors.</li><li>Links.</li><li>TrueType, Type1 and encoding support.</li><li>Page compression.</li></ul><p>FPDF requires no extension (except Zlib to enable compression and GD for GIF support). The latest version requires at least PHP 5.1.</p><p>The following snippet show a basic PDF generated with FPDF :</p><pre>&lt;?php<br>require(&#39;fpdf/fpdf.php&#39;);</pre><pre>$pdf = new FPDF();<br>$pdf-&gt;AddPage();<br>$pdf-&gt;SetFont(&#39;Arial&#39;,&#39;B&#39;,16);<br>$pdf-&gt;Cell(40,10,&#39;Hello World!&#39;);<br>$pdf-&gt;Output();<br>?&gt;</pre><p>Copy snippet</p><h3>4. mPDF</h3><p>mPDF is a PHP class which generates PDF files from UTF-8 encoded HTML. It is based on <a href="http://www.fpdf.org/">FPDF</a> and <a href="http://html2fpdf.sourceforge.net/">HTML2FPDF</a> , with a number of enhancements. mPDF was written by Ian Back and is released under the <a href="https://github.com/mpdf/mpdf/blob/development/LICENSE.txt">GNU GPL v2 licence</a>.</p><p>Before start using it, we encorage you to read the documentation located at <a href="https://mpdf.github.io/">https://mpdf.github.io/</a>.</p><p>The following snippet show a basic PDF after a composer installation with mPDF :</p><pre>&lt;?php<br>require_once __DIR__ . &#39;/vendor/autoload.php&#39;;</pre><pre>$mpdf = new mPDF();</pre><pre>// Write some HTML code:</pre><pre>$mpdf-&gt;WriteHTML(&#39;&lt;h1&gt;Hello World&lt;/h1&gt;&lt;br&gt;&lt;p&gt;My first PDF with mPDF&lt;/p&gt;&#39;);</pre><pre>// Output a PDF file directly to the browser<br>$mpdf-&gt;Output();<br>?&gt;</pre><p>Copy snippet</p><h3>3. <a href="https://dompdf.github.io/">DOMPDF</a></h3><p><a href="https://github.com/dompdf/dompdf">Github</a></p><p>Dompdf is (mostly) a CSS 2.1 compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer: it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes.</p><h3>Features</h3><ul><li>Handles most CSS 2.1 and a few CSS3 properties, including @import, @media &amp; @page rules</li><li>Supports most presentational HTML 4.0 attributes</li><li>Supports external stylesheets, either local or through http/ftp (via fopen-wrappers)</li><li>Supports complex tables, including row &amp; column spans, separate &amp; collapsed border models, individual cell styling</li><li>Image support (gif, png (8, 24 and 32 bit with alpha channel), bmp &amp; jpeg)</li><li>No dependencies on external PDF libraries, thanks to the R&amp;OS PDF class</li><li>Inline PHP support</li><li>Basic SVG support</li></ul><h3>Requirements</h3><ul><li>PHP version 5.3.0 or higher</li><li>DOM extension</li><li>GD extension</li><li>MBString extension</li><li>php-font-lib</li><li>php-svg-lib</li></ul><h3>Recommendations</h3><ul><li>OPcache (OPcache, XCache, APC, etc.): improves performance</li><li>IMagick or GMagick extension: improves image processing performance</li></ul><p>The following snippet shows how to generate a simple PDF and generate a direct download using Dompdf :</p><pre>&lt;?php<br>require_once &#39;dompdf/autoload.inc.php&#39;;<br>// reference the Dompdf namespace<br>use Dompdf\Dompdf;</pre><pre>// instantiate and use the dompdf class<br>$dompdf = new Dompdf();<br>$dompdf-&gt;loadHtml(&#39;&lt;h1&gt;DOMPDF Demo&lt;/h1&gt;&lt;br&gt;&lt;p&gt;Hello World !&lt;/p&gt;&#39;);</pre><pre>// (Optional) Setup the paper size and orientation<br>$dompdf-&gt;setPaper(&#39;A4&#39;, &#39;portrait&#39;);</pre><pre>// Render the HTML as PDF<br>$dompdf-&gt;render();</pre><pre>// Output the generated PDF to Browser<br>$dompdf-&gt;stream();</pre><p>Copy snippet</p><h3>2. <a href="https://github.com/KnpLabs/snappy">Snappy (wkhtmltopdf)</a></h3><p><a href="https://github.com/KnpLabs/snappy">Github Snappy Library</a> | <a href="https://github.com/wkhtmltopdf/wkhtmltopdf">Github wkhtmltopdf</a></p><p>Snappy is a PHP5 library allowing thumbnail, snapshot or PDF generation from a url or a html page. <strong>It uses the excellent webkit-based wkhtmltopdf and wkhtmltoimage available on OSX, linux, windows. You will have to download wkhtmltopdf 0.12.x in order to use Snappy</strong>.</p><p>wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely “headless” and do not require a display or display service.</p><p>You can even download a wkhtmltopdf distribution as a composer dependency and reference the Binary dinamically in your project.</p><p>The following snippet show a basic PDF from HTML using wkhtmltopdf in Windows with the Github homepage:</p><pre>&lt;?php</pre><pre>require __DIR__ . &#39;/vendor/autoload.php&#39;;</pre><pre>use Knp\Snappy\Pdf;</pre><pre>// For example, in windows use the wkhtmltopdf executable file<br>$snappy = new Pdf(&#39;wkhtmltopdf.exe&#39;);</pre><pre>// Download the streamed PDF<br>header(&#39;Content-Type: application/pdf&#39;);<br>header(&#39;Content-Disposition: attachment; filename=&quot;file.pdf&quot;&#39;);<br>echo $snappy-&gt;getOutput(&#39;http://www.github.com&#39;);</pre><p>Copy snippet</p><h3>1. <a href="https://tcpdf.org/">TCPDF</a></h3><p><a href="https://github.com/tecnickcom/tcpdf">Github</a> | <a href="https://tcpdf.org/">Homepage</a></p><p>TCPDF is a PHP library for generating PDF documents on-the-fly easily and with a couple of lines. It support customization and a lot of key features when you work with the creation of PDF files.</p><p>This library supports Unicode fonts and it is actively maintained by <a href="https://github.com/nicolaasuni">Nicola Asuni</a> in the Github repository.</p><p>It has a extense <a href="https://tcpdf.org/examples/">collection of examples and ready-to-test snippets on its official homepage</a>. TCPDF has as main features :</p><ul><li><strong>No external libraries are required for the basic functions</strong>.</li><li>all standard page formats, custom page formats, custom margins and units of measure.</li><li>UTF-8 Unicode and Right-To-Left languages.</li><li>TrueTypeUnicode, OpenTypeUnicode v1, TrueType, OpenType v1, Type1 and CID-0 fonts.</li><li>font subsetting.</li><li>methods to publish some XHTML + CSS code, Javascript and Forms.</li><li>images, graphic (geometric figures) and transformation methods.</li><li>supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (<a href="http://www.imagemagick.org/script/formats.php">http://www.imagemagick.org/script/formats.php</a>)</li><li>1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extension, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index — Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417.</li><li>JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies.</li><li>automatic page header and footer management.</li><li>document encryption up to 256 bit and digital signature certifications.</li><li>transactions to UNDO commands.</li><li>PDF annotations, including links, text and file attachments.</li><li>text rendering modes (fill, stroke and clipping).</li><li>multiple columns mode.</li><li>no-write page regions.</li><li>bookmarks, named destinations and table of content.</li><li>text hyphenation.</li><li>text stretching and spacing (tracking).</li><li>automatic page break, line break and text alignments including justification.</li><li>automatic page numbering and page groups.</li><li>move and delete pages.</li><li>Page compression (requires php-zlib extension).</li><li>XOBject Templates.</li><li>Layers and object visibility.</li><li>PDF/A-1b support.</li></ul><p>The following example how to render HTML as PDF with TCPDF :</p><pre>&lt;?php <br>// Include the main TCPDF library (search for installation path).<br>require_once(&#39;tcpdf_include.php&#39;);</pre><pre>// create new PDF document<br>$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, &#39;UTF-8&#39;, false);</pre><pre>// set document information<br>$pdf-&gt;SetCreator(PDF_CREATOR);<br>$pdf-&gt;SetAuthor(&#39;Our Code World&#39;);<br>$pdf-&gt;SetTitle(&#39;Example Write Html&#39;);</pre><pre>// set default header data<br>$pdf-&gt;SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.&#39; 006&#39;, PDF_HEADER_STRING);</pre><pre>// set header and footer fonts<br>$pdf-&gt;setHeaderFont(Array(PDF_FONT_NAME_MAIN, &#39;&#39;, PDF_FONT_SIZE_MAIN));<br>$pdf-&gt;setFooterFont(Array(PDF_FONT_NAME_DATA, &#39;&#39;, PDF_FONT_SIZE_DATA));</pre><pre>// set default monospaced font<br>$pdf-&gt;SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);</pre><pre>// set margins<br>$pdf-&gt;SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);<br>$pdf-&gt;SetHeaderMargin(PDF_MARGIN_HEADER);<br>$pdf-&gt;SetFooterMargin(PDF_MARGIN_FOOTER);</pre><pre>// set auto page breaks<br>$pdf-&gt;SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);</pre><pre>// set image scale factor<br>$pdf-&gt;setImageScale(PDF_IMAGE_SCALE_RATIO);</pre><pre>// add a page<br>$pdf-&gt;AddPage();</pre><pre>$html = &#39;&lt;h4&gt;PDF Example&lt;/h4&gt;&lt;br&gt;&lt;p&gt;Welcome to the Jungle&lt;/p&gt;&#39;;<br> <br>$pdf-&gt;writeHTML($html, true, false, true, false, &#39;&#39;);<br>// add a page<br>$pdf-&gt;AddPage();</pre><pre>$html = &#39;&lt;h1&gt;Hey&lt;/h1&gt;&#39;;<br>// output the HTML content<br>$pdf-&gt;writeHTML($html, true, false, true, false, &#39;&#39;);</pre><pre>// reset pointer to the last page<br>$pdf-&gt;lastPage();<br>//Close and output PDF document<br>$pdf-&gt;Output(&#39;example_006.pdf&#39;, &#39;I&#39;);</pre><p>Copy snippet</p><p>TCPDF in the first place, why?. Theoretically, the first place should be of wkhtmltopdf as it uses webkit to render your HTML and probably will be more helpful to render things as canvas, SVG etc. However, you need to know that not every developer is able to include binaries (application or executables) on its projects or enjoy the privileges of do whatever he wants with the server, that’s when TCPDF becomes the first option for the most developers.</p><p>TCPDF is on the first place of this top as it is the most easy to use PHP library to create PDF’s and however, the most complete and extense as it doesn’t require executable files as everything works with Plain PHP. It covers the basic requirements of all project that requires the PDF generation feature.</p><p>If you know another awesome PHP library to generate PDF, please share it with the community in the comment box down below, have fun !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec02c96ca3ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to contribute on WordPress core?]]></title>
            <link>https://rajanpanchal51196.medium.com/how-to-contribute-on-wordpress-core-978f1cc405ec?source=rss-16d634aaecdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/978f1cc405ec</guid>
            <category><![CDATA[patch]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[cores]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[contribution]]></category>
            <dc:creator><![CDATA[Rajan Panchal]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 06:09:10 GMT</pubDate>
            <atom:updated>2023-01-24T06:09:10.723Z</atom:updated>
            <content:encoded><![CDATA[<p>Contributing to the WordPress core is a great way to get involved in the WordPress community and help improve the platform for millions of users around the world. Here are the general steps to contribute to the WordPress Core:</p><p>Familiarize yourself with the WordPress development process: Before you start contributing, it’s important to understand the development process and the tools that are used. This includes understanding the codebase, the different branches, and the development workflow.</p><p>Set up your development environment: You will need a local development environment to test your changes. You can install WordPress locally using a tool like XAMPP or MAMP.</p><p>Join the WordPress community: Joining the WordPress community is a great way to connect with other developers, get help, and stay up-to-date on the latest developments. You can join the WordPress Development community on Slack, or follow the WordPress development blog.</p><p>Find a bug or feature to work on: You can start by looking for issues that are labeled as “good first bug” or “up for grabs” on the WordPress Trac, or by submitting your own bug or feature request.</p><p>Create a patch: Once you have identified an issue to work on, create a patch that addresses the issue. A patch is a file that contains the changes you have made to the code. You can create a patch using the git diff command.</p><p>Submit your patch for review: Submit your patch for review by creating a new ticket on the WordPress Trac, and attaching your patch file. The WordPress core team will review your patch, and you may be asked to make revisions before it can be committed.</p><p>Keep track of your patch: Once your patch is submitted, keep an eye on the ticket and respond to any feedback or requests for revisions.</p><p>Test your patch: Before submitting your patch, make sure you test it thoroughly. You can test your patch by installing it on a local development environment and testing it with different browsers and devices.</p><p>Please note that the process of contributing to the WordPress core can be complex and time-consuming, but it’s a great way to gain experience, learn new skills, and give back to the community.</p><p>It’s always a good idea to start by contributing to a plugin or a theme, as it will give you a good understanding of the WordPress platform and the community before moving to contribute to the core.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=978f1cc405ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get phone country code using IP API]]></title>
            <link>https://rajanpanchal51196.medium.com/get-phone-country-code-using-ip-api-3b69ad9f3b80?source=rss-16d634aaecdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b69ad9f3b80</guid>
            <category><![CDATA[ip]]></category>
            <category><![CDATA[country-code]]></category>
            <dc:creator><![CDATA[Rajan Panchal]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 05:42:43 GMT</pubDate>
            <atom:updated>2023-01-24T05:42:43.165Z</atom:updated>
            <content:encoded><![CDATA[<p>Determining the country of origin for a phone number can be a useful feature for many applications, such as targeted marketing, customer service routing, and fraud detection. One way to accomplish this is by using an IP geolocation API to determine the country code based on the user’s IP address.</p><p>An IP geolocation API is a service that allows you to request information about the location of an IP address. This information typically includes the country, region, city, and latitude/longitude coordinates. By making a request to an IP geolocation API and extracting the country code, you can determine the country of origin for a phone number.</p><p>There are several free IP geolocation APIs available, such as “<strong>ipapi</strong>”, “<strong>ipgeolocation</strong>”, and “<strong>ipstack</strong>”. These APIs can be easily integrated into your application by making a GET request to the API endpoint and parsing the response. For example, using the “<strong>ipapi</strong>” API, you can make a GET request to the endpoint “<a href="https://ipapi.co/json">https://ipapi.co/json</a>&quot; and extract the country code from the response as follows:</p><pre>$.get(&quot;https://ipapi.co/json&quot;, function(response) {<br>    var countryCode = response.country;<br>    console.log(countryCode);<br>});</pre><p>It’s worth noting that the accuracy of the country code obtained from IP geolocation APIs can vary depending on the IP address and the service provider. Also, keep in mind that IP geolocation is not always accurate and also make sure to check the usage limits and other restrictions of the API you are using.</p><p>In summary, using an IP geolocation API is a simple and effective way to determine the country code for a phone number based on the user’s IP address. By making a GET request to an API endpoint and parsing the response, you can quickly and easily determine the country of origin for a phone number and use this information to enhance your application’s functionality.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b69ad9f3b80" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>