小编use*_*395的帖子

pdfmake - 在 vfs 上找不到字体文件

我有以下代码用于测试驱动器PDFmake。我对字体文件的位置有问题。我看到的文档似乎表明在拉入vfs_fonts文件后我应该能够看到它们。然而,这对我来说并非如此。

function createPdf(assessmentId: string): string {
  const pdfMake = require('pdfmake/build/pdfmake.js');
  const pdfFonts = require('pdfmake/build/vfs_fonts.js');
  pdfMake.vfs = pdfFonts.pdfMake.vfs;

  //required font setup, requires that you link to the fonts shipped with npm

  const fontDescriptors = {
    Roboto: {
      normal: 'Roboto-Regular.ttf',
      bold: 'Roboto-Medium.ttf',
      italics: 'Roboto-Italic.ttf',
      bolditalics: 'Roboto-Italic.ttf',
    }
  };
  const termpaper = new PdfLayout();
  const docDefinition = termpaper.layout
  const printer = new Printer(fontDescriptors);

  //get a reference to the PdfKit instance, which is a streaming interface

  const pdfDoc = printer.createPdfKitDocument(docDefinition); …
Run Code Online (Sandbox Code Playgroud)

javascript fonts pdfmake

8
推荐指数
3
解决办法
9333
查看次数

升级到angular 7后如何修复styles.scss?

我的 angular 6.1 应用程序正在构建和运行良好。

我升级到 angular 7。

现在在构建中,我收到了多个这样的错误。

ERROR in ./src/styles.scss (./node_modules/@angular-devkit/build- 
angular/src/angular-cli-files/plugins/raw-css- 
loader.js!./node_modules/postcss-loader/lib??embedded!./node_modules/sass- 
loader/lib/loader.js??ref--14-3!./src/styles.scss)
Module Error (from ./node_modules/postcss-loader/lib/index.js):
(Emitted value instead of an instance of Error) CssSyntaxError: 
C:\Users\Markku\Documents\GitHub\crds-people\node_modules\crds- 
styles\assets\stylesheets\vendors\_timepicker.scss:18:24: Can't resolve 
'//crossroads-media.s3.amazonaws.com/images/chevron-up-blue.png' in 
'C:\Users\Markku\Documents\GitHub\crds-people\src'

16 |     }
17 |     &.glyphicon-chevron-up {
> 18 |       background-image: url(//linktomys3.amazonaws.com/images/chevron-up-blue.png);
     |                        ^
  19 |     }
  20 |   }
Run Code Online (Sandbox Code Playgroud)

哪些更改会影响我的图形路径?

angular angular7

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

Angular 单元测试 - 如何模拟 router.url

我有一个 Angular 6 应用程序,我正在尝试对注入路由器的组件进行单元测试。在我的 ngOnInit 方法中,我引用了 this.router.url 并使用它。

所以现在我正在尝试编写一个 jasmine 单元测试,但我无法设置 router.url 属性,因为它“是一个常量或只读属性”。我目前正在这样嘲笑路由器。

mockRouter = jasmine.createSpyObj<Router>("router", ["navigate", "navigateByUrl"]);
Run Code Online (Sandbox Code Playgroud)

我还需要设置什么才能在测试中正确模拟 url 值?

unit-testing jasmine angular6

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