Php Laravel视图不适用于dompdf生成的pdf
我在laravel version 8+中使用dompdf,通过首先加载视图,然后提取其内容并将其保存为pdf文件,我成功地生成了一个pdf。在我的视图中只有一个由dompdf加载的表,它不适合页面Php Laravel视图不适用于dompdf生成的pdf,php,laravel,pdf,dompdf,Php,Laravel,Pdf,Dompdf,我在laravel version 8+中使用dompdf,通过首先加载视图,然后提取其内容并将其保存为pdf文件,我成功地生成了一个pdf。在我的视图中只有一个由dompdf加载的表,它不适合页面 有人知道如何解决这个问题吗?看起来您需要在dompdf config文件中更新dpi 默认的dpi是96。最好将其更改为“dpi”=>196 从dom pdf配置文件 /** * Image DPI setting * * This sett
有人知道如何解决这个问题吗?看起来您需要在
dompdf config
文件中更新dpi
默认的dpi
是96
。最好将其更改为“dpi”=>196
从dom pdf配置文件
/**
* 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
*/
"dpi" => 96,
/**
*图像DPI设置
*
*此设置确定图像和字体的默认DPI设置。这个
*可通过明确设置
*图像的宽度和高度样式属性(即,如果图像是本机的
*宽度为600像素,指定图像的宽度为72点,
*在渲染的PDF中,图像的DPI为600
*背景图像不能被覆盖,并且是完全受控的
*通过这个参数。
*
*对于DOMPDF,每英寸像素数(PPI)=每英寸点数(DPI)。
*如果html中的大小以px表示(或不以图像大小表示单位),
*这以pt表示相应的大小。
*这将调整相对大小,使其与图形的渲染类似
*参考浏览器中的html页面。
*
*在pdf中,始终为1磅=1/72英寸
*
*各种浏览器的渲染分辨率(每英寸像素):
*Windows Firefox和Internet Explorer:
*系统控制->显示属性->字体分辨率:默认值:96,大字体:120,自定义:?
*Linux Firefox:
*关于:配置*分辨率:默认值:96
*(忽略mm中的xorg屏幕尺寸和桌面字体dpi设置)
*
*注意浏览器的额外字体/图像缩放因子。
*
*在图像中,“像素大小”属性(img css样式)被覆盖
*用于渲染的真实图像尺寸(以px为单位)。
*
*@var int
*/
“dpi”=>96,
Ref:尝试在dompdf配置中更改“dpi”=>196,非常感谢您的帮助!