PDF

From Omnia
Revision as of 22:42, 13 November 2018 by Kenneth (talk | contribs) (→‎Calculations)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

PDF

Remove PDF Password

HowTo: Linux Remove a PDF File Password Using Command Line Options

You can remove the password using various utilities under Linux. Use any one of the following option:

1. pdftk - A handy tool for manipulating PDF file.

2. qpdf - The qpdf program is used to convert one PDF file to another equivalent PDF file.

3. xpdf-utils - Portable Document Format (PDF) suite -- utilities such as pdftops and ps2pdf.

4. Print to a file - Use Evince software itself.

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf

Remove Printing Restrictions

pdf2ps [FILE].pdf out.ps
ps2pdf out.ps [FILE2].pdf
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf

Fonts

pdffonts command line tool from Xpdf

If you just want to find out the font names: run this from a terminal

strings yourPDFfilepath.pdf | grep FontName


References:

Fonts in PDF files

The PDF file format supports the use of the following font formats:

  • TrueType
  • Type 1
  • Type 3
  • Composite fonts (Type 0): both Type 1 (CIDFontType0) and TrueType (CIDFontType2) are supported.
  • OpenType: From PDF 1.6 onwards, OpenType fonts can be stored directly in PDF files. In prior releases OpenType fonts are embedded as either Type 1 or TrueType fonts. The ability to embed OpenType directly was added for the forms capabilities of PDF, it offers no immediate advantage for prepress users.

By preference any fonts that are used in a layout are also included in the PDF file itself. This makes sure that the file can be viewed and printed as it was created by the designer. There are two mechanisms to include fonts in a PDF:

  • Embedding – A full copy of the entire character set of a font is stored in the PDF.
  • Subsetting – Only those characters that are actually used in the lay-out are stored in the PDF. If the “$” character doesn’t appear anywhere in the text, that character is not included in the font. This means that PDF files with subsetted fonts are smaller than PDF files with embedded fonts. For subsetted fonts, the font name is preceded by 6 random characters and a plus sign.

If certain fonts are missing from the PDF file, Adobe Acrobat and Adobe Reader will automatically try to emulate the missing font by using one of the Multiple Master fonts that are built into these programs. This way, the document will not be represented exactly as the designer wanted it to, but at least the text won’t reflow. The Multiple Master fonts that are used for this are:

  • Adobe Serif MM
  • Adobe Sans MM

Fonts that are not necessarily included in PDF files. Older versions of Adobe Acrobat (Acrobat 3.x and earlier) will never embed the following 14 fonts in a PDF file:

  • Courier, Courier-Bold, Courier-Oblique & Courier-BoldOblique
  • Times-Roman , Times-Bold , Times-Italic & Times-BoldItalic
  • Helvetica, Helvetica-Bold, Helvetica-Oblique & Helvetica-BoldOblique
  • Symbol
  • ZapfDingbats.

These fonts, excluding ZapfDingbats, are called the Base 13 fonts.

From Acrobat 4.x onwards, there is no problem embedding the above 14 fonts. In fact it is a good idea to actually always embed these fonts as well. Instead we got another restriction: if the licensing policy of a TrueType forbids the font to be included in a file, Distiller 4 and later will respect this restriction and will not embed the font.

Source: Fonts in PDF files | How to embed or subset a font in a PDF - http://www.prepressure.com/pdf/basics/fonts

PDF Core Fonts

See PDF/Fonts

PDF in Linux

See Linux/PDF

Calculations

How to do (not so simple) form calculations - https://acrobatusers.com/tutorials/print/how-to-do-not-so-simple-form-calculations

--

JavaScript custom calculation script for a perc... | Adobe Community - https://forums.adobe.com/thread/2287656

var sum = Number(this.getField("sum1").value) + Number(this.getField("sum2").value) + Number(this.getField("sum3").value) +   
     Number(this.getField("sum4").value) + Number(this.getField("sum5").value);  
event.value = (sum/25)*100; 

---

if ((event.value == Infinity)|| isNaN(event.value)) { event.value = '' }

Make a NaN value invisible? | Adobe Community - https://forums.adobe.com/thread/1071771

---

(function () {  
  
    // Get the field values, as numbers  
    var v1 = +getField("A").value;  
    var v2 = +getField("B").value;  
  
    if (v1 !== 0) {  
        event.value = 100 * (v1 - v2) / v1;  
    } else {  
        event.value = "";  
    }  
  
})(); 

remove NaN error message | Adobe Community - https://forums.adobe.com/thread/834144

---

// Custom Calculate script

(function () {

   

    // Get the input field values, as strings

    var s1 = getField("F1").valueAsString;

    var s2 = getField("F2").valueAsString;

   

    // Only proceed if there is a value in both fields

    if (s1 && s2) {

       

        // Convert field values to numbers

        var v1 = +s1;

        var v2 = +s2;

       

        // Perform the division if the denominator is not zero

        if (v2 !== 0) {

            event.value = util.printf("%.0f", 100 * v1 / v2);

        } else {

            event.value = 0;

        }

    } else {

       

        // Blank this field if either input is blank

        event.value = "";

    }

   

})();

Need Help Creating Custom Calculation Script Pl... | Adobe Community - https://forums.adobe.com/thread/1083829