for testing the encryption function (by default 128 bit encryption) , i created a pdf file 'apps.pdf' with password protected 'abcd' as password.
source code 1:
use PDF::Tk;
my $doc = PDF::Tk->new( pdftk => '/apps/free/pdftk/1.44/bin/pdftk' );
$doc->call_pdftk( 'apps.pdf', '1.128.pdf', 'owner_pw', 'abcd' );
getting error:
Error: Unexpected command-line data:
owner_pw
where we were expecting an input PDF filename,
operation (e.g. "cat") or "input_pw". Exiting.
Errors encountered. No output created.
Done. Input errors, so no output created.
pdftk apps.pdf owner_pw abcd 1.128.pdf failed: 256 at /usr/lib/perl5/site_perl/5.10.0/PDF/Tk.pm line 73.
note: created a new pdf 'apps.pdf' with Document Open Password as 'abcd' and permission Password as 'abcd123'. Please let me know how to resolve it.
Replace line "$doc->call_pdftk( 'apps.pdf', '1.128.pdf', 'owner_pw', 'abcd' );" with command lines
system('/apps/free/pdftk/1.44/bin/pdftk', 'apps.pdf', 'output', '1.128.pdf', 'owner_pw', 'abcd', 'user_pw', 'Oct1234');
"owner_pw" contains the permission password and "user_pw" contain open document password.
Result is : 1.128.pdf is created with security passwords.
Related
I have been trying to import a csv file into a table I created. I have set each column with data type "text" and believe to have the parameters configured correctly (delimiter, etc..)
I keep receiving the "Failed: Exit code -6" but with no explicit error message. Any ideas?
enter image description here
I am trying to read in some files from the following directory structure:
/jc/06 Önéletrajzok/Profession/Előszűrés sablonok név szerint
But for some strange reason I cannot enter not even in the upper level directories.
I already tried with PHP/Python3.6/Ruby but without much luck. At least with PHP and Python I can CWD() at least until the /jc/06 Önéletrajzok/Profession part.
Here is my python code for reference:
from ftplib import FTP
ftp = FTP('hostname')
ftp.login('username','pwd')
ftp.cwd('jc') # Just for demonstration purposes as step by step
ftp.cwd('06 Önéletrajzok')
ftp.cwd('Profession')
print(ftp.nlst()[2]) # Which gives: 'ElÅ\x91szűrés sablonok név szerint
# But when I am trying:
ftp.cwd('ElÅ\x91szűrés sablonok név szerint')
# Or either:
ftp.cwd('Előszűrés sablonok név szerint')
# It gives:
# UnicodeEncodeError: 'latin-1' codec can't encode character '\u0151' in position 6: ordinal not in range(256)
# So I am trying encoding CP1250 or CP852 (for Hungarian)
dir = 'Előszűrés sablonok név szerint'.encode('cp852') # which gives: b'El\x8bsz\xfbr\x82s sablonok n\x82v szerint'
ftp.cwd(dir.decode('utf-8'))
# and it gives the following error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 2: invalid start byte
So I am starting to give up on this one, I don't know how to access those files. The directory structure was created with Windows laptops accessing a Synology File server.
I have already tried with ftp.encoding = "utf-8" too.
Any ideas?
In isql-vt (the Ubuntu name for Virtuoso's isql), I am trying to import a test .ttl file, but get the error "Can't stat file":
SQL> DB.DBA.TTLP(file_to_string_output('./scratch/ttl/granule.ttl'),'','http://origin.mytest.org/');
*** Error 42000: [Virtuoso Driver][Virtuoso Server]FA112: Can't stat file './scratch/ttl/granule.ttl', error (2) : No such file or directory
However, the file is definitely there; I can even cat it:
SQL> !cat ./scratch/ttl/granule.ttl;
#prefix datacite: <http://purl.org/spar/datacite/> .
#prefix prov: <http://www.w3.org/ns/prov#> .
<http://0.0.0.0:3000/granule/MOD09.A2016278.0110.006.2016279074214.hdf>
datacite:identifier "MOD09.A2016278.0110.006.2016279074214.hdf";
prov:wasGeneratedBy <http://0.0.0.0:3000/run/MODAPS_456056327>;
a prov:entity .
SQL>
Why is the DB.DBA.TTLP command saying it can't stat it?
Trying to use the full path gave a much better error message:
SQL> DB.DBA.TTLP(file_to_string_output('/home/ubuntu/Origin/scratch/ttl/granule.ttl'),'','http://origin.nasa.gov/');
*** Error 42000: [Virtuoso Driver][Virtuoso Server]FA003: Access to
'/home/ubuntu/Origin/scratch/ttl/granule.ttl' is denied due to access control in ini file
So, the solution was to add the path in /etc/virtuoso-opensource-6.1/virtuoso.ini, eg:
...
DirsAllowed = ., /usr/share/virtuoso-opensource-6.1/vad, /home/ubuntu/Origin
...
and restart virtuoso for the change to take effect.
I am using Net::SFTP::Foreign with IO::Pty.
My Login Command is:
Net::SFTP::Foreign->new(host=> $server_address,
user => $user_id,
password => $password)
or die "Could not Connect To Server $server_address: $!";
When I am passing invalid entry for server/user/password, it's not throwing the error message. It's simply hanging on the command line and not giving any output ever after 30+ minutes.
Please help how to handle the errors, if there is any invalid input parameters.
If I am passing all the valid values, its working fine.
Finally, using the following option, I am able to handle the issue.
Net::SFTP::Foreign::debug=-1;
$sftp = Net::SFTP::Foreign->new( host=> $server_address, user => $user_id, password => $password, more=>'-vvv', timeout=>30);
This command will handle the wrong host_name, user_id or password. The job will fail after waiting for the no.of seconds given for timeout, if it is not able to establish a connection.
I was testing the functionality of PDF::Tk by installing in cpan module and installed the pdftk binary file and the path to variable and tried running source code.
source code:
use PDF::Tk;
my $doc = PDF::Tk->new( pdftk => '/apps/free/pdftk/' );
$doc->call_pdftk( 'input.pdf', 'outPDF.pdf', 'cat', '1-14' );
getting error as below:
pdftk input.pdf cat 1-14 releasenote.pdf failed: -1 at
/usr/lib/perl5/site_perl/5.10.0/PDF/Tk.pm line 73.
please guide me in resolving it.
Seems you are passing the wrong argument to the constructor of PDF::Tk. Have a look here.
You're supposed to pass a hash, with the key pdftk, and this should be the path of the executable, not a directory. As you can see here, this will be executed via system, so of course, executing a directory does not work.
To clarify, you should be using:
my $doc=PDF::Tk->new(pdftk => '/path/to/pdftk/executable');
If your pdftk executable is /usr/bin/pdftk, then you do not have to pass it at all as this is the default.
for testing the encryption function (by default 128 bit encryption) , i created a pdf file 'apps.pdf' with password protected 'abcd' as password.
source code 1:
use PDF::Tk;
my $doc=PDF::Tk->new(pdftk=>'/apps/free/pdftk/1.44/bin/pdftk');
$doc->call_pdftk('apps.pdf', '1.128.pdf', 'owner_pw', 'abcd');
getting error:
Error: Unexpected command-line data:
owner_pw
where we were expecting an input PDF filename,
operation (e.g. "cat") or "input_pw". Exiting.
Errors encountered. No output created.
Done. Input errors, so no output created.
pdftk apps.pdf owner_pw abcd 1.128.pdf failed: 256 at /usr/lib/perl5/site_perl/5.10.0/PDF/Tk.pm line 73.
note: created a new pdf 'apps.pdf' with Document Open Password as 'abcd' and permission Password as 'abcd123'.
Please let me know how to resolve it.