No: it worked out of the box. I'm sorry I didn't see the file was protected before: I didn't think about that as there was no password asked and no message displayed (and obviously no errors with scripts) when I manipulated the file manually (either via Acrobat Reader or using sejda console or sejda desktop or even Perl scripts). I'm not a PDF expert but I presume that the password is an authentication mechanism more than a protection as it doesn't prevent anything to read the file. But in that case, how is the content deciphered automatically?

Anyway, for CAM::PDF, the script I gave in my first message is working exactly as I wrote it without any password related stuff:

my$file='file.pdf'; my $oldpdf = CAM::PDF->new($file) or die "$CAM::PDF::errstr\n"; if ($oldpdf->numPages() > 100) { printf " (%d pages)\n", $oldpdf->numPages(); $oldpdf->extractPages(1..100); $oldpdf->cleanoutput("split_$file"); }

Still with CAM::PDF, getPageText method works correctly and displays the real text of the file. I also managed to modify some data with getPageContent and setPageContent but not all data (I tried to obfuscate the file with this but the resulting pdf was corrupted).

And with PDF::API2, xmpMetadata method for example produces unreadable data on that file (I cannot give the result here: it doesn't parse correctly on the site).

I'm now looking for a way to use PDF::API2 the same way CAM::PDF is working: ie. by copying the pdf file and then removing the undesired pages but I'm not sure this is possible

Thank you again for your help: it's almost time for me to end my week at work, so I'll return on that subject on Monday. Nice weekend folks.


In reply to Re^10: blank pdf generated using PDF::API2 (Updated) by lennelei
in thread blank pdf generated using PDF::API2 by lennelei

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.