I've created a 300dpi A4 image, but when uploaded i've seen in the .module the pdf class is instanced without dimensions.

So i've overridden calling the method by my own.

To get background image filling the entire page you just should call the method with that arguments:

$pdf->image(string[uploadedFile] , int [x coord. = 0 ] ,[y coord = 0], int[width=297], int[height=210]);

If no width or height is passed, it's defaultly stretch image to 72dpi and go outside pdf page.

Comments

jredding’s picture

You're right the function

function theme_pdfidcard_addpage(&$pdf, $template, &$account){
  $pdf->AddPage();
  $pdf->Image($template['bgimage'],0,0);
  eval($template['php_format_code']);
  return $pdf;
}

does not set a width/height for the image as those are automatically calculated by the object IF the image is at 72dpi. You're image, however, is at 300dpi so the width/height are off compared to the PDF document.

The solution you propose, however, isn't very good because while it works great for you it won't work for others as its a hardset width/height.

Fortunately this is why I make these functions overrideable.

How do you currently have the template setup? Is it to an A4 page or to image?

I could easily modify the module so that the width/height settings are applied even if the settings aren't set to "image". This would at least make it easier to work with.

What are your suggestions on modifying the module to handle non-72 dpi images? (as TCPDF is set to work at 72dpi)

jredding’s picture

Title: $pdf->image is instanced with default 72dpi resolution » $pdf->image allow for image of other resolutions (ex. 300dpi)
Category: bug » feature
Status: Active » Postponed

Changing this to a feature request, changing the title and setting as postponed as there are no plans to support anything other than 72 DPI.