pdftk command to disable software printing - security

I know that using pdftk we can disable or allow printing of PDF. But what I really want to do is allow printing from hardware but disable software printing like Adobe reader print to PDF or Microsoft print to PDF.
Because software printing removes protection control over PDF.
If pdftk can't do it then is there any command line which can protect PDF.
Thanks.

This is not possible, neither with pdftk nor with any other tool; it is not supported by the PDF format.
Also, keep in mind that PDF permissions are more of a suggestion than a real restriction, since it is up to the reader software to honour them. They are as secure as a stack of bills with "do not steal" written on a post-it note.

Related

How to remove PDF/A markers without using Adobe Acrobat in GNU/Linux

I am trying to remove the PDF/A markers in a file — I have no access to Adobe Acrobat — as some tools balk at PDF/As. Is there a way to revert a PDF/A to a normal PDF with free software tools? I am running Debian testing.
The indicators for PDF/A are in the Metadata entry, but you do not want to erase that entire entry. Instead you would want to modify it.
To modify, you can extract the XML string, modify using whatever XML tool is handy for you, and then "update".
These three entries are the ones you want to erase.
pdfaid:part
pdfaid:amd
pdfaid:conformance
Of course this still leaves you with the following tasks, with 1 and 3 normally done using a PDF SDK library.
Find and extract the Metadata entry (it could be compressed in the PDF)
Reading and editing the XML (should be trivial)
Updating the Metadata entry with your modified XML
Since you gave no indications of platform+OS I can't advise any further.

Self Contained Linux Command line tool for converting text to doc, rtf, pdf

I'm looking for a command line tool for Linux that will allow me to convert UTF-8 plain text files to various formats. My problem is that I'm working on a secure company-specific flavour of Linux, so the tool can't rely on other packages, such as Open Office, being present. Does anyone know of such a tool?
Gnu a2ps allows you convert from anything to postscript (designed for printing). Not exactly what you want but if you have utilites to display postscript files, you can convert them into pdf.
Another option is Gnu enscript which "converts text to Postscript, HTML or RTF with syntax highlighting". I'm not sure if it supports UTF-8.
Conversion into doc will be harder since it's a closed format. But I have in the past cheated by creating an HTML file with inline css and then renaming it to .doc. Worked back in the early 2000s. DOn't know about now.

Converting troublesome delimited PDF to Excel

I'm trying to convert this delimited PDF to an excel (or some other delimited format). Using Adobe Acrobat 9, I attempt to save it and copy it) as Excel but it gives the error message "BAD PDF; error in processing fonts. [348]".
I'm open to any solution that will create a delimited file, ranging from using Adobe Acrobat, to programming to using other apps. The only limitation is that I don't have a budget to buy anything (such as Able2Extract).
The way I was able to export my images and fonts without buying any extra software to do the conversion was this way. go to Advanced, PDG Optimizer, select all of the options you want on the LEFT COLUMN and where it says MAKE COMPATIBLE WITH select Acrobat 8.0 and later, OK....you are in your road to success
Note: not really an answer, but some suggestions.
Sounds to me that Crystal Reports is not following the PDF spec close enough.
I'd make sure CR is fully updated/patched and try genning another file making sure that "tagging" is enabled - tagging defines the layout structure. I don't have a copy of CR handy, but you may have to define a distiller template to use so when you print to PDF you can select that job option.
You can also tell its a bad PDF by using Preflight in Acrobat, it says there is no tag structure and you can do it manually (draw boxes around each item...). Also that there is no language set, and it is somehow compatible with Acrobat 1.3? which isn't supported anymore and should be 4 at the lowest?
Once you have a "good" pdf can export to xml/word and import that to excel. Also, with Acrobat 8+ you can highlight using the select tool, right-click and choose Open As SpreadSheet. You might be able to get away with just highlighting the whole document -- though I'd hope the xml approach would be best.
Able2Extract does some OCRing and tricky fuzzy logic not only to define tags/layout so it is exportable, but also avoids any font, encoding, etc issue - at least to my knowledge.
In the rare case that you can't get a new file, then exporting to plain text/accessible seems to generate a nice flat text file. You could write a vbscript to parse it (adding your delimiter) and import that into excel.

Bash-script printing a pdf to a pdf in Linux

The question probably sounds a little odd, but the actual task is relatively simple, I swear!
I'm automatically generating some PDFs from a webform, using PDFCreator to merge a generated FDF into a preexisting PDF. I created the preexisting PDF in NitroPDF. This setup works great - almost. The problem is that when you view the generated PDFs in Adobe Reader 9 (the most common reader) a subset of the fields are just blank. The information is still there; using previous versions of Adobe Reader or a different reader like Foxit Reader shows the entire PDF. No clue what's going on, and Adobe tech support was useless since I didn't create the PDF with Adobe software. (If you'd like to help fix this problem instead of the following, feel free to email me.)
However, if I take the resultant PDF and print it to a fresh PDF using a PDF printer driver, it works great everywhere. This is time-consuming and annoying for our sales department to do themselves, so I want to perform this step automagically upon creating the first PDF.
I'm in ubuntu, and have command-line root access to the server. The program is written in PHP, and can easily make system calls. I'm just having trouble figuring out how to tie things together properly so that I can automatically print a known file using a specific printer driver to another known file.
You could try putting your PDF files through Ghostscript. I have found that this is enough to fix many problematic PDFs.
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf
(The same command can also be used to merge several PDF files into one, just specify multiple input files.)

PDF Security

I have a question about PDF security preferences. Can I change an editable pdf to readable pdf programmatically?
Yes - with for example PDFStamp on Windows (Command line reference)
My Perl CAM::PDF library has a command-line utility called rewritepdf.pl that can do this quite easily with the -P flag. The library exposes this functionality quite easily, too.
Yes, adding security to a PDF which stops people from being able to edit it, is quite easy using a variety of different PDF toolkits (iText, PDFSharp, Quick PDF Library, etc).
PDF encryption may not be honored in some tools.
You can use tools such as PDFLEO to encrypt PDF documents (command line reference)

Resources