Menu

Home

Jofre Diaz Falcon

PDF command line document creator

Project Members:

Introduction

The PDF command line document creator it is a small utility to create PDF documents quickly using the command line.
It is very useful for example to create labels for printing later, this is the reason why I created this application.
This application can create text, figures primitive images, some bar codes, QR codes and Datamatrix.

Usage

Simple example, this create a blank document of 54 x 25 mm with the text "pdf-cldc Demo".

$ pdf-cldc --verbose --dst /tmp/document.pdf --width 54 --height 25 --object-text [x=45,y=32,size=12,font=condensed,strokecolor=#0000CC,value="pdf-cldc Demo"]


This is the same example but using the short notation of the parameters.

$ pdf-cldc -v -d /tmp/document.pdf -w 54 -h 25 --object-text [x=45,y=32,s=12,f=condensed,sc=#0000CC,v="pdf-cldc Demo"]


Options and parameters

To create the pdf document at least have to write --dst, --width, --height parameters, then you can post objects that you want to add the document.

There are parameters that indicate sizes, if not specified the default unit of sizes is the millimeter. The values are expressed in float format.
You can use the following units: millimeters (mm), centimeters (cm), inches (in), points (pt), picas (pc) and pixels (px).

The color parameters are expressed with CSS notation. You can user hexadecimal notation, for example "fillcolor=#CC0000", short notation "fillcolor=#C00" or the color name "fillcolor=dark-blue".

Within the sub parameters you can't use spaces except within quotes for string params.

Parameter format:

--object-foo [key=value,key="string value",...]


--dst

The PDF destination file.

Example:

--dst /tmp/foo.pdf

--width

The document width. You can use units of measure, using default millimeters.

Example:

--width 210

--height

The document height. You can use units of measure, using default millimeters.

Example:

--height 297

--verbose

The program is put to verbose mode.

Example:

--verbose

--object-arc

Appends a circle arc to document.

Subparameters:

x: X coordinate of the center point.
y: Y coordinate of the center point.
radius (r): The radius of the circle arc.
angle1 (a1): The angle of the beginning of the arc.
angle2 (a2): The angle of the end of the arc. It must be greater than angle1.
linewidth (lw): The line width to use.
Optionally:
strokecolor (sc): The stroke color to use.
fillcolor (fc): The fill color to use.

Example:

--object-arc [x=10,y=20,radius=15,angle1=0,angle2=180,linewidth=0.5]

--object-circle

Appends a circle to document.

Subparameters

x: X coordinate of the center point.
y: Y coordinate of the center point.
radius (r): The radius of the circle.
linewidth (lw): The line width to use.
Optionally:
strokecolor (sc): The stroke color to use.
fillcolor (fc): The fill color to use.

Example:

--object-circle [x=10,y=20,radius=15,linewidth=0.5]

--object-ellipse

Appends a ellipse to document.

Subparameters

x: X coordinate of the center point.
y: Y coordinate of the center point.
xradius (xr): The X radius of the ellipse.
yradius (yr): The Y radius of the ellipse.
linewidth (lw): The line width to use.
Optionally:
strokecolor (sc): The stroke color to use.
fillcolor (fc): The fill color to use.

Example:

--object-ellipse [x=10,y=20,xradius=15,yradius=30,linewidth=0.5]

--object-rectangle

Appends a rectangle to document.

Subparameters

x: X coordinate of the left-bottom point.
y: Y coordinate of the left-bottom point.
width (w): The width of the rectangle.
height (h): The height of the rectangle.
linewidth (lw): The line width to use.
Optionally:
strokecolor (sc): The stroke color to use.
fillcolor (fc): The fill color to use.

Example:

--object-rectangle [x=10,y=20,width=40,height=10,linewidth=0.5]

--object-line

Appends a line to document.

Subparameters

x1: X coordinate of the first point.
y1: Y coordinate of the first point.
x2: X coordinate of the second point.
y2: Y coordinate of the second point.
linewidth (lw): The line width to use.
Optionally:
strokecolor (sc): The stroke color to use.

Example:

--object-line [x1=10,y1=10,x2=50,y2=100,linewidth=2]

--object-text

Appends a line text to document. It use Liberation font, you can set the type with the [font] parameter.

Subparameters

x: X coordinate of the left-bottom point.
y: Y coordinate of the left-bottom point.
size (s): The font size to use.
value (v): The text value.
Optionally:
font (f): The font to use, the font can be [sans-serif], [condensed], [monospace].
strokecolor (sc): The stroke color to use.

Example:

--object-text [x=20,y=50,size=10pt,font=monospace,value="pdf-cldc object text"]

--object-qr

Appends a QR code to document.

Subparameters

x: X coordinate of the left-bottom point.
y: Y coordinate of the left-bottom point.
width (w): The width of the QR code.
height (h): The height of the QR code.
value (v): The text value to encode.

Example:

--object-qr [x=20,y=20,width=50,height=50,value="pdf-cldc QR text"]

--object-datamatrix

Appends a Datamatrix to document.

Subparameters

x: X coordinate of the left-bottom point.
y: Y coordinate of the left-bottom point.
width (w): The width of the Datamatrix.
height (h): The height of the Datamatrix.
value (v): The text value to encode.

Example:

--object-datamatrix [x=20,y=20,width=50,height=50,value="pdf-cldc Datamatrix text"]

--object-pdf417

Appends a PDF417 barcode to document.

Subparameters

x: X coordinate of the left-bottom point.
y: Y coordinate of the left-bottom point.
width (w): The width of the PDF417 barcode.
height (h): The height of the PDF417 barcode.
value (v): The text value to encode.

Example:

--object-pdf417 [x=20,y=20,width=50,height=50,value="pdf-cldc PDF417 barcode text"]

--object-image

Appends a png or jpg image to document.

Subparameters

x: X coordinate of the left-bottom point.
y: Y coordinate of the left-bottom point.
width (w): The width of the image.
height (h): The height of the image.
filename (fn): The path image.

Example:

--object-image [x=20,y=20,width=320px,height=240px,filename="/home/user/img.png"]