1
ruby@ruby-Z87X-HD3:~$ sudo apt-get install libpdf-api2-perl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libpdf-api2-perl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ruby@ruby-Z87X-HD3:~$ PDF::API
PDF::API: command not found
ruby@ruby-Z87X-HD3:~$ PDF::API2
PDF::API2: command not found

and then I use it in perl, it still does not work! I think I will be crazy about it

ruby@ruby-Z87X-HD3:~$ perl perl.pl 
Can't locate object method "new" via package "PDF::API2" (perhaps you forgot to load "PDF::API2"?) at perl.pl line 1.

i have use it like this

use PDF::API2;
#
$pdf = PDF::API2->new;
$pdf = PDF::API2->open('some.pdf');
$page = $pdf->page;
$page = $pdf->openpage($pagenum);
$img = $pdf->image('some.jpg');
$font = $pdf->corefont('Times-Roman');
$font = $pdf->ttfont('TimesNewRoman.ttf');



ruby@ruby-Z87X-HD3:~$ perl perl.pl 
Can't locate object method "image" via package "PDF::API2" at perl.pl line 7.----------

i have download a pdf file and changed it name called some.pdf, but it also did not work

A.B.
  • 90,397
  • 2
    So you typed PDF::API in command line and not in an EDITOR why? start reading here: https://docs.google.com/viewer?url=http%3A%2F%2Fblob.perl.org%2Fbooks%2Fbeginning-perl%2F3145_Chap01.pdf ;) – Rinzwind Jan 29 '14 at 18:39
  • 1
    PDF::API is not a command, but a perl module (this explains your first two command not founds). As for the second, perl.pl is clearly a script that you wrote, but without seeing it we can't tell you what's wrong. Please add the script's contents to your question :) – roadmr Jan 29 '14 at 18:39
  • i had tried it like you said,but it also cannot work. use PDF::API2;

    $pdf = PDF::API2->new; $pdf = PDF::API2->open('some.pdf'); $page = $pdf->page; $page = $pdf->openpage($pagenum); $img = $pdf->image('some.jpg'); $font = $pdf->corefont('Times-Roman'); $font = $pdf->ttfont('TimesNewRoman.ttf'); ruby@ruby-Z87X-HD3:~$ perl perl.pl Can't locate object method "image" via package "PDF::API2" at perl.pl line 7. i have downloaded a pdf file and changed the name called some.pdf

    – ruby youngh Jan 30 '14 at 02:33

1 Answers1

4

A language like perl you code software with an editor. Example of that is gEdit.

Open gEdit and you can start typing things like this:

use PDF::API2;
#
$pdf = PDF::API2->new;
$pdf = PDF::API2->open('some.pdf');
$page = $pdf->page;
$page = $pdf->openpage($pagenum);
$img = $pdf->image('some.jpg');
$font = $pdf->corefont('Times-Roman');
$font = $pdf->ttfont('TimesNewRoman.ttf');

If you save this as "example.pl" you can then use "perl example.pl" to execute these commands. And if it is valid code it will execute it.

This will NEVER work:

ruby@ruby-Z87X-HD3:~$ PDF::API
PDF::API: command not found
ruby@ruby-Z87X-HD3:~$ PDF::API2
PDF::API2: command not found

The $ is the shell and PDF:API and PDF:API2 are not bash commands. The are a perl modules so you use them inside a perl script.

Regarding the last message. Please open perl.pl with gEdit and put use PDF::API2; in the beginning of the file. If it throws any more errors you still need to fix those.

There are many but one of the beginners guide to Perl can be found on this link.

Rinzwind
  • 299,756
  • i had tried it like you said,but it also cannot work. use PDF::API2;

    $pdf = PDF::API2->new; $pdf = PDF::API2->open('some.pdf'); $page = $pdf->page; $page = $pdf->openpage($pagenum); $img = $pdf->image('some.jpg'); $font = $pdf->corefont('Times-Roman'); $font = $pdf->ttfont('TimesNewRoman.ttf'); ~ ruby@ruby-Z87X-HD3:~$ perl perl.pl Can't locate object method "image" via package "PDF::API2" at perl.pl line 7.

    – ruby youngh Jan 30 '14 at 02:25
  • thanks a lot. I have tested it in your way. and I can use PDF::API2. thanks very much – ruby youngh Jan 30 '14 at 04:50
  • Good you got this figured out! – Rinzwind Jan 30 '14 at 08:07