SelectPdf/PdfMergeClient.pm

filter: Statementstmt 10.6% 15 / 141 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 12.9% 4 / 31 Podpod 100% 27 / 27 totaltotal 18.6% 46 / 247 CC 16 SCAR 27.1
CC
16
Cov
8%
setViewerPageMode
56.0
setViewerPageLayout
30.0
saveAsync
20.0
CRAP 15.1
« SelectPdf/PdfToTextClient.pm ↑ Summary SelectPdf/HtmlToPdfClient.pm »
1 package SelectPdf::PdfMergeClient;
2
3 1 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use SelectPdf::ApiClient;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use SelectPdf::AsyncJobClient;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 our @ISA = qw(SelectPdf::ApiClient);
8
9 1 our $VERSION = '1.6.0';
10
11 =head1 NAME
12
13 SelectPdf::PdfMergeClient - Pdf Merge with SelectPdf Online API.
14
15 =head1 SYNOPSIS
16
17 Merge PDFs from local disk or public url and save result into a file on disk.
18
19 use SelectPdf;
20 print "This is SelectPdf-$SelectPdf::VERSION\n";
21
22 my $test_url = "https://selectpdf.com/demo/files/selectpdf.pdf";
23 my $test_pdf = "Input.pdf";
24 my $local_file = "Result.pdf";
25 my $apiKey = "Your API key here";
26
27 eval {
28 my $client = new SelectPdf::PdfMergeClient($apiKey);
29
30 # set parameters - see full list at https://selectpdf.com/pdf-merge-api/
31 $client
32 # specify the pdf files that will be merged (order will be preserved in the final pdf)
33
34 ->addFile($test_pdf) # add PDF from local file
35 ->addUrlFile($test_url) # add PDF From public url
36 #->addFileWithPassword($test_pdf, "pdf_password") # add PDF (that requires a password) from local file
37 #->addUrlFileWithPassword($test_url, "pdf_password") # add PDF (that requires a password) from public url
38 ;
39
40 print "Starting pdf merge ...\n";
41
42 # merge pdfs to local file
43 $client->saveToFile($local_file);
44
45 # merge pdfs to memory
46 # my $pdf = $client->save();
47
48 print "Finished! Number of pages: " . $client->getNumberOfPages() . ".\n";
49
50 # get API usage
51 my $usageClient = new SelectPdf::UsageClient($apiKey);
52 my $usage = $usageClient->getUsage(0);
53 print("Usage: " . encode_json($usage) . "\n");
54 print("Conversions remained this month: ". $usage->{"available"});
55 };
56
57 if ($@) {
58 print "An error occurred: $@\n";
59 }
60
61 For more details and full list of parameters see L<Pdf Merge API|https://selectpdf.com/pdf-merge-api/>.
62
63 =head1 METHODS
64
65 =head2 new( $apiKey )
66
67 Construct the Pdf Merge Client.
68
69 my $client = SelectPdf::PdfMergeClient->new($apiKey);
70
71 Parameters:
72
73 - $apiKey: API Key.
74 =cut
75 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
76 0 my $type = shift;
77 0 my $self = $type->SUPER::new;
78
79 # API endpoint
80 0 $self->{apiEndpoint} = "https://selectpdf.com/api2/pdfmerge/";
81
82 0 $self->{fileIdx} = 0;
83
84 0 $self->{parameters}{"key"} = shift;
85
86 0 bless $self, $type;
87 0 return $self;
88 }
89
90 =head2 addFile( $inputPdf )
91
92 Add local PDF document to the list of input files.
93
94 my $client = new SelectPdf::PdfMergeClient($apiKey);
95 $client->addFile($inputPdf);
96
97 Parameters:
98
99 - $inputPdf: Path to a local PDF file.
100
101 Returns:
102
103 - Reference to the current object.
104 =cut
105 0 ▶sub addFile($) {
Subroutine addFile: not called CC=1 SCAR=6.9
Pod documented
106 0 my($self, $inputPdf) = @_;
107
108 0 $self->{fileIdx} = $self->{fileIdx} + 1;
109
110 0 $self->{files}{"file_" . $self->{fileIdx}} = $inputPdf;
111 0 $self->{parameters}{"url_" . $self->{fileIdx}} = "";
112 0 $self->{parameters}{"password_" . $self->{fileIdx}} = "";
113
114 0 return $self;
115 }
116
117 =head2 addFileWithPassword( $inputPdf, $userPassword )
118
119 Add local PDF document to the list of input files.
120
121 my $client = new SelectPdf::PdfMergeClient($apiKey);
122 $client->addFileWithPassword($inputPdf, $userPassword);
123
124 Parameters:
125
126 - $inputPdf: Path to a local PDF file.
127
128 - $userPassword: User password for the PDF document.
129
130 Returns:
131
132 - Reference to the current object.
133 =cut
134 0 ▶sub addFileWithPassword($$) {
Subroutine addFileWithPassword: not called CC=1 SCAR=6.9
Pod documented
135 0 my($self, $inputPdf, $userPassword) = @_;
136
137 0 $self->{fileIdx} = $self->{fileIdx} + 1;
138
139 0 $self->{files}{"file_" . $self->{fileIdx}} = $inputPdf;
140 0 $self->{parameters}{"url_" . $self->{fileIdx}} = "";
141 0 $self->{parameters}{"password_" . $self->{fileIdx}} = $userPassword;
142
143 0 return $self;
144 }
145
146 =head2 addUrlFile( $inputUrl )
147
148 Add remote PDF document to the list of input files.
149
150 my $client = new SelectPdf::PdfMergeClient($apiKey);
151 $client->addUrlFile($inputUrl);
152
153 Parameters:
154
155 - $inputUrl: Url of a remote PDF file.
156
157 Returns:
158
159 - Reference to the current object.
160 =cut
161 0 ▶sub addUrlFile($) {
Subroutine addUrlFile: not called CC=1 SCAR=6.9
Pod documented
162 0 my($self, $inputUrl) = @_;
163
164 0 $self->{fileIdx} = $self->{fileIdx} + 1;
165
166 0 $self->{files}{"file_" . $self->{fileIdx}} = "";
167 0 $self->{parameters}{"url_" . $self->{fileIdx}} = $inputUrl;
168 0 $self->{parameters}{"password_" . $self->{fileIdx}} = "";
169
170 0 return $self;
171 }
172
173 =head2 addUrlFileWithPassword( $inputUrl, $userPassword )
174
175 Add remote PDF document to the list of input files.
176
177 my $client = new SelectPdf::PdfMergeClient($apiKey);
178 $client->addUrlFileWithPassword($inputUrl, $userPassword);
179
180 Parameters:
181
182 - $inputUrl: Url of a remote PDF file.
183
184 - $userPassword: User password for the PDF document.
185
186 Returns:
187
188 - Reference to the current object.
189 =cut
190 0 ▶sub addUrlFileWithPassword($$) {
Subroutine addUrlFileWithPassword: not called CC=1 SCAR=6.9
Pod documented
191 0 my($self, $inputUrl, $userPassword) = @_;
192
193 0 $self->{fileIdx} = $self->{fileIdx} + 1;
194
195 0 $self->{files}{"file_" . $self->{fileIdx}} = "";
196 0 $self->{parameters}{"url_" . $self->{fileIdx}} = $inputUrl;
197 0 $self->{parameters}{"password_" . $self->{fileIdx}} = $userPassword;
198
199 0 return $self;
200 }
201
202 =head2 save
203
204 Merge all specified input pdfs and return the resulted PDF.
205
206 my $client = new SelectPdf::PdfMergeClient($apiKey);
207 $client->addFile($inputPdf1);
208 $client->addFile($inputPdf2);
209 $content = $client->save();
210
211 Returns:
212
213 - Byte array containing the resulted PDF.
214 =cut
215 0 ▶sub save() {
Subroutine save: not called CC=1 SCAR=6.9
Pod documented
216 0 my($self) = @_;
217
218 0 $self->{parameters}{"async"} = "False";
219 0 $self->{parameters}{"files_no"} = $self->{fileIdx};
220
221 0 my $result = $self->SUPER::performPostAsMultipartFormData();
222
223 0 $self->{fileIdx} = 0;
224 0 $self->{files} = {};
225
226 0 return $result;
227 }
228
229 =head2 saveToFile( $filePath )
230
231 Merge all specified input pdfs and writes the resulted PDF to a local file.
232
233 my $client = new SelectPdf::PdfMergeClient($apiKey);
234 $client->addFile($inputPdf1);
235 $client->addFile($inputPdf2);
236 $client->saveToFile($filePath);
237
238 Parameters:
239
240 - $filePath: Local file including path if necessary.
241
242 Returns:
243
244 - Byte array containing the resulted PDF.
245 =cut
246 0 ▶sub saveToFile($) {
Subroutine saveToFile: not called CC=2 SCAR=17.9
Pod documented
247 0 my($self, $filePath) = @_;
248
249 0 my $result = $self->save();
250
251 0 ▶ my $file = IO::File->new( $filePath, '>' ) or die "Unable to open output file - $!\n";
Branch: 1 branch
BranchTrueFalseTotal
my $file = "IO::File"->new($filePath, ">") or die "Unable to open output file - $!\n" 0 0 0
252 0 $file->binmode;
253 0 $file->print( $result );
254 0 $file->close;
255 }
256
257 =head2 saveAsync
258
259 Merge all specified input pdfs and return the resulted PDF.
260
261 my $client = new SelectPdf::PdfMergeClient($apiKey);
262 $client->addFile($inputPdf1);
263 $client->addFile($inputPdf2);
264 $content = $client->saveAsync();
265
266 Returns:
267
268 - Byte array containing the resulted PDF. An asynchronous call is used.
269 =cut
270 0 ▶sub saveAsync() {
Subroutine saveAsync: not called CC=4 SCAR=30.0
Pod documented
271 0 my($self) = @_;
272
273 0 $self->{parameters}{"files_no"} = $self->{fileIdx};
274
275 0 ▶ my $JobID = $self->SUPER::startAsyncJobMultipartFormData() or die "An error occurred launching the asynchronous call.";
Branch: 1 branch
BranchTrueFalseTotal
my $JobID = $self->SUPER::startAsyncJobMultipartFormData or die "An error occurred launching the asynchronous call." 0 0 0
276
277 0 my $noPings = 0;
278
279 do
280 {
281 0 $noPings++;
282
283 # sleep for a few seconds before next ping
284 0 sleep($self->{AsyncCallsPingInterval});
285
286 0 my $asyncJobClient = new SelectPdf::AsyncJobClient($self->{parameters}{"key"}, $JobID);
287 0 $asyncJobClient->setApiEndpoint($self->{apiAsyncEndpoint});
288
289 0 my $result = $asyncJobClient->getResult();
290
291 0 ▶ if ($asyncJobClient->finished)
Branch: 1 branch
BranchTrueFalseTotal
if ($asyncJobClient->finished) 0 0 0
292 {
293 0 $self->{numberOfPages} = $asyncJobClient->getNumberOfPages();
294
295 0 $self->{fileIdx} = 0;
296 0 $self->{files} = {};
297
298 0 return $result;
299 }
300
301 0 ▶ } while ($noPings <= $self->{AsyncCallsMaxPings});
Branch: 1 branch
BranchTrueFalseTotal
$noPings <= $self->{"AsyncCallsMaxPings"} and do { do { ++$noPings; sleep $self->{"AsyncCallsPingInterval"}; my $asyncJobClient = "SelectPdf::AsyncJobClient"->new($self->{"parameters"}{"key"}, $JobID); $asyncJobClient->setApiEndpoint($self->{"apiAsyncEndpoint"}); my $result = $asyncJobClient->getResult; if ($asyncJobClient->finished) { $self->{"numberOfPages"} = $asyncJobClient->getNumberOfPages; $self->{"fileIdx"} = 0; $self->{"files"} = {}; return $result; } } } 0 0 0
302
303 0 $self->{fileIdx} = 0;
304 0 $self->{files} = {};
305
306 0 die "Asynchronous call did not finish in expected timeframe.";
307
308 }
309
310 =head2 saveToFileAsync( $filePath )
311
312 Merge all specified input pdfs and writes the resulted PDF to a local file. An asynchronous call is used.
313
314 my $client = new SelectPdf::PdfMergeClient($apiKey);
315 $client->addFile($inputPdf1);
316 $client->addFile($inputPdf2);
317 $client->saveToFileAsync($filePath);
318
319 Parameters:
320
321 - $filePath: Local file including path if necessary.
322
323 Returns:
324
325 - Byte array containing the resulted PDF.
326 =cut
327 0 ▶sub saveToFileAsync($) {
Subroutine saveToFileAsync: not called CC=2 SCAR=17.9
Pod documented
328 0 my($self, $filePath) = @_;
329
330 0 my $result = $self->saveAsync();
331
332 0 ▶ my $file = IO::File->new( $filePath, '>' ) or die "Unable to open output file - $!\n";
Branch: 1 branch
BranchTrueFalseTotal
my $file = "IO::File"->new($filePath, ">") or die "Unable to open output file - $!\n" 0 0 0
333 0 $file->binmode;
334 0 $file->print( $result );
335 0 $file->close;
336 }
337
338
339 =head2 setDocTitle( $docTitle )
340
341 Set the PDF document title.
342
343 Parameters:
344
345 - $docTitle: Document title.
346
347 Returns:
348
349 - Reference to the current object.
350 =cut
351 0 ▶sub setDocTitle($) {
Subroutine setDocTitle: not called CC=1 SCAR=6.9
Pod documented
352 0 my($self, $docTitle) = @_;
353
354 0 $self->{parameters}{"doc_title"} = $docTitle;
355 0 return $self;
356 }
357
358 =head2 setDocSubject( $docSubject )
359
360 Set the PDF document subject.
361
362 Parameters:
363
364 - $docSubject: Document subject.
365
366 Returns:
367
368 - Reference to the current object.
369 =cut
370 0 ▶sub setDocSubject($) {
Subroutine setDocSubject: not called CC=1 SCAR=6.9
Pod documented
371 0 my($self, $docSubject) = @_;
372
373 0 $self->{parameters}{"doc_subject"} = $docSubject;
374 0 return $self;
375 }
376
377 =head2 setDocKeywords( $docKeywords )
378
379 Set the PDF document keywords.
380
381 Parameters:
382
383 - $docKeywords: Document keywords.
384
385 Returns:
386
387 - Reference to the current object.
388 =cut
389 0 ▶sub setDocKeywords($) {
Subroutine setDocKeywords: not called CC=1 SCAR=6.9
Pod documented
390 0 my($self, $docKeywords) = @_;
391
392 0 $self->{parameters}{"doc_keywords"} = $docKeywords;
393 0 return $self;
394 }
395
396 =head2 setDocAuthor( $docAuthor )
397
398 Set the PDF document author.
399
400 Parameters:
401
402 - $docAuthor: Document author.
403
404 Returns:
405
406 - Reference to the current object.
407 =cut
408 0 ▶sub setDocAuthor($) {
Subroutine setDocAuthor: not called CC=1 SCAR=6.9
Pod documented
409 0 my($self, $docAuthor) = @_;
410
411 0 $self->{parameters}{"doc_author"} = $docAuthor;
412 0 return $self;
413 }
414
415 =head2 setDocAddCreationDate( $docAddCreationDate )
416
417 Add the date and time when the PDF document was created to the PDF document information. The default value is False.
418
419 Parameters:
420
421 - $docAddCreationDate: Add creation date to the document metadata or not.
422
423 Returns:
424
425 - Reference to the current object.
426 =cut
427 0 ▶sub setDocAddCreationDate($) {
Subroutine setDocAddCreationDate: not called CC=1 SCAR=6.9
Pod documented
428 0 my($self, $docAddCreationDate) = @_;
429
430 0 $self->{parameters}{"doc_add_creation_date"} = $self->SUPER::serializeBoolean($docAddCreationDate);
431 0 return $self;
432 }
433
434 =head2 setViewerPageLayout( $pageLayout )
435
436 Set the page layout to be used when the document is opened in a PDF viewer. The default value is 1 - OneColumn.
437
438 Parameters:
439
440 - $pageLayout: Page layout. Possible values: 0 (Single Page), 1 (One Column), 2 (Two Column Left), 3 (Two Column Right).
441
442 Returns:
443
444 - Reference to the current object.
445 =cut
446 0 ▶sub setViewerPageLayout($) {
Subroutine setViewerPageLayout: not called CC=5 SCAR=34.0
Pod documented
447 0 my($self, $pageLayout) = @_;
448
449 0 ▶ if ($pageLayout ne 0 and $pageLayout ne 1 and $pageLayout ne 2 and $pageLayout ne 3) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pageLayout ne 0 and $pageLayout ne 1 and $pageLayout ne 2 and $pageLayout ne 3) 0 0 0
Condition0%0/9
$pageLayout ne 0 and $pageLayout ne 1 and $pageLayout ne 2 and $pageLayout ne 3
!ll&&!rl&&r
000
$pageLayout ne 0 and $pageLayout ne 1 and $pageLayout ne 2
!ll&&!rl&&r
000
$pageLayout ne 0 and $pageLayout ne 1
!ll&&!rl&&r
000
MC/DC0%0/4
$pageLayout ne 0 and $pageLayout ne 1 and $pageLayout ne 2 and $pageLayout ne 3
$pageLayout ne 0 $pageLayout ne 1 $pageLayout ne 2 $pageLayout ne 3
Truth table0%0/5
A and B and C and D
A= $pageLayout ne 0B= $pageLayout ne 1C= $pageLayout ne 2D= $pageLayout ne 3
ABCDresult
0XXX0
10XX0
110X0
11100
11111
450 0 die ("Allowed values for Page Layout: 0 (Single Page), 1 (One Column), 2 (Two Column Left), 3 (Two Column Right).");
451 }
452
453 0 $self->{parameters}{"viewer_page_layout"} = $pageLayout;
454 0 return $self;
455 }
456
457 =head2 setViewerPageMode( $pageMode )
458
459 Set the document page mode when the pdf document is opened in a PDF viewer. The default value is 0 - UseNone.
460
461 Parameters:
462
463 - $pageMode: Page mode. Possible values: 0 (Use None), 1 (Use Outlines), 2 (Use Thumbs), 3 (Full Screen), 4 (Use OC), 5 (Use Attachments).
464
465 Returns:
466
467 - Reference to the current object.
468 =cut
469 0 ▶sub setViewerPageMode($) {
Subroutine setViewerPageMode: not called CC=7 SCAR=40.3
Pod documented
470 0 my($self, $pageMode) = @_;
471
472 0 ▶ if ($pageMode ne 0 and $pageMode ne 1 and $pageMode ne 2 and $pageMode ne 3 and $pageMode ne 4 and $pageMode ne 5) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pageMode ne 0 and $pageMode ne 1 and $pageMode ne 2 and $pageMode ne 3 and $pageMode ne 4 and $pageMode ne 5) 0 0 0
Condition0%0/15
$pageMode ne 0 and $pageMode ne 1 and $pageMode ne 2 and $pageMode ne 3 and $pageMode ne 4 and $pageMode ne 5
!ll&&!rl&&r
000
$pageMode ne 0 and $pageMode ne 1 and $pageMode ne 2 and $pageMode ne 3 and $pageMode ne 4
!ll&&!rl&&r
000
$pageMode ne 0 and $pageMode ne 1 and $pageMode ne 2 and $pageMode ne 3
!ll&&!rl&&r
000
$pageMode ne 0 and $pageMode ne 1 and $pageMode ne 2
!ll&&!rl&&r
000
$pageMode ne 0 and $pageMode ne 1
!ll&&!rl&&r
000
MC/DC0%0/6
$pageMode ne 0 and $pageMode ne 1 and $pageMode ne 2 and $pageMode ne 3 and $pageMode ne 4 and $pageMode ne 5
$pageMode ne 0 $pageMode ne 1 $pageMode ne 2 $pageMode ne 3 $pageMode ne 4 $pageMode ne 5
Truth table0%0/7
A and B and C and D and E and F
A= $pageMode ne 0B= $pageMode ne 1C= $pageMode ne 2D= $pageMode ne 3E= $pageMode ne 4F= $pageMode ne 5
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
473 0 die ("Allowed values for Page Mode: 0 (Use None), 1 (Use Outlines), 2 (Use Thumbs), 3 (Full Screen), 4 (Use OC), 5 (Use Attachments).");
474 }
475
476 0 $self->{parameters}{"viewer_page_mode"} = $pageMode;
477 0 return $self;
478 }
479
480 =head2 setViewerCenterWindow( $viewerCenterWindow )
481
482 Set a flag specifying whether to position the document's window in the center of the screen. The default value is False.
483
484 Parameters:
485
486 - $viewerCenterWindow: Center window or not.
487
488 Returns:
489
490 - Reference to the current object.
491 =cut
492 0 ▶sub setViewerCenterWindow($) {
Subroutine setViewerCenterWindow: not called CC=1 SCAR=6.9
Pod documented
493 0 my($self, $viewerCenterWindow) = @_;
494
495 0 $self->{parameters}{"viewer_center_window"} = $self->SUPER::serializeBoolean($viewerCenterWindow);
496 0 return $self;
497 }
498
499 =head2 setViewerDisplayDocTitle( $viewerDisplayDocTitle )
500
501 Set a flag specifying whether the window's title bar should display the document title taken from document information. The default value is False.
502
503 Parameters:
504
505 - $viewerDisplayDocTitle: Display title or not.
506
507 Returns:
508
509 - Reference to the current object.
510 =cut
511 0 ▶sub setViewerDisplayDocTitle($) {
Subroutine setViewerDisplayDocTitle: not called CC=1 SCAR=6.9
Pod documented
512 0 my($self, $viewerDisplayDocTitle) = @_;
513
514 0 $self->{parameters}{"viewer_display_doc_title"} = $self->SUPER::serializeBoolean($viewerDisplayDocTitle);
515 0 return $self;
516 }
517
518 =head2 setViewerFitWindow( $viewerFitWindow )
519
520 Set a flag specifying whether to resize the document's window to fit the size of the first displayed page. The default value is False.
521
522 Parameters:
523
524 - $viewerFitWindow: Fit window or not.
525
526 Returns:
527
528 - Reference to the current object.
529 =cut
530 0 ▶sub setViewerFitWindow($) {
Subroutine setViewerFitWindow: not called CC=1 SCAR=6.9
Pod documented
531 0 my($self, $viewerFitWindow) = @_;
532
533 0 $self->{parameters}{"viewer_fit_window"} = $self->SUPER::serializeBoolean($viewerFitWindow);
534 0 return $self;
535 }
536
537 =head2 setViewerHideMenuBar( $viewerHideMenuBar )
538
539 Set a flag specifying whether to hide the pdf viewer application's menu bar when the document is active. The default value is False.
540
541 Parameters:
542
543 - $viewerHideMenuBar: Hide menu bar or not.
544
545 Returns:
546
547 - Reference to the current object.
548 =cut
549 0 ▶sub setViewerHideMenuBar($) {
Subroutine setViewerHideMenuBar: not called CC=1 SCAR=6.9
Pod documented
550 0 my($self, $viewerHideMenuBar) = @_;
551
552 0 $self->{parameters}{"viewer_hide_menu_bar"} = $self->SUPER::serializeBoolean($viewerHideMenuBar);
553 0 return $self;
554 }
555
556 =head2 setViewerHideToolbar( $viewerHideToolbar )
557
558 Set a flag specifying whether to hide the pdf viewer application's tool bars when the document is active. The default value is False.
559
560 Parameters:
561
562 - $viewerHideToolbar: Hide tool bars or not.
563
564 Returns:
565
566 - Reference to the current object.
567 =cut
568 0 ▶sub setViewerHideToolbar($) {
Subroutine setViewerHideToolbar: not called CC=1 SCAR=6.9
Pod documented
569 0 my($self, $viewerHideToolbar) = @_;
570
571 0 $self->{parameters}{"viewer_hide_toolbar"} = $self->SUPER::serializeBoolean($viewerHideToolbar);
572 0 return $self;
573 }
574
575 =head2 setViewerHideWindowUI( $viewerHideWindowUI )
576
577 Set a flag specifying whether to hide user interface elements in the document's window (such as scroll bars and navigation controls),
578 leaving only the document's contents displayed.
579
580 Parameters:
581
582 - $viewerHideWindowUI: Hide window UI or not.
583
584 Returns:
585
586 - Reference to the current object.
587 =cut
588 0 ▶sub setViewerHideWindowUI($) {
Subroutine setViewerHideWindowUI: not called CC=1 SCAR=6.9
Pod documented
589 0 my($self, $viewerHideWindowUI) = @_;
590
591 0 $self->{parameters}{"viewer_hide_window_ui"} = $self->SUPER::serializeBoolean($viewerHideWindowUI);
592 0 return $self;
593 }
594
595 =head2 setUserPassword( $userPassword )
596
597 Set PDF user password.
598
599 Parameters:
600
601 - $userPassword: PDF user password.
602
603 Returns:
604
605 - Reference to the current object.
606 =cut
607 0 ▶sub setUserPassword($) {
Subroutine setUserPassword: not called CC=1 SCAR=6.9
Pod documented
608 0 my($self, $userPassword) = @_;
609
610 0 $self->{parameters}{"user_password"} = $userPassword;
611 0 return $self;
612 }
613
614 =head2 setOwnerPassword( $ownerPassword )
615
616 Set PDF owner password.
617
618 Parameters:
619
620 - $ownerPassword: PDF owner password.
621
622 Returns:
623
624 - Reference to the current object.
625 =cut
626 0 ▶sub setOwnerPassword($) {
Subroutine setOwnerPassword: not called CC=1 SCAR=6.9
Pod documented
627 0 my($self, $ownerPassword) = @_;
628
629 0 $self->{parameters}{"owner_password"} = $ownerPassword;
630 0 return $self;
631 }
632
633 =head2 setPdfName( $pdfName )
634
635 Specify the name of the pdf document that will be created. The default value is Document.pdf.
636
637 Parameters:
638
639 - $pdfName: Name of the generated PDF document.
640
641 Returns:
642
643 - Reference to the current object.
644 =cut
645 0 ▶sub setPdfName($) {
Subroutine setPdfName: not called CC=1 SCAR=6.9
Pod documented
646 0 my($self, $pdfName) = @_;
647
648 0 $self->{parameters}{"pdf_name"} = $pdfName;
649 0 return $self;
650 }
651
652 =head2 setCustomParameter( $parameterName, $parameterValue )
653
654 Set a custom parameter. Do not use this method unless advised by SelectPdf.
655
656 Parameters:
657
658 - $parameterName: Parameter name.
659
660 - $parameterValue: Parameter value.
661
662 Returns:
663
664 - Reference to the current object.
665 =cut
666 0 ▶sub setCustomParameter($$) {
Subroutine setCustomParameter: not called CC=1 SCAR=6.9
Pod documented
667 0 my($self, $parameterName, $parameterValue) = @_;
668
669 0 $self->{parameters}{$parameterName} = $parameterValue;
670 0 return $self;
671 }
672
673 =head2 setTimeout( $timeout )
674
675 Set the maximum amount of time (in seconds) for this job.
676 The default value is 30 seconds.
677 Use a larger value (up to 120 seconds allowed) for pages that take a long time to load.
678
679 Parameters:
680
681 - $timeout: Timeout in seconds.
682
683 Returns:
684
685 - Reference to the current object.
686 =cut
687 0 ▶sub setTimeout($) {
Subroutine setTimeout: not called CC=1 SCAR=6.9
Pod documented
688 0 my($self, $timeout) = @_;
689
690 0 $self->{parameters}{"timeout"} = $timeout;
691 0 return $self;
692 }
693
694 1 1;
« SelectPdf/PdfToTextClient.pm ↑ Summary SelectPdf/HtmlToPdfClient.pm »