Skip to content

Commit

Permalink
Version 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SelectPdf committed Nov 15, 2021
1 parent ee1af93 commit e1c7889
Show file tree
Hide file tree
Showing 19 changed files with 4,825 additions and 2 deletions.
14 changes: 14 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Revision history for SelectPdf Online API client for Perl.

1.4.0

- Added Pdf Merge client.
- Added Pdf to Text client.

1.3.0
- Modified package structure. Added more documentation.

1.2.2
- Initial version for HtmlToPdfClient.


18 changes: 18 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Changes
Makefile.PL
MANIFEST
README
t/SelectPdf.t
samples/html-to-pdf-main.pl
samples/html-to-pdf-headers-and-footers.pl
samples/pdf-merge.pl
samples/pdf-to-text.pl
samples/search-pdf.pl
lib/SelectPdf.pm
lib/SelectPdf/ApiClient.pm
lib/SelectPdf/AsyncJobClient.pm
lib/SelectPdf/HtmlToPdfClient.pm
lib/SelectPdf/UsageClient.pm
lib/SelectPdf/WebElementsClient.pm
lib/SelectPdf/PdfMergeClient.pm
lib/SelectPdf/PdfToTextClient.pm
51 changes: 51 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
use 5.020001;
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'SelectPdf',
VERSION_FROM => 'lib/SelectPdf.pm',
PREREQ_PM => {
'LWP::UserAgent' => 0,
'HTTP::Request::Common' => 0,
'HTTP::Status' => 0,
'JSON' => 0
},
ABSTRACT => 'SelectPdf Online REST API Perl Client (HTML to PDF, PDF merge, PDF to text, search PDF)',
AUTHOR => 'SelectPdf <support@selectpdf.com>',
LICENSE => 'perl',
META_ADD => {
provides => {
'SelectPdf' => {
file => 'lib/SelectPdf.pm',
version => '1.4.0',
},
'SelectPdf::ApiClient' => {
file => 'lib/SelectPdf/ApiClient.pm',
version => '1.4.0',
},
'SelectPdf::AsyncJobClient' => {
file => 'lib/SelectPdf/AsyncJobClient.pm',
version => '1.4.0',
},
'SelectPdf::HtmlToPdfClient' => {
file => 'lib/SelectPdf/HtmlToPdfClient.pm',
version => '1.4.0',
},
'SelectPdf::UsageClient' => {
file => 'lib/SelectPdf/UsageClient.pm',
version => '1.4.0',
},
'SelectPdf::WebElementsClient' => {
file => 'lib/SelectPdf/WebElementsClient.pm',
version => '1.4.0',
},
'SelectPdf::PdfMergeClient' => {
file => 'lib/SelectPdf/PdfMergeClient.pm',
version => '1.4.0',
},
'SelectPdf::PdfToTextClient' => {
file => 'lib/SelectPdf/PdfToTextClient.pm',
version => '1.4.0',
},
},
}
);
33 changes: 33 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
SelectPdf version 1.4.0
=======================

This is a Perl version for SelectPdf Online REST API client library.
It contains: HTML to PDF client, PDF Merge client, PDF to Text client.

INSTALLATION

To install this module type the following (use make, dmake or nmake depending on your system):

perl Makefile.PL
make
make test
make install

DEPENDENCIES

This module requires these other modules and libraries:

LWP::UserAgent
HTTP::Request::Common
HTTP::Status
JSON

COPYRIGHT AND LICENCE

Copyright (C) 2021 by SelectPdf

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.20.1 or,
at your option, any later version of Perl 5 you may have available.


142 changes: 140 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,140 @@
# selectpdf-api-perl-client
Perl client for SelectPdf Online REST API
# SelectPdf Online REST API - Perl Client

## HTML To PDF API - Perl Client

SelectPdf HTML To PDF Online REST API is a professional solution that lets you create PDF from web pages and raw HTML code in your applications. The API is easy to use and the integration takes only a few lines of code.

## Features

* Create PDF from any web page or html string.
* Full html5/css3/javascript support.
* Set PDF options such as page size and orientation, margins, security, web page settings.
* Set PDF viewer options and PDF document information.
* Create custom headers and footers for the pdf document.
* Hide web page elements during the conversion.
* Automatically generate bookmarks during the html to pdf conversion.
* Support for partial page conversion.
* Easy integration, no third party libraries needed.
* Works in all programming languages.
* No installation required.

Sign up for for free to get instant API access to SelectPdf [HTML to PDF API](https://selectpdf.com/html-to-pdf-api/).

## Pdf Merge API

SelectPdf offers a REST API that can be used to merge PDF documents from local disk or remote url.

## Pdf To Text API

SelectPdf offers a REST API that can be used to extract text from local or remote PDF documents and search in existing PDF documents.


## Installation

Download [selectpdf-api-perl-client-1.4.0.zip](https://github.com/selectpdf/selectpdf-api-perl-client/releases/download/1.4.0/selectpdf-api-python-client-1.4.0.zip), unzip it and run:

```
cd selectpdf-api-perl-client-1.4.0
perl Makefile.PL
make
make test
make install
```

OR

Install SelectPdf Perl Client for Online API via CPAN: [SelectPdf on CPAN](https://metacpan.org/dist/SelectPdf).

```
cpanm SelectPdf
```

OR

Clone [selectpdf-api-perl-client](https://github.com/selectpdf/selectpdf-api-perl-client) from Github and install the library.

```
git clone https://github.com/selectpdf/selectpdf-api-perl-client
cd selectpdf-api-perl-client
perl Makefile.PL
make
make test
make install
```

## Sample Code

```
local $| = 1;
use strict;
use JSON;
use SelectPdf;
print "This is SelectPdf-$SelectPdf::VERSION.\n";
my $url = "https://selectpdf.com/";
my $local_file = "Test.pdf";
my $apiKey = "Your API key here";
eval {
my $client = new SelectPdf::HtmlToPdfClient($apiKey);
# set parameters - see full list at https://selectpdf.com/html-to-pdf-api/
$client
# main properties
->setPageSize("A4") # PDF page size
->setPageOrientation("Portrait") # PDF page orientation
->setMargins(0) # PDF page margins
->setRenderingEngine('WebKit') # rendering engine
->setConversionDelay(1) # conversion delay
->setNavigationTimeout(30) # navigation timeout
->setShowPageNumbers('False') # page numbers
->setPageBreaksEnhancedAlgorithm('True') # enhanced page break algorithm
# additional properties
#->setUseCssPrint('True') # enable CSS media print
#->setDisableJavascript('True') # disable javascript
#->setDisableInternalLinks('True') # disable internal links
#->setDisableExternalLinks('True') # disable external links
#->setKeepImagesTogether('True') # keep images together
#->setScaleImages('True') # scale images to create smaller pdfs
#->setSinglePagePdf('True') # generate a single page PDF
#->setUserPassword('password') # secure the PDF with a password
# generate automatic bookmarks
#->setPdfBookmarksSelectors("H1, H2") # create outlines (bookmarks) for the specified elements
#->setViewerPageMode(1) # 1 (Use Outlines) - display outlines (bookmarks) in viewer
;
print "Starting conversion ...\n";
# convert url to file
$client->convertUrlToFile($url, $local_file);
# convert url to memory
# my $pdf = $client->convertUrl($url);
# convert html string to file
# $client->convertHtmlStringToFile("This is some <b>html</b>.", $local_file);
# convert html string to memory
# my $pdf = $client->convertHtmlString("This is some <b>html</b>.");
print "Finished! Number of pages: " . $client->getNumberOfPages() . ".\n";
# get API usage
my $usageClient = new SelectPdf::UsageClient($apiKey);
my $usage = $usageClient->getUsage();
print("Usage: " . encode_json($usage) . "\n");
print("Conversions remained this month: ". $usage->{"available"});
};
if ($@) {
print "An error occurred: $@\n";
}
```
Loading

0 comments on commit e1c7889

Please sign in to comment.