{"id":22,"date":"2006-11-29T17:58:12","date_gmt":"2006-11-29T15:58:12","guid":{"rendered":"http:\/\/blog.ansuz.nl\/index.php\/2006\/11\/29\/dompdf-experiment-pt3-images\/"},"modified":"2006-11-29T18:02:04","modified_gmt":"2006-11-29T16:02:04","slug":"dompdf-experiment-pt3-images","status":"publish","type":"post","link":"http:\/\/blog.ansuz.nl\/index.php\/2006\/11\/29\/dompdf-experiment-pt3-images\/","title":{"rendered":"dompdf experiment pt3 &#8211; images"},"content":{"rendered":"<p>An image can be added for use with pdf in two ways:<\/p>\n<ol>\n<li>Let dompdf determine the size for the image acoording to the <em>DOMPDF_DPI<\/em> setting in dompdf_config.inc.php or<\/li>\n<li>Determine the size in CSS using a unit other than pixels<\/li>\n<\/ol>\n<p><strong>Method 1:<\/strong> place your image in your html doc and change the line following line to your preferred DPI setting:<\/p>\n<blockquote><p>define(&#8220;DOMPDF_DPI&#8221;, &#8220;300&#8221;);<\/p><\/blockquote>\n<p><em>Note:<\/em> This gives you little control over the width\/height of the image used in your pdf. (Keeping in mind that you might want to do this dynamically and let users upload their own images)<\/p>\n<p><strong>Method 2:<\/strong> set the image size in your CSS, ie:<\/p>\n<blockquote><p>img.fixedsize {<br \/>\nwidth: 150mm;<br \/>\n}<\/p><\/blockquote>\n<p>This gives the image (with class name &#8216;fixedsize&#8217;) a fixed width of 150mm. Very usefull to stay &#8216;true&#8217; to a certain layout.<br \/>\n<em>Note:<\/em> The disadvantage of this method is that an image can be too small to decently use in your predefined size and thus appears grainy in your pdf file.<\/p>\n<p>All in all this works fine and I ran into no trouble at all.<\/p>\n<ul>\n<li><a target=\"_blank\" href=\"http:\/\/vilarricatest.nl.php5.nognietonline.eu\/test\/dompdf\/www\/test\/vilarrica\/viltest03.html\">html<\/a><\/li>\n<li><a target=\"_blank\" href=\"http:\/\/vilarricatest.nl.php5.nognietonline.eu\/test\/dompdf\/dompdftest03.php\">pdf<\/a><\/li>\n<\/ul>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>An image can be added for use with pdf in two ways: Let dompdf determine the size for the image acoording to the DOMPDF_DPI setting in dompdf_config.inc.php or Determine the size in CSS using a unit other than pixels Method &hellip; <a href=\"http:\/\/blog.ansuz.nl\/index.php\/2006\/11\/29\/dompdf-experiment-pt3-images\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-22","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":0,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}