我使用此代码添加textbox
在canvas
使用fabric js
,
var text = 'Type Text Here';
var textSample = new fabric.Textbox(text, {
left: getCardLeft() + 100,
top: getCardTop() + 10,
width: 200,
height: 20,
fontFamily: 'Helvetica',
fill: getColorPickerForegroundColor(),
fontWeight: '',
fontSize: parseInt('25'),
originX: 'center',
hasRotatingPoint: true,
centerTransform: true,
});
canvas.add(textSample);
Run Code Online (Sandbox Code Playgroud)
其成功添加textbox
到canvas
.现在,如果我尝试bold
使用此命令
canvas.getActiveObject().set("fontWeight", "bold");
canvas.renderAll();
Run Code Online (Sandbox Code Playgroud)
工作,但当试图将其改为正常时,
canvas.getActiveObject().set("fontWeight", "");
canvas.getActiveObject().set("fontWeight", "100");
canvas.getActiveObject().set("fontWeight", "normal");
canvas.renderAll();
Run Code Online (Sandbox Code Playgroud)
不工作
我不知道问题出在哪里.我在这里做错了吗?
它表现得很奇怪你可以在这里看到它.
我正在使用javascript打印特定内容.让我告诉你我是如何打印它的.
var data='many div and contents';
var html="<html>";
html+="<head>";
html+="<style> body{ font-family:'arial' } .tempcss{ margin:0 0 0 10px !important; } .print_border{ border:1px solid #000; padding:0 20px; } </style>";
html+="</head>";
html+="<body>";
html+= data;
html+="</body>";
html+="</html>";
var printWin = window.open('','','left=0,top=0,fullscreen,toolbar=0,scrollbars=1,status=0');
printWin.document.write(html);
printWin.document.close();
printWin.focus();
printWin.print();
printWin.close();
Run Code Online (Sandbox Code Playgroud)
因此它将打开带有打印选项内容的新窗口.它将在新窗口中显示正常,但不会在打印时正确分割内容.我想要做的是,我想在特定div之后在打印布局中添加分页符.
像这样,
<div class="test"></div>
<-- page break here -->
<div class="test"></div>
<-- page break here -->
<div class="test"></div>
<-- page break here -->
Run Code Online (Sandbox Code Playgroud)
所以这种方式当我打印页面时,所有div将在每个页面中单独显示.我不知道怎么做.所以请帮助我.提前致谢
我TCPDF
使用这行代码添加了许多字体
TCPDF_FONTS::addTTFfont('fonts/ArchitectsDaughter.ttf', 'TrueTypeUnicode', '', 96);
$pdf->AddFont("ArchitectsDaughter");
Run Code Online (Sandbox Code Playgroud)
许多其他字体正在工作但是,这个不起作用.当我打开这个pdf到阅读器时,它显示这样的错误
无法提取嵌入字体'ArchitectsDaughter'.某些字符可能无法正确显示或打印.
我正在svg
以pdf格式导入文件.这是我用pdf插入的SVG文件,你可以从这里获得PDF ,这里是字体文件.
以下是pdf将如何生成的完整代码.
$fileName='export';
$uploadPath = Config::get('constants.paths.uploads.images.base').'/'.$fileName.'.svg';
$pdf = new TCPDF();
TCPDF_FONTS::addTTFfont(dirname(dirname(dirname(dirname(__FILE__)))).'/vendor/font-awesome/fonts/ArchitectsDaughter.ttf', 'TrueTypeUnicode', '', 96);
TCPDF_FONTS::addTTFfont(dirname(dirname(dirname(dirname(__FILE__)))).'/vendor/font-awesome/fonts/Archivor.ttf', 'TrueTypeUnicode', '', 96);
$pdf->AddFont("Archivor");
$pdf->AddFont("ArchitectsDaughter");
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
$pdf->AddPage();
$pdf->ImageSVG($uploadPath, $x='', $y='', $w='', $h='', $link='', $align='', $palign='', $border=0, $fitonpage=true);
$filename = 'export.pdf';
$pdf->output($filename, 'D');
exit;
Run Code Online (Sandbox Code Playgroud)
其他字体对我来说还可以.不知道一些字体发生了什么.这是什么解决方案?
我有代码,可用于jpg,png图像调整图像大小,这里是代码示例.
$image = Image::make("{$filePath}/{$fileName[0]}");
// Get the maximum uploaded image width
$maxWidth = Config::get('constants.max_uploaded_image_width');
// Resize the image
$image->resize($maxWidth, null, function($constraint)
{
// Set an aspect ratio constraint
$constraint->aspectRatio();
// Prevent upsizing
$constraint->upsize();
});
// Save the image
$image->save("{$filePath}/{$fileName[0]}");
Run Code Online (Sandbox Code Playgroud)
这个jpg
和png
图像一起工作很好,但是当我使用svg
它时会返回错误Unable to read image from file
.有解决方案吗
我想设置所有记录,但首先order by FIELD_NAME
只保留 1 条特定需要的记录。id
我怎样才能实现这个使用laravel query builder
我当前的查询是这样的,
$orders =Order::orderBy('status', 'desc')
->where('status','<>',5)
->paginate(10);
Run Code Online (Sandbox Code Playgroud)
我希望 id=123 首先留下来。
我正在使用laravel
并用于in
图像处理。我想增加图像的 DPI。我在这里没有看到任何有关 DPI 的文档 。是否有任何解决方案或任何其他方法与orphp
相关?php
laravel
我使用join
查询MySQL
来从多个表中获取记录.我想要做的是根据表名区分记录.
例如,
1)Table1
name
test1
test2
2)Table2
name
test3
test4
Run Code Online (Sandbox Code Playgroud)
之后join
它会给我这样的所有记录,
name
test1
test2
test3
test4
Run Code Online (Sandbox Code Playgroud)
我只想要这样的输出
name from_table
test1 table1
test2 table1
test3 table2
test4 table2
Run Code Online (Sandbox Code Playgroud)
做这个的最好方式是什么?提前致谢.
我想检查用户插入的 URL 是否有效。我有不同的情况允许用户插入 URL
1) www.test.com (valid)
2) http://test.com (valid)
3) http://www.test.com (valid)
4) www.test (not valid)
Run Code Online (Sandbox Code Playgroud)
所以这种方式用户将能够插入www
或http
,如果用户只插入,www
则http://
在 URL 之前预先附加。我发现了很多正则表达式,但他们严格检查http://
.
提前致谢。