You've already forked libart-paperback
Hello libart-paperback
This commit is contained in:
2683
docs/doxygen-awesome.css
Normal file
2683
docs/doxygen-awesome.css
Normal file
File diff suppressed because it is too large
Load Diff
116
docs/getting-started.md
Normal file
116
docs/getting-started.md
Normal file
@@ -0,0 +1,116 @@
|
||||
\page getting-started Getting Started
|
||||
|
||||
# Getting Started
|
||||
|
||||
Paperback uses the build2 build system, see https://build2.org/.
|
||||
|
||||
The first step is to include Paperback in your build2 project.
|
||||
|
||||
Add the following lines to your repositories.manifest file:
|
||||
|
||||
```
|
||||
:
|
||||
role: prerequisite
|
||||
location: https://code.helloryan.se/art/libart-paperback.git##HEAD
|
||||
```
|
||||
|
||||
And the following to your manifest file:
|
||||
|
||||
```
|
||||
depends: libart-paperback ^0.1.0-
|
||||
```
|
||||
|
||||
Finally, link your executable or library with Paperback:
|
||||
|
||||
```
|
||||
import libs =+ libart-paperback%lib{art-paperback}
|
||||
```
|
||||
|
||||
## Usage Example
|
||||
|
||||
The example below shows how to use Paperback to create a new PDF
|
||||
document and render some text on a page. More examples are available
|
||||
in `$src_root$/examples`.
|
||||
|
||||
```c++
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <art/paperback/document.hxx>
|
||||
#include <art/paperback/page.hxx>
|
||||
|
||||
#include <art/paperback/graphics/canvas.hxx>
|
||||
#include <art/paperback/graphics/standard-font.hxx>
|
||||
|
||||
using namespace std;
|
||||
using namespace Art::Paperback;
|
||||
using namespace Art::Paperback::Graphics;
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 2) {
|
||||
cerr << "usage: " << argv[0] << " <path>\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
// Open the output file.
|
||||
//
|
||||
fstream fs{argv[1], std::ios_base::out | std::ios_base::binary};
|
||||
|
||||
// Create a new document.
|
||||
//
|
||||
Document document{Document::create_new, fs, 1, 4};
|
||||
Standard_font helvetica{document, "Helvetica"};
|
||||
|
||||
// Create a new A4 page.
|
||||
//
|
||||
double width = 595;
|
||||
double height = 842;
|
||||
|
||||
auto& page = document.create_page(Page::Properties{
|
||||
Rectangle{0, 0, width, height}
|
||||
});
|
||||
|
||||
// Create a page canvas and render some text.
|
||||
//
|
||||
{
|
||||
Canvas canvas{Canvas::clear, page};
|
||||
Canvas::Set_font use_font{canvas, helvetica, 14};
|
||||
|
||||
// Measure the width of the text, so we can center it.
|
||||
//
|
||||
auto tw = helvetica.get_text_width("Hello, world!");
|
||||
|
||||
auto text_width = (tw.width * 14) / 1000;
|
||||
auto capheight = (helvetica.get_capheight() * 14) / 1000;
|
||||
|
||||
double cx = (width / 2) - (text_width / 2);
|
||||
double cy = (height / 2) - (capheight / 2);
|
||||
|
||||
Canvas::Begin_text bt{canvas};
|
||||
|
||||
bt.move_text_pos(cx, cy);
|
||||
bt.show_text("Hello, world!");
|
||||
}
|
||||
|
||||
// Write the document explicitly to the underlying I/O stream.
|
||||
//
|
||||
// Otherwise, the Document destructor flushes it automatically,
|
||||
// ignoring any exceptions thrown.
|
||||
//
|
||||
document.flush();
|
||||
}
|
||||
catch (exception const& ex) {
|
||||
cerr << argv[0] << ": an error occurred: " << ex.what() << "\n";
|
||||
return 1;
|
||||
}
|
||||
catch (...) {
|
||||
cerr << argv[0] << ": an unknown error occurred\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
BIN
docs/icon.png
Normal file
BIN
docs/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
48
docs/logo.svg
Normal file
48
docs/logo.svg
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 400.32031 74.570312"
|
||||
width="400.32031"
|
||||
height="74.570312"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
sodipodi:docname="logo.svg"
|
||||
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="namedview2"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="2.55625"
|
||||
inkscape:cx="200.0978"
|
||||
inkscape:cy="37.359413"
|
||||
inkscape:window-width="2192"
|
||||
inkscape:window-height="1164"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2" />
|
||||
<!-- Main logo text -->
|
||||
<text
|
||||
x="197.44531"
|
||||
y="57.96875"
|
||||
font-family="Arial, sans-serif"
|
||||
font-size="80px"
|
||||
font-weight="700"
|
||||
text-anchor="middle"
|
||||
letter-spacing="-1px"
|
||||
id="text2"><tspan
|
||||
fill="#27ae60"
|
||||
id="tspan1">Paper</tspan><tspan
|
||||
fill="#2c3e50"
|
||||
id="tspan2">back</tspan></text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
10
docs/main.md
Normal file
10
docs/main.md
Normal file
@@ -0,0 +1,10 @@
|
||||
\mainpage Paperback
|
||||
|
||||
Paperback implements the PDF file format in C++, based on the PDF 1.4
|
||||
specification, available online at:
|
||||
https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.4.pdf.
|
||||
The ultimate goal is to provide a library capable of generating PDF
|
||||
files that conform to the PDF/A ISO 19005-1 standard.
|
||||
|
||||
See \ref getting-started for information on how to use Paperback in
|
||||
your application.
|
||||
55
docs/styles.css
Normal file
55
docs/styles.css
Normal file
@@ -0,0 +1,55 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');
|
||||
|
||||
html
|
||||
{
|
||||
--font-family-normal: "Open Sans", sans-serif;
|
||||
--font-family-monospace: "Google Sans Code", monospace;
|
||||
--font-family-nav: "Open Sans", sans-serif;
|
||||
--font-family-title: "Open Sans", sans-serif;
|
||||
--font-family-toc: "Open Sans", sans-serif;
|
||||
--font-family-search: "Open Sans", sans-serif;
|
||||
--font-family-icon: "Open Sans", sans-serif;
|
||||
--font-family-tooltip: "Open Sans", sans-serif;
|
||||
|
||||
--page-link-color: #0057ae;
|
||||
--page-visited-link-color: #0057ae;
|
||||
}
|
||||
|
||||
#projectlogo img
|
||||
{
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
margin-top: 2rem;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
h2
|
||||
{
|
||||
margin-top: 1.5rem;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
h2:first-child
|
||||
{
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
h3
|
||||
{
|
||||
margin-top: 1.5rem;
|
||||
font-size: 1rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h3:first-child
|
||||
{
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
code
|
||||
{
|
||||
background: rgb(242, 242, 242);
|
||||
}
|
||||
Reference in New Issue
Block a user