ePages 6.17.40 - DE_EPAGES/EPagesJ/API/PDF/PdfClient.pm

Package DE_EPAGES::EPagesJ::API::PDF::PdfClient

Client for PDF operations.

Base
DE_EPAGES::EPagesJ::API::Object::RestClient

Functions

create
merge
new
transform

create

Factory method for a PDFClient object. Initializes based on the current configuration. Uses a different HTTP timeout, that can be configured in epages.conf [DE_EPAGES::EPagesJ] HTTPTimeOutPdf = 180 ; 180 sec is the default timeout for PDF requests.

Syntax
DE_EPAGES::EPagesJ::API::PDF->create($Shop, $hArgs);
Input
$Object (object)
This context object will be used for initializing BaseURL
and Resource parameters for the rest client.
$hArgs (ref.hash)
Additional arguments for constructor
Return
$PdfClient (DE_EPAGES::EPagesJ::API::PDF::PdfClient)
PdfClient object

merge

Merges multiple PDF files into one.

Syntax
$PdfClient->merge( $hParams );
Example
my $Client = DE_EPAGES::EPagesJ::API::PDF::PdfClient->create($Shop);
my $Pdf = $Client->merge( { 'files' => [
  { 'path' => 'WebRoot/File1.pdf' },
  { 'path' => 'WebRoot/File2.pdf' } ] } );
WriteFile('merged.pdf', \$Pdf, { binary => 1});
Input
$hParams - (ref.hash)
input params. Valid keys are:
  • files - files list. Valid keys for elements:
    • path - path relative to Shared folder - string
    - ref.array.hash
Return
$Content (bytes)
binary content

new

Instanciates a new PdfClient.

Syntax
DE_EPAGES::EPagesJ::API::PDF::PdfClient->new( %args );
Input
%args (hash)
Input arguments. Possible keys.
  • TransformUrl - url for HTML to PDF transformation - URI::URL
  • MergeUrl - url for merging PDF files - URI::URL
  • LogCategory - category for commlogger. Defaults to "PDF" - string
  • DefaultHeaders - default HTTP headers - string
  • Log - comm logger. Defaults to DE_EPAGES::EPagesJ::API::Object::SummaryLogger - object

transform

Transforms HTML content into a pdf document. It will try its best to create valid XHTML from the user input, as invalid XHTML input gets rejected by the PDF generator.

Syntax
$PdfClient->transform( $HtmlContent );
Input
$HtmlContent (string)
HTML
Return
$Content (bytes)
binary content