1

I'm using PrinceXML and Django Templates to generate a PDF. I'm able to set the content of a url but unable to set a string for the bottom left

@media print{
  @page { 
    @bottom-right {
      /* works */
      content: url({{ user.logo }})
    }
    @bottom-left {
      /* doesn't work */
      content: {{ user.uuid }};
    }
  }
}

Do you have to set the content differently for a string?

4

1 回答 1

1

将模板变量放在双引号之间,如下所示:

content: "{{ user.uuid }}";

Django 只会用它的值替换模板变量。因此,例如,如果您有:

user.uuid = "My unique id"

然后

内容:{{ user.uuid }};

会变成

内容:我的唯一ID;

PrinceXML 不会将其解释为字符串

于 2014-10-01T13:13:48.793 回答