Skip to content

Commit

Permalink
fix: usage example
Browse files Browse the repository at this point in the history
NULL is not valid value in sciter, using empty string for getFont
4silvertooth committed Feb 16, 2021
1 parent aac6484 commit ef3d3c8
Showing 2 changed files with 52 additions and 4 deletions.
50 changes: 48 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ where `[OPTION]` is your prefered platform in premake5, and `"PATH/TO/SCITER-SDK

Open the generated project from `/build` and compile.

**Usage**
**Usage** Sciter

```html
<html>
@@ -40,7 +40,7 @@ event click $(button) {
page.setSize(page.SIZE_A4, page.PORTRAIT);
const h = page.getHeight();
const font = Doc.getFont("Helvetica", NULL);
const font = Doc.getFont("Helvetica", "");
page.setFontAndSize(font, 12);
page.beginText();
@@ -67,4 +67,50 @@ event click $(button) {
<button>CLICK TO GENERATE PDF</button>
</body>
</html>
```

**Usage** Sciter.JS

```html
<html>
<head>

<script type="text/tiscript">
include library "sciter-pdf";
event click $(button) {
Doc.newDoc();
const page = Doc.addPage();
page.setSize(page.SIZE_A4, page.PORTRAIT);
const h = page.getHeight();
const font = Doc.getFont("Helvetica", "");
page.setFontAndSize(font, 12);
page.beginText();
page.textRect(
{
left: 20,
top: h-20,
right: 100,
bottom: 50
},
"HELLO PDF",
page.TALIGN_LEFT
);
page.endText();
Doc.save(URL.toPath(self.url('test.pdf')));
Sciter.launch(self.url('test.pdf'));
}
</script>
</head>
<body>
<button>CLICK TO GENERATE PDF</button>
</body>
</html>
```
```
6 changes: 4 additions & 2 deletions premake5.lua
Original file line number Diff line number Diff line change
@@ -34,10 +34,12 @@ workspace "sciter-pdf"
location "build"
configurations { "DebugStatic", "DebugDLL", "ReleaseStatic", "ReleaseDLL" }
platforms { "Win32", "Win64" }

cppdialect "C++14"

startproject "sciter-pdf"
staticruntime "On"

staticruntime "Off"
startproject "sciter-pdf"

filter "configurations:Debug"
defines { "DEBUG" }

0 comments on commit ef3d3c8

Please sign in to comment.