Implemented

export pdf without margin

When I export a product.

This is exporting in good size but my photo is more little and appear a large margin.

An other problem, is that when I export this product, I've got in my pdf 2 pages one blank page an the other with my fotos. But there only one layer.


If you can help me it's very important and urgent.

Thank's.


Best regards.


Jennifer.

pdf
(3.15 MB)

1 person likes this idea
  • Hi Jennifer, 


    I had the same problem but was able to solve it by editing a couple lines of code in the plugin. 


    in file /wp-content/plugins/fancy-product-designer/admin/class-admin-ajax.php around line 1050 there will be the text

    // set document information
    $pdf->SetCreator( get_site_url() );
    $pdf->SetTitle($order_id);
    
    // remove default header/footer
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    			

     

    you need to change it to

     

    // set document information
    $pdf->SetCreator( get_site_url() );
    $pdf->SetTitle($order_id);
    
    // remove default header/footer
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    
    $pdf->SetMargins(0, 0, 0, true);
    $pdf->SetHeaderMargin(0);
    $pdf->SetFooterMargin(0);
    $pdf->setImageScale(1); //display image at original dimensions
    $pdf->setJPEGQuality(100);
    
    $pdf->SetAutoPageBreak(false, 0);//we don't want any automatic new pages on oversets

     I also found that now the images didn't quite go the full width of the pdf. so you also have to change 

    $pdf->Image('@'.$data_str,'', '', 0, 0, '', '', '', false, $dpi);

     to 

     

    $pdf->Image('@'.$data_str, $x = '', $y = '',$w = $width, $h =0, $type ='', $link='', $align ='', $resize = false, $dpi);

     I ended up writing a class override to accomplish all of this. But it is tied in with a lot of other customisations i have on my website so i can't share it sorry. Just remember if you make the above changes if you update your plugin these will probably be overwritten


    good luck

    Roddy

Login or Signup to post a comment