2016-04-10 21 views
1

DOMPDF çevresindeki barryvdh/laravel-dompdf laravel sarıcısını kullanıyorum.Varsayılan DPI'yi DOMPDF'nin Laravel'deki yapılandırma dosyasında nasıl denetlerim?

Yazdırılacak ve farklı antetli kağıtlarla gönderilecek harfler üretiyorum ve antetli kağıdı, üstteki metinle birlikte arka plan görüntüsü olarak kullanıyorum.

Her şeyin iyi çalıştığı noktaya geldim, ancak DOMPDF'deki varsayılan DPI 96'dır, bu nedenle antetli arkaplanın arka plan resmi yazdırıldığında oldukça düşüktür.

Tedarikçinin dizinindeki dompdf_config.inc dosyasında def("DOMPDF_DPI", 96); seçeneği olduğunu biliyorum. Paketin kendisinde dosyayı düzenlemeden bu ayarı nasıl geçersiz kılarım?

cevap

0

Çözüm bulundu.

php artisan satıcısını çalıştırma: yayımlama, bu seçeneği düzenleyebileceğim dizinimde bir yapılandırma dosyası verdi.

/** 
    * Image DPI setting 
    * 
    * This setting determines the default DPI setting for images and fonts. The 
    * DPI may be overridden for inline images by explictly setting the 
    * image's width & height style attributes (i.e. if the image's native 
    * width is 600 pixels and you specify the image's width as 72 points, 
    * the image will have a DPI of 600 in the rendered PDF. The DPI of 
    * background images can not be overridden and is controlled entirely 
    * via this parameter. 
    * 
    * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI). 
    * If a size in html is given as px (or without unit as image size), 
    * this tells the corresponding size in pt. 
    * This adjusts the relative sizes to be similar to the rendering of the 
    * html page in a reference browser. 
    * 
    * In pdf, always 1 pt = 1/72 inch 
    * 
    * Rendering resolution of various browsers in px per inch: 
    * Windows Firefox and Internet Explorer: 
    * SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:? 
    * Linux Firefox: 
    * about:config *resolution: Default:96 
    * (xorg screen dimension in mm and Desktop font dpi settings are ignored) 
    * 
    * Take care about extra font/image zoom factor of browser. 
    * 
    * In images, <img> size in pixel attribute, img css style, are overriding 
    * the real image dimension in px for rendering. 
    * 
    * @var int 
    */ 
    "DOMPDF_DPI" => 192, 
0

sizin satıcı klasöründe dosya alıyorsa şunları olarak dokunma asla Yani/satıcı neyse senin .gitignore dosyası olması gerekir.

Gerçekten orijinal DOMPDF kütüphanesini https://github.com/dompdf/dompdf kullanabilir ve

$options = (new Options)->setDpi($yourDpi); 
$dom = new DompdfWrapper($options); 
$dom->loadHtml($htmlString); 
$dom->render(); 
gibi bir şey yapmalıyım
İlgili konular