<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Metadata</title>
	<atom:link href="http://metadata.mx/feed/" rel="self" type="application/rss+xml" />
	<link>http://metadata.mx</link>
	<description>The personal blog of Carlos Rodríguez</description>
	<lastBuildDate>Thu, 28 Mar 2013 14:13:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Random full screen background image in your website</title>
		<link>http://metadata.mx/random-background-image/</link>
		<comments>http://metadata.mx/random-background-image/#comments</comments>
		<pubDate>Wed, 20 Feb 2013 18:54:41 +0000</pubDate>
		<dc:creator>Carlos Rodríguez</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[English]]></category>

		<guid isPermaLink="false">http://metadata.mx/?p=4966</guid>
		<description><![CDATA[<p>If you would like to get a random image for your websites&#8217;s background every time you load a page this mini tutorial is for you. I&#8217;m assuming you&#8217;re using the full screen background image method explained in this post first: Full screen background image in your wordpress website (or any website). If you aren&#8217;t you&#8217;ll need to implement it first so go ahead an read the post. Glad you&#8217;re back, now lets get to business. We&#8217;re going to use a rotator script by Dan Benjamin, it is explained in a great A List Apart article but we only need the code available here: http://d.alistapart.com/randomizer/rotate.txt 1.- Take Dan Benjamin&#8217;s code and save it as a PHP file, we&#8217;re going to call it &#8220;rotate.php&#8221; 2.- Via FTP create a directory called &#8220;bg&#8221; in your root directory and inside place the rotate.php file and any images you want to serve as backgrounds for your site. 3.- Now, if you implemented the  full screen background image method mentioned above right you inserted an inline &#60;img&#62; element somewhere in your code like this one: &#60;img id="bg_image" src="/bg.jpg" /&#62; We&#8217;re going to change that line to call our PHP script instead of an image, so our line of code should end up like this: &#60;img src="/bg/rotate.php" id="fsb_image"/&#62; Now thanks to the script every time we load a page the path of the script in that line will be replaced for the path to a randome image inside our bg directory, thus loading a random backgrund every time.</p><p>The post <a href="http://metadata.mx/random-background-image/">Random full screen background image in your website</a> appeared first on <a href="http://metadata.mx">Metadata</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>If you would like to get a random image for your websites&#8217;s background every time you load a page this mini tutorial is for you. I&#8217;m assuming you&#8217;re using the full screen background image method explained in this post first: <a href="http://metadata.mx/full-screen-background/">Full screen background image in your wordpress website</a> (or any website). If you aren&#8217;t you&#8217;ll need to implement it first so go ahead an read the post.</p>
<p>Glad you&#8217;re back, now lets get to business. We&#8217;re going to use a rotator script by <a href="https://twitter.com/danbenjamin">Dan Benjamin</a>, it is explained in a great <a href="http://alistapart.com/article/randomizer">A List Apart article</a> but we only need the code available here: <a href="http://d.alistapart.com/randomizer/rotate.txt">http://d.alistapart.com/randomizer/rotate.txt</a></p>
<p>1.- Take Dan Benjamin&#8217;s code and save it as a PHP file, we&#8217;re going to call it &#8220;rotate.php&#8221;</p>
<p>2.- Via FTP create a directory called &#8220;bg&#8221; in your root directory and inside place the rotate.php file and any images you want to serve as backgrounds for your site.</p>
<p>3.- Now, if you implemented the  full screen background image method mentioned above right you inserted an inline &lt;img&gt; element somewhere in your code like this one:</p>
<pre>&lt;img id="bg_image" src="/bg.jpg" /&gt;</pre>
<p>We&#8217;re going to change that line to call our PHP script instead of an image, so our line of code should end up like this:</p>
<pre>&lt;img src="/bg/rotate.php" id="fsb_image"/&gt;</pre>
<p>Now thanks to the script every time we load a page the path of the script in that line will be replaced for the path to a randome image inside our bg directory, thus loading a random backgrund every time.</p>
<p>The post <a href="http://metadata.mx/random-background-image/">Random full screen background image in your website</a> appeared first on <a href="http://metadata.mx">Metadata</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://metadata.mx/random-background-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Por que estoy en contra del intercambio de servicios</title>
		<link>http://metadata.mx/intercambio-de-servicios/</link>
		<comments>http://metadata.mx/intercambio-de-servicios/#comments</comments>
		<pubDate>Wed, 20 Feb 2013 17:35:54 +0000</pubDate>
		<dc:creator>Carlos Rodríguez</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Spanish]]></category>

		<guid isPermaLink="false">http://metadata.mx/?p=4959</guid>
		<description><![CDATA[<p>Lamentablemente a la mayoría de quienes ofrecemos un servicio profesional algún cliente potencial nos ha ofrecido sus productos o servicios a cambio de los nuestros, un intercambio, lo que comúnmente se conoce como trueque. Yo estoy totalmente en contra de esta práctica, no sólo en contra, es una política en mi empresa y un principio a nivel personal. La persona que ofrece un intercambio prefiere dar su producto o servicio en lugar de dinero, a fin de cuentas podría pensarse que un bien es un bien y que es válido aceptar un trato de este tipo, sin embargo hay varios problemas con el trueque: 1.- Es imposible establecer una tasa de cambio. La razón por la que existe el dinero es para contar con un vehículo de valor que permita realizar transacciones. Aunque el dinero propiamente no tiene valor es una representación del valor de algo, es como dijera Douglas Adams &#8220;una ficción con la que todos estamos de acuerdo&#8221;. En forma simplificada se podría decir que lo que yo hago son sitios web, entonces si voy a una tienda y quiero comprar 500gr de carne será difícil determinar a que fracción de un sitio web corresponden los 500gr; será aún más difícil que la tienda acepte una fracción de un sitio web a cambio de la carne, sin embargo usando el dinero como medio de intercambio yo puedo comprar la carne con el dinero que obtuve haciendo un sitio web. Recientemente un despacho de abogados me ofreció sus servicios a cambio de un sitio web. ¿A cuantas asesorías legales corresponde un sitio web? Tendríamos que tratar de encontrar un común denominador para establecer una tasa de cambio, por ejemplo horas de trabajo. Yo cotizó mi servicio en horas de trabajo pero ellos no, ¿entonces como se puede establecer una tasa de cambio? A través del dinero. 2.- Falta de interés o necesidad del producto o servicio a recibir. Otro problema es que lo más posible es que yo no este interesado en recibir el producto o servicio que mi contraparte ofrece, es por eso que no soy yo quien propuso el intercambio. El producto o servicio ofrecido no puede pagar la renta de una oficina, no puede pagar los sueldos de los empleados, no puede ni siquiera representar una utilidad; no puede ser fiscalizado, estaríamos incurriendo en una evasión de impuestos. Regresando al caso del despacho de abogados, yo no necesito ni requiero de sus servicios y la promesa de acceder a ellos en el futuro carece de valor para mi. Lo que es más, yo tengo mis propios abogados para atender asuntos legales con quienes he trabajado anteriormente y en quienes confío, al acceder a un intercambio de servicios me estaría obligando a usar los servicios de un despacho que no es de mi elección. 3.- Menosprecio del valor del trabajo. Si tu me ofreces servicios a cambio en lugar de dinero quiere decir que para ti el dinero tiene mayor valor, por lo tanto significa que consideras...</p><p>The post <a href="http://metadata.mx/intercambio-de-servicios/">Por que estoy en contra del intercambio de servicios</a> appeared first on <a href="http://metadata.mx">Metadata</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Lamentablemente a la mayoría de quienes ofrecemos un servicio profesional algún cliente potencial nos ha ofrecido sus productos o servicios a cambio de los nuestros, un intercambio, lo que comúnmente se conoce como trueque. Yo estoy totalmente en contra de esta práctica, no sólo en contra, es una política en mi empresa y un principio a nivel personal.</p>
<p>La persona que ofrece un intercambio prefiere dar su producto o servicio en lugar de dinero, a fin de cuentas podría pensarse que un bien es un bien y que es válido aceptar un trato de este tipo, sin embargo hay varios problemas con el trueque:</p>
<h3>1.- Es imposible establecer una tasa de cambio.</h3>
<p>La razón por la que existe el dinero es para contar con un vehículo de valor que permita realizar transacciones. Aunque el dinero propiamente no tiene valor es una representación del valor de algo, es como dijera Douglas Adams &#8220;una ficción con la que todos estamos de acuerdo&#8221;. En forma simplificada se podría decir que lo que yo hago son sitios web, entonces si voy a una tienda y quiero comprar 500gr de carne será difícil determinar a que fracción de un sitio web corresponden los 500gr; será aún más difícil que la tienda acepte una fracción de un sitio web a cambio de la carne, sin embargo usando el dinero como medio de intercambio yo puedo comprar la carne con el dinero que obtuve haciendo un sitio web.</p>
<p>Recientemente un despacho de abogados me ofreció sus servicios a cambio de un sitio web. ¿A cuantas asesorías legales corresponde un sitio web? Tendríamos que tratar de encontrar un común denominador para establecer una tasa de cambio, por ejemplo horas de trabajo. Yo cotizó mi servicio en horas de trabajo pero ellos no, ¿entonces como se puede establecer una tasa de cambio? A través del dinero.</p>
<h3>2.- Falta de interés o necesidad del producto o servicio a recibir.</h3>
<p>Otro problema es que lo más posible es que yo no este interesado en recibir el producto o servicio que mi contraparte ofrece, es por eso que no soy yo quien propuso el intercambio. El producto o servicio ofrecido no puede pagar la renta de una oficina, no puede pagar los sueldos de los empleados, no puede ni siquiera representar una utilidad; no puede ser fiscalizado, estaríamos incurriendo en una evasión de impuestos.</p>
<p>Regresando al caso del despacho de abogados, yo no necesito ni requiero de sus servicios y la promesa de acceder a ellos en el futuro carece de valor para mi. Lo que es más, yo tengo mis propios abogados para atender asuntos legales con quienes he trabajado anteriormente y en quienes confío, al acceder a un intercambio de servicios me estaría obligando a usar los servicios de un despacho que no es de mi elección.</p>
<h3>3.- Menosprecio del valor del trabajo.</h3>
<p>Si tu me ofreces servicios a cambio en lugar de dinero quiere decir que para ti el dinero tiene mayor valor, por lo tanto significa que consideras que mi trabajo tienen un valor menor al que yo le doy. No me interesa trabajar con alguien que considere que mi trabajo no tiene el valor cotizado. Lo que es aún más revelador es que consideras que tu propio trabajo vale menos que el dinero que quiero cobrar, es decir que la opinión que tienes de tu propio trabajo es inferior a la que yo tengo del mío y en un trato así yo saldría perdiendo.</p>
<p>Esta absurda práctica del intercambio de servicios se perpetúa a causa de las personas que consideran que su trabajo no tienen valor y en la desesperación de vender algo malo aceptarán cualquier trato. Para mi se ha convertido en una regla que quien ofrece intercambio de servicios no es profesional y no espera tampoco un servicio profesional. Este tipo de clientes no son para mi.</p>
<p>The post <a href="http://metadata.mx/intercambio-de-servicios/">Por que estoy en contra del intercambio de servicios</a> appeared first on <a href="http://metadata.mx">Metadata</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://metadata.mx/intercambio-de-servicios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Full screen background image in your WordPress website</title>
		<link>http://metadata.mx/full-screen-background/</link>
		<comments>http://metadata.mx/full-screen-background/#comments</comments>
		<pubDate>Tue, 19 Feb 2013 19:11:54 +0000</pubDate>
		<dc:creator>Carlos Rodríguez</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[English]]></category>

		<guid isPermaLink="false">http://metadata.mx/?p=4950</guid>
		<description><![CDATA[<p>This can be applied to any website or CMS if you place the code in the right places but for now we&#8217;re going to learn hot to have a full screen background image in a WordPress website. If you&#8217;re not comfortable editing some of your theme&#8217;s code you should download this great plugin that will do all the work for you: Simple Full Screen Background Image. However, it is best to install as fewer plugins as posible and using this method is very easy. There are lots of ways to accomplish this, Chris Coyier has a great post about a bunch of these methods with examples here. But this is the method that works best for me, it works in all modern browsers as well as IE8 and 9. First we are going to insert an inline &#60;img&#62; element in our footer (footer.php file) outside the footer &#60;div&#62; with an id that we&#8217;ll use in our CSS code and the path to our background image: &#60;img id="bg_image" src="/bg.jpg" /&#62; Now we need to insert this in our style sheet (style.css file): img#bg_image { min-height: 100%; min-width: 1024px; width: 100%; height: auto; position: fixed; top: 0; left: 0; z-index: -9999; } And if you&#8217;re using media queries insert this: @media only screen and (max-width: 1024px) { img#bg_image { left: 50%; margin-left: -512px; /* 50% */ } } That should do the trick for you.</p><p>The post <a href="http://metadata.mx/full-screen-background/">Full screen background image in your WordPress website</a> appeared first on <a href="http://metadata.mx">Metadata</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>This can be applied to any website or CMS if you place the code in the right places but for now we&#8217;re going to learn hot to have a full screen background image in a WordPress website.</p>
<p>If you&#8217;re not comfortable editing some of your theme&#8217;s code you should download this great plugin that will do all the work for you: <a title="Simple Full Screen Background Image" href="http://wordpress.org/extend/plugins/simple-full-screen-background-image/">Simple Full Screen Background Image</a>. However, it is best to install as fewer plugins as posible and using this method is very easy.</p>
<p>There are lots of ways to accomplish this, <a title="CHRIS COYIER" href="https://twitter.com/chriscoyier">Chris Coyier</a> has a great post about a bunch of these <a href="http://css-tricks.com/perfect-full-page-background-image/">methods with examples here</a>. But this is the method that works best for me, it works in all modern browsers as well as IE8 and 9.</p>
<p>First we are going to insert an inline &lt;img&gt; element in our footer (footer.php file) outside the footer &lt;div&gt; with an id that we&#8217;ll use in our CSS code and the path to our background image:</p>
<pre>&lt;img id="bg_image" src="/bg.jpg" /&gt;</pre>
<p>Now we need to insert this in our style sheet (style.css file):</p>
<pre>img#bg_image {
	min-height: 100%;
	min-width: 1024px;
	width: 100%;
	height: auto;
	position: fixed;
	top: 0;
	left: 0;
	z-index: -9999;
}</pre>
<p>And if you&#8217;re using media queries insert this:</p>
<pre>@media only screen and (max-width: 1024px) {
	img#bg_image {
                left: 50%;
                margin-left: -512px;   /* 50% */
    }
}</pre>
<p>That should do the trick for you.</p>
<p>The post <a href="http://metadata.mx/full-screen-background/">Full screen background image in your WordPress website</a> appeared first on <a href="http://metadata.mx">Metadata</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://metadata.mx/full-screen-background/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keep MAMP running in the background at all times</title>
		<link>http://metadata.mx/keep-mamp-running/</link>
		<comments>http://metadata.mx/keep-mamp-running/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 00:20:30 +0000</pubDate>
		<dc:creator>Carlos Rodríguez</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[English]]></category>

		<guid isPermaLink="false">http://metadata.mx/?p=4942</guid>
		<description><![CDATA[<p>If you have a local production environment with MAMP you know how annoying is to start MAMP every time, type your password and have it running as another open application with a window and dock icon. To solve this you can make a little script that will open MAMP each time you log on to your account without requiring a password and keep it running invisible in the background. 1.- First open the Keychain Access application that is found in the Utilities folder within the Applications folder. 2.- Add a new element called MAMP with your session account and password and save it: 3.- Now open AppleScript Editor found in the same directory as the previous application, there you&#8217;re going to copy and paste this code: on run set theUserName to do shell script ("security find-generic-password -gl MAMP &#124; grep \"acct\" &#124; cut -c 19-99 &#124; sed 's/\"//g'") set thePassword to do shell script ("security 2&#62;&#38;1 &#62;/dev/null find-generic-password -gl MAMP &#124; cut -c 11-99 &#124; sed 's/\"//g'") do shell script "/Applications/MAMP/bin/startApache.sh &#38;" password thePassword user name theUserName with administrator privileges do shell script "/Applications/MAMP/bin/startMysql.sh &#62; /dev/null 2&#62;&#38;1" end run Basically this script starts the MAMP server using your password in the Keychain Access app. 4.- Now save the script as an application and name it something like &#8220;openMAMP&#8221;. 5.- Move your application to the Applications folder and add it to your login items by entering to your account settings in the system preferences, this way the script will run every time you log on: 6.- Finally restart your computer. It is assumed that after the restart when logging to your session the script will run and it will start your local server. There will be no application running but the server will be running.</p><p>The post <a href="http://metadata.mx/keep-mamp-running/">Keep MAMP running in the background at all times</a> appeared first on <a href="http://metadata.mx">Metadata</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>If you have a local production environment with MAMP you know how annoying is to start MAMP every time, type your password and have it running as another open application with a window and dock icon. To solve this you can make a little script that will open MAMP each time you log on to your account without requiring a password and keep it running invisible in the background.</p>
<p>1.- First open the Keychain Access application that is found in the Utilities folder within the Applications folder.</p>
<p>2.- Add a new element called MAMP with your session account and password and save it:</p>
<p><img class="aligncenter size-full wp-image-221" title="KeyChain element" alt="" src="http://metadata.mx/wp-content/uploads/2011/11/screen-capture-11.png" width="440" height="409" /></p>
<p><span style="text-align: justify;">3.- Now open AppleScript Editor found in the same directory as the previous application, there you&#8217;re going to copy and paste this code:</span></p>
<pre>on run
set theUserName to do shell script ("security find-generic-password -gl MAMP | grep \"acct\" | cut -c 19-99 | sed 's/\"//g'")
set thePassword to do shell script ("security 2&gt;&amp;1 &gt;/dev/null find-generic-password -gl MAMP | cut -c 11-99 | sed 's/\"//g'")
do shell script "/Applications/MAMP/bin/startApache.sh &amp;" password thePassword user name theUserName with administrator privileges
do shell script "/Applications/MAMP/bin/startMysql.sh &gt; /dev/null 2&gt;&amp;1"
end run</pre>
<p style="text-align: center;"><img class="size-full wp-image-222 aligncenter" title="Script" alt="" src="http://metadata.mx/wp-content/uploads/2011/11/screen-capture-21.png" width="490" height="540" /></p>
<p>Basically this script starts the MAMP server using your password in the Keychain Access app.</p>
<p><span style="text-align: justify;">4.- Now save the script as an application and name it something like &#8220;openMAMP&#8221;.</span></p>
<p><span style="text-align: justify;">5.- Move your application to the Applications folder and add it to your login items by entering to your account settings in the system preferences, this way the script will run every time you log on:</span></p>
<p><img class="aligncenter size-full wp-image-223" title="Login items" alt="" src="http://metadata.mx/wp-content/uploads/2011/11/screen-capture2.png" width="490" height="400" /></p>
<p>6.- Finally restart your computer. It is assumed that after the restart when logging to your session the script will run and it will start your local server. There will be no application running but the server will be running.</p>
<p>The post <a href="http://metadata.mx/keep-mamp-running/">Keep MAMP running in the background at all times</a> appeared first on <a href="http://metadata.mx">Metadata</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://metadata.mx/keep-mamp-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress, let your readers save posts as PDF files</title>
		<link>http://metadata.mx/wordpress-save-posts-as-pdf/</link>
		<comments>http://metadata.mx/wordpress-save-posts-as-pdf/#comments</comments>
		<pubDate>Sun, 10 Feb 2013 00:28:47 +0000</pubDate>
		<dc:creator>Carlos Rodríguez</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[English]]></category>

		<guid isPermaLink="false">http://metadata.mx/?p=4865</guid>
		<description><![CDATA[<p>Some times saving an article as a PDF comes pretty useful, specially when doing research or saving reference documentation or tutorials. If you&#8217;re running a WordPress website and want to let your readers save your posts as PDF files you&#8217;ll find this little tutorial pretty useful. First an example: if you scroll all the way down to the end of this post you&#8217;ll find a &#8220;SAVE THIS POST AS PDF&#8221; link, click it and this article will be downloaded as PDF for you. Thats exactly what we&#8217;re going to achieve in this tutorial, you&#8217;ll end up with a link or button like mine in your own WordPress website. So what we&#8217;re going to do is to use a web app called PDFmyURL.com which has a powerful API with numerous options available for customizing, manipulating or adding data to a PDF file. Of course we&#8217;re going to throw in some WordPress functions to make a dynamic link/button, that means that you&#8217;ll have to insert it once on your theme&#8217;s loop or file of your choice and it will automatically work for all your posts. The PDFmyURL API First lets play a little bit with the PDFmyURL  API, the complete documentation can be found here, but basically all you have to do is a http server call to convert any website to a PDF like this: http://pdfmyurl.com?url={url} where {url} is the URL of the website you want to convert to a PDF. Lets say I want to convert this post to a PDF, the URL for the post is http://metadata.mx/wordpress-save-posts-as-pdf/ so all I have to do is make the http server call like this: http://pdfmyurl.com?url=http://metadata.mx/wordpress-save-posts-as-pdf/ You can paste the entire URL above in your browser&#8217;s address bar, hit enter and a PDF containing this article will start downloading within few seconds. Magic right? Not that impressed? Ok here comes the fun part, the API lets you add optional parameters to customize the content of the PDF and even it&#8217;s size and orientation. Lets say I want my PDF to have a portrait orientation (default is landscape), letter size (default is A4) and I want to define the name of the output file, let&#8217;s say I want to name the file &#8220;wordpress.pdf&#8221;. All I have to do is add the corresponding parameters: -O=Portrait -s=Letter --filename=wordpress.pdf So now my http server call looks like this: http://pdfmyurl.com?url=http://metadata.mx/wordpress-save-posts-as-pdf/&#38;-O=Portrait&#38;-s=Letter&#38;--filename=wordpress.pdf Go ahead, try it in your browser. The entire list of parameters, lots of them, can be found in the API documentation linked above. The WordPress functions Ok, with what we know now we could make a static link for every one of our posts but what we really want is to add a dynamic link once in our template and have it work in all our posts. So basically what we need is a function that returns the title of our post and a function that returns the URL. That way we can replace the URL and filename we&#8217;ve been using in our http server call with those functions. The first function we&#8217;re going to use is &#60;?php echo get_permalink(); ?&#62;, this function...</p><p>The post <a href="http://metadata.mx/wordpress-save-posts-as-pdf/">WordPress, let your readers save posts as PDF files</a> appeared first on <a href="http://metadata.mx">Metadata</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Some times saving an article as a PDF comes pretty useful, specially when doing research or saving reference documentation or tutorials. If you&#8217;re running a WordPress website and want to let your readers save your posts as PDF files you&#8217;ll find this little tutorial pretty useful. First an example: if you scroll all the way down to the end of this post you&#8217;ll find a &#8220;SAVE THIS POST AS PDF&#8221; link, click it and this article will be downloaded as PDF for you. Thats exactly what we&#8217;re going to achieve in this tutorial, you&#8217;ll end up with a link or button like mine in your own WordPress website.</p>
<p>So what we&#8217;re going to do is to use a web app called <a title="PDFmyURL" href="http://pdfmyurl.com/">PDFmyURL.com</a> which has a powerful API with numerous options available for customizing, manipulating or adding data to a PDF file. Of course we&#8217;re going to throw in some WordPress functions to make a dynamic link/button, that means that you&#8217;ll have to insert it once on your theme&#8217;s loop or file of your choice and it will automatically work for all your posts.</p>
<h2>The PDFmyURL API</h2>
<p>First lets play a little bit with the PDFmyURL  API, the complete documentation <a title="Documentation" href="http://support.pdfmyurl.com/topic/api-application-programming-interface">can be found here</a>, but basically all you have to do is a http server call to convert any website to a PDF like this:</p>
<pre>http://pdfmyurl.com?url={url}</pre>
<p>where {url} is the URL of the website you want to convert to a PDF. Lets say I want to convert this post to a PDF, the URL for the post is http://metadata.mx/wordpress-save-posts-as-pdf/ so all I have to do is make the http server call like this:</p>
<pre>http://pdfmyurl.com?url=http://metadata.mx/wordpress-save-posts-as-pdf/</pre>
<p>You can paste the entire URL above in your browser&#8217;s address bar, hit enter and a PDF containing this article will start downloading within few seconds. Magic right?</p>
<p>Not that impressed? Ok here comes the fun part, the API lets you add optional parameters to customize the content of the PDF and even it&#8217;s size and orientation.</p>
<p>Lets say I want my PDF to have a portrait orientation (default is landscape), letter size (default is A4) and I want to define the name of the output file, let&#8217;s say I want to name the file &#8220;wordpress.pdf&#8221;. All I have to do is add the corresponding parameters:</p>
<pre>-O=Portrait
-s=Letter
--filename=wordpress.pdf</pre>
<p>So now my http server call looks like this:</p>
<pre>http://pdfmyurl.com?url=http://metadata.mx/wordpress-save-posts-as-pdf/&amp;-O=Portrait&amp;-s=Letter&amp;--filename=wordpress.pdf</pre>
<p>Go ahead, try it in your browser.</p>
<p>The entire list of parameters, lots of them, can be found in the API documentation linked above.</p>
<h2>The WordPress functions</h2>
<p>Ok, with what we know now we could make a static link for every one of our posts but what we really want is to add a dynamic link once in our template and have it work in all our posts. So basically what we need is a function that returns the title of our post and a function that returns the URL. That way we can replace the URL and filename we&#8217;ve been using in our http server call with those functions.</p>
<p>The first function we&#8217;re going to use is <strong>&lt;?php echo get_permalink(); ?&gt;</strong>, this function will return the URL of the current post, the complete documentation <a href="http://codex.wordpress.org/Function_Reference/get_permalink">can be found here</a>.</p>
<p>Now, how are we going to name our PDF file? that&#8217;s what we&#8217;re going to solve with the second function: <strong>&lt;?php echo get_the_title(); ?&gt;</strong>, which will return the title for the current post, and the complete documentation for that function <a href="http://codex.wordpress.org/Function_Reference/get_the_title">can be found here</a>.</p>
<p>We want to replace the URL and filename parts with our WordPress functions, so our http server call will look like this</p>
<pre>http://pdfmyurl.com?url=&lt;?php echo get_permalink(); ?&gt;&amp;-O=Portrait&amp;-s=Letter&amp;--filename=&lt;?php echo get_the_title(); ?&gt;.pdf</pre>
<p>Of course that wont work in our browser address bar, we need to insert the whole server call as a text link or button (image link or CSS button link) in our theme like this:</p>
<pre>&lt;p&gt;Save this post &lt;a href="http://pdfmyurl.com?url=&lt;?php echo get_permalink(); ?&gt;&amp;-O=Portrait&amp;-s=Letter&amp;--filename=&lt;?php echo get_the_title(); ?&gt;.pdf"&gt;as PDF&lt;/a&gt;&lt;/p&gt;</pre>
<p>Every theme is different so you&#8217;ll have to decide where&#8217;s the right place to insert it within your theme&#8217;s structure.</p>
<p>The post <a href="http://metadata.mx/wordpress-save-posts-as-pdf/">WordPress, let your readers save posts as PDF files</a> appeared first on <a href="http://metadata.mx">Metadata</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://metadata.mx/wordpress-save-posts-as-pdf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
