forked from Vitaliy-1/JATSParser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
27 lines (22 loc) · 840 Bytes
/
example.php
File metadata and controls
27 lines (22 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
require_once __DIR__ . '/vendor/autoload.php';
use JATSParser\Body\Document as JATSDocument;
use JATSParser\HTML\Document as HTMLDocument;
use JATSParser\PDF\TCPDFDocument;
/*
* @var $jatsDocument JATSDocument object representation of JATS XML document
*/
$jatsDocument = new JATSDocument("example.xml");
/*
* @var $htmlDocument HTMLDocument conversion to HTML
*/
$htmlDocument = new HTMLDocument($jatsDocument);
/*
* @var $pdfDocument TCPDFDocument class that extends TCDPF
*/
$pdfDocument = new TCPDFDocument();
$htmlString = $htmlDocument->getHtmlForTCPDF();
$pdfHeaderLogo = __DIR__ . "/logo/logo.jpg";
$pdfDocument->SetHeaderData($pdfHeaderLogo, PDF_HEADER_LOGO_WIDTH, "Some Text Here", "Another text here");
$pdfDocument->writeHTML($htmlString, true, false, true, false, '');
$pdfDocument->Output('article.pdf', 'I');