i have added an image in a pdf generated in PHP with FPDF, the problem occurs when i insert an image the image gets inserted at the right location but with an ugly border around it whereas in the actual image there is no border. Another important thing that need to be mentioned here is that i have re-sized it with the FPDF Image() method parameters my code is:
$this->Image('report_footer.jpg',10,280,190,8);
The border appears only on the top and left side of the image as shown below:
Any idea to get rid of the border arround my image?
You can try providing the image type alongwith other parameters. You can also try editing the image to the required dimensions and then give it a try. If that doesn't work you can try using TCPDF with html write and image with border 0 attribute.
Related
We have a shop page on this website.
I will explain my problem using the very first image in the top left as example, although it applies to all of them.
If you hover over the first image (Gentes Deluxified English) you see an incomplete picture like this:
src= ".../Gentes-board-DLX-20180123-200x267.jpg"
This image actually cuts of parts of the images to the left and right. The full image is like this:
src= " .../Gentes-board-DLX-20180123.jpg"
So we want to change the thumbnail image to the full image, or keep the original ratio of the image. This needs to work for all images and the ones added in the future.
Is this fixable with css?
I already spent a lot of time looking at the source code of woocommerce to find the file that creates the page that uses the thumbnail images. I can't find that file. Where should I look for the source code files? And what should I change in these source files?
I looked at the source code of Woo commerce and found the parameter for cropping thumbnails for you.
https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-regenerate-images.php
Add this
$crop = false;
after line 318:
private static function get_image( $fullsizepath, $thumbnail_width, $thumbnail_height, $crop ) {
Helo,
I'm trying to create discord bot with some cool options and one of them is a color command where I want to display a thumbnail with background-color from argument.
I've tried to set this as thumbnail
data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle r='50' cx='50' cy='50' fill='%23" + hex + "'/%3E%3C/svg%3E
where hex is given from command argument.
The problem was that Discord.js uses URL for a thumbnail so I thought I can create some kind of api to display svg element colored with color from the link, but I can't find useful informations how to do that.
For example: mywebsite.com/color/ffffff will display white svg logo as image.
Php produces pdf without issue when does not span, nested tables are not in use, and
HTML2PDF::$_subobj->pdf->getPage();
doesn't seem to address the bug/issue. Anyone run into this ERROR n°7?
Add the following in your function to solve the error
html2pdf->setTestTdInOnePage(false);
If you have a long picture (in table td) , example 1200px you can get this error.
I fixed my picture to 600px and problem solved.
Example: My photo is 3000x2000 (width:height)
I resized photo to 600x400.
I'm using php to display image(s) and accompanying text (This is done using a WHILE loop) See below:
While (true) {
echo "
<h2>$post_title</h2>
<img src ='new_images/$post_image' width='200' height='200'/> // Image
<div>$post_content</div> "; // Text
}
I have used CSS to float the image left. Therefore,the accompanying text appears to the right of the image.
However, the second image and accompanying text is NOT sitting below the first. It's trying to force itself into any space to the right of the first image
Can I use CSS to ensure the images are stacked??
I hope that above makes sense?
add clear:both to your images and it should work just fine
I'm trying to use DomPDF to generate a PDF out of some HTML. I need the page to be 20mm x 20mm, so I use the following:
CPDF_Adapter::$PAPER_SIZES['my_square_page'] = array(0, 0, 566.929134, 566.929134);
$dompdf->set_paper('my_square_page','portrait');
It works properly, if I check the PDF properties the size is ok. The HTML that will appear in the PDF has a container div of 490x490px. This size cannot be changed, as the elements inside that div are absolutely positioned.
The problem, then, is that in the generated PDF the div does not cover the entire page. I've tried setting the DPI, using different values in
def("DOMPDF_DPI", 150);
But it does not seem to make any difference at all. The output I get is this (gray borders are from the PDF reader):
I've tried setting the width and height of body and html in the CSS of the content, but it does not work.
You can check the source code of my sample case here.
Ok, I figured it out. Looks like the line
def("DOMPDF_DPI", 150);
does not actually do anything. I did change the dompdf_config.custom.inc file and then it worked. Added this:
define("DOMPDF_DPI", 62.230);
But now the images look too big :S