小编hem*_*iya的帖子

fabric js fontweight不工作

我使用此代码添加textboxcanvas使用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)

其成功添加textboxcanvas.现在,如果我尝试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 fabricjs

17
推荐指数
1
解决办法
1524
查看次数

在打印窗口中的特定div之后将内容分解为新页面

我正在使用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将在每个页面中单独显示.我不知道怎么做.所以请帮助我.提前致谢

html javascript css

6
推荐指数
1
解决办法
2791
查看次数

TCPDF字体没有嵌入,在adobe reader上显示"..."

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)

其他字体对我来说还可以.不知道一些字体发生了什么.这是什么解决方案?

php fonts tcpdf

5
推荐指数
1
解决办法
1241
查看次数

在laravel 4中上传svg图像时出现"无法读取图像"错误

我有代码,可用于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)

这个jpgpng图像一起工作很好,但是当我使用svg它时会返回错误Unable to read image from file.有解决方案吗

php svg gd laravel laravel-4

3
推荐指数
1
解决办法
1401
查看次数

将特定记录设置为行第一行 Laravel 查询构建器

我想设置所有记录,但首先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 首先留下来。

php laravel laravel-4

2
推荐指数
1
解决办法
1304
查看次数

使用干预将图像的 DPI 从 72 更改为 300

我正在使用laravel并用于in图像处理。我想增加图像的 DPI。我在这里没有看到任何有关 DPI 的文档 。是否有任何解决方案或任何其他方法与orphp相关?phplaravel

php laravel

2
推荐指数
1
解决办法
3942
查看次数

根据连接查询中的表名来区分记录

我使用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)

做这个的最好方式是什么?提前致谢.

php mysql join

1
推荐指数
1
解决办法
32
查看次数

正则表达式检查有效的网址 http 或 www

我想检查用户插入的 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)

所以这种方式用户将能够插入wwwhttp,如果用户只插入,wwwhttp://在 URL 之前预先附加。我发现了很多正则表达式,但他们严格检查http://.

提前致谢。

php regex url-validation

0
推荐指数
1
解决办法
1350
查看次数

标签 统计

php ×6

laravel ×3

javascript ×2

laravel-4 ×2

css ×1

fabricjs ×1

fonts ×1

gd ×1

html ×1

join ×1

mysql ×1

regex ×1

svg ×1

tcpdf ×1

url-validation ×1