Images, PDF underlays, transmittal and password
BadBit CAD attaches to the drawing, as a reference, an image (photo, map, scan) or a PDF page (a supplier's plan, the scanned survey): the file stays outside the drawing and appears in it in draw order (an image attached later covers what was already there, as in AutoCAD; DRAWORDER changes it), like external references. The drawing keeps the name, path, position, clipping and adjustments; the pixels and the page are read from the file at each opening, in the background. ETRANSMIT gathers the drawing with everything it uses into a .zip or a folder, and SECURITYOPTIONS saves the DWG with a password.
Commands
| Command | What it does |
|---|---|
| IMAGEATTACH (IAT) | Attaches an image (PNG, JPG, TIFF, BMP, GIF, WebP). |
| IMAGE (IM) | Opens the External References manager, with the images and PDFs. |
| IMAGECLIP (ICL) | Clips the image: rectangular, polygonal, inverted; turns the clipping on and off and deletes it. |
| IMAGEADJUST (IAD) | Brightness, contrast and fade of the image. |
| TRANSPARENCY | Turns the image transparency on or off (transparent pixels let you see what is underneath). |
| IMAGEFRAME | The image frame: 0 hidden, 1 displayed and plotted (default), 2 displayed but not plotted. |
| PDFATTACH | Attaches a page of a PDF. |
| PDFCLIP | Clips the PDF underlay (the same options as IMAGECLIP). |
| PDFLAYERS | Turns the layers of the PDF underlay on and off. |
| PDFADJUST | Fade, contrast, monochrome and adjust to background of the PDF underlay. |
| PDFOSNAP | 1 (default): snaps see the geometry of the PDF underlay; 0: only the frame. |
| PDFFRAME | The frame of PDF underlays (0, 1 or 2, like IMAGEFRAME). |
| PDFIMPORT | With PDF underlays in the drawing, asks Select PDF underlay or [File] <File>: and converts the underlay into geometry. |
| ETRANSMIT | Creates the transmittal package (zip or folder) with the report. |
| SECURITYOPTIONS | The password to open the drawing (DWG 2004, 2007, 2010, 2013 and 2018). |
| DRAWORDER (DR) | The draw order of any object, images too: Above objects (A), Under objects (U), Front (F), Back (B). |
The command names are AutoCAD's, the same in all three languages.
Attaching an image (IMAGEATTACH)
IMAGEATTACH opens the system dialog to choose the file and then the Attach Image dialog:

- Name: the name of the definition (the file name, without the extension). Two images with the same name share the file, the state and the path; a name already used by another file is not accepted.
- Path type: Full path, Relative path (to the drawing folder; needs the drawing to be saved) or No path (only the name: the file is looked for in the drawing folder). Windows paths (
C:\projeto\foto.jpg) are also found by name on other systems. - Insertion point, Scale and Rotation: Specify on-screen asks on the command line (
Specify insertion point <0,0>:,Specify scale factor <1>:,Specify rotation angle <0>:), with a click or a typed value; a clicked scale is the distance to the insertion point and the rotation, its angle. - Image details: the Resolution (pixels per unit) and its Unit (None, Inch, Centimeter), already read from the file when it has them (the PNG
pHYs, the JPEG JFIF and EXIF, the TIFF resolution tags), as AutoCAD does. Without resolution, the image comes in 1 unit wide at scale 1 (as in AutoCAD); with resolution, at its real size (the DPI per inch) converted to the drawing unit. The dialog shows the size in pixels and the width at scale 1.
The insertion point is the lower left corner of the image. The image is read in a thread: it appears as soon as it is ready (the drawing keeps responding). Large images use levels of detail (each level half the size of the previous one): zoomed out, the screen uses the smallest level; zoomed in, the pixels appear as squares (without blurring), as in AutoCAD. The stored pixels have a memory cap (1.5 GB): beyond it, the pixels of the images that have been off screen the longest are dropped. The graphics card also has a cap (512 MB) and, when the image exceeds its largest texture size, the first level that fits is used.

Move, copy, rotate, scale and mirror take the image along (mirroring flips it). The grips at the four corners move the whole image. Properties show the name, the path, the page (for a PDF), the width, the height and the rotation.
With FILEDIA 0 (command line)
With the FILEDIA variable at 0, IMAGEATTACH opens no dialog and asks everything on the command line, as AutoCAD does: Enter image file name to attach: (the full path, or relative to the drawing folder), Specify insertion point <0,0>:, the scale and the rotation. The definition name is the file name and the resolution comes from the file. PDFATTACH asks Enter path of PDF file to attach: and, with more than one page, Enter page number <1>:.
Draw order (DRAWORDER)
The image sits in the draw order like any object: what comes after it appears on top, and what comes before is hidden by it (an image attached after the lines covers them, as in AutoCAD). DRAWORDER (DR) chooses the objects and asks Enter draw order [Above objects (A)/Under objects (U)/Front (F)/Back (B)] <Back>:. Back (Enter) puts the image underneath everything; Front, on top of everything; Above objects and Under objects ask Select reference objects: and put the chosen objects just above (or just below) them. It works for images, hatches, lines and everything else, as a single undo step, and the order goes into DXF and DWG (the order of the entities in the file and AutoCAD's SORTENTSTABLE, which is also read when opening). An image with TRANSPARENCY on does not hide what is underneath.
An image inside a block appears with its pixels at the place of the insert (before, only the frame) and follows the same draw order inside the block: the block objects that come before it (and what came before the insert in the drawing) are hidden by its area, and those that come after appear on top, on screen and in the plot. An image whose file was not found hides nothing, at any block level (also in a block inside another block). An image seen through a concave polygonal viewport in a layout is clipped by its exact outline.
The missing image
If the file is not found (or the image was unloaded in the manager), the frame with the name of the definition appears, even with IMAGEFRAME 0. A file that exists but cannot be read (unknown format, damaged file, image too large) also shows only the frame.
Clipping (IMAGECLIP and PDFCLIP)
IMAGECLIP uses the selected image (or asks Select image to clip:) and then:
Enter clipping option [ON/OFF/Delete/New boundary] <New>:
- New boundary: if there is one already,
Delete old boundary? [Yes/No] <Yes>:. The command line states the mode (Outside mode: what is outside the boundary disappears).Specify clipping type [Polygonal/Rectangular/Invert clip] <Rectangular>:— Rectangular asks for the two corners; Polygonal, the points (U undoes the last one, Enter closes); Invert clip switches to Inside mode (what is inside disappears) and asks for the type again. - ON and OFF keep the boundary; Delete removes the clipping.

PDFCLIP is the same, for PDF underlays.
Adjustments (IMAGEADJUST, TRANSPARENCY, PDFADJUST)
- IMAGEADJUST: the Image Adjust dialog with Brightness (default 50), Contrast (default 50) and Fade (default 0, blends with the background color); Reset returns to the defaults.
- TRANSPARENCY:
Enter transparency mode [ON/OFF] <OFF>:. When off, the transparent background of the image takes the screen background color (or white on the sheet). - PDFADJUST:
[Fade/Contrast/Monochrome/AdjustColorForBackground] <Fade>:. Fade goes from 0 to 100 (default 25) and contrast from 0 to 100 (default 75, which shows the PDF as it is; below that the colors move toward gray, above it they move away from it); fade and contrast apply equally to the lines and to the photos inside the PDF. Monochrome removes the color and leaves lines and photos in shades of gray by luminance, starting from black on a light background (on a dark background, inverted: the darkest becomes light). With AdjustColorForBackground on, on a dark background the lightness of the PDF colors is inverted, keeping the hue (black becomes white, dark blue becomes light blue, pure red stays), so that a drawing made for white paper shows up; it applies equally to the lines and to the photos inside the PDF. On a light background and in the plot (white paper) nothing changes.
Attaching a PDF (PDFATTACH)
PDFATTACH opens the Attach PDF Underlay dialog: the name (the file name with the page number), the path type, the page (with its size in inches), the point, the scale and the rotation.

The default scale puts the page at real size: one PDF inch is 25.4 units in a drawing in millimeters and 0.0254 in a drawing in meters. The page is read by the BadBit CAD PDF reader (the same one as PDFIMPORT) in a thread and drawn as geometry, with fade and contrast; the raster images inside the PDF (photos, logos, the scanned plan) also appear, underneath its lines. Fade takes the colors toward the background color, as in AutoCAD (on a dark background the lines get darker; on a light one, lighter). Photos inside the PDF can be in JPEG, JPEG 2000 (common in maps and scanned plans), JBIG2 or CCITT (Group 3 and 4 fax, common in black-and-white scanned documents): all of them appear. The inverted clipping of PDFCLIP (or XCLIP) removes from the photos inside the PDF what is inside the boundary, as it already did with the lines. PDFLAYERS turns the layers of the PDF on and off (the layers turned off are kept in the reference). With PDFOSNAP 1, snaps (endpoint, midpoint, center, intersection...) pick the geometry of the PDF.

Converting the PDF underlay into geometry (PDFIMPORT)
With a PDF underlay in the drawing, PDFIMPORT asks which one (or File, Enter, to choose another PDF as before). The underlay's page is converted with its scale, rotation and position, and the lines, texts and areas come into the drawing as a single undo step, on the PDF layers. The underlay remains in the drawing.
PDFIMPORT (from the underlay or from a file) also brings:
- the PDF raster images: each one is saved as a PNG next to the drawing (in the drawing folder, named
<PDF name>_imagem1.png,..._imagem2.png; with no saved drawing, in the PDF folder) and comes in as an attached IMAGE at its place, on thePDF_Imagenslayer (or on the PDF layer), as AutoCAD does. The command line says how many were saved. Photos in JPEG 2000, JBIG2 and fax (CCITT) come in like the others; an image the decoder cannot read (a rare feature it does not support, or a damaged file) is left out, with a warning stating the format; - simple shadings (two-color gradients, linear and radial) as a gradient hatch;
- an encrypted PDF (password protected) is not read, with the message
This PDF is password protected or encrypted, and BadBit does not read encrypted PDFs. Open it in the program that created it, save an unprotected copy and try again.
The External References manager (IMAGE)
IMAGE (or XREF) opens the External References manager, which also lists the attached images and PDFs: the name, the status (Loaded, Unloaded, Not Found, Unreferenced), the type (Image or PDF), how many references and the path. A definition whose last image was erased stays in the list as Unreferenced (with 0 references), as in AutoCAD, and goes into DXF and DWG when saving; Detach removes it for good. The Attach Image... and Attach PDF... buttons attach; with one chosen, Reload (reads the file again), Unload (disappears from the screen and from memory, the frame remains), Detach (removes all references) and the Saved path (change the path of all references of the definition).

Plotting
Images come out in the plot (PLOT, EXPORTPDF, EXPORTSVG, EXPORTPNG) with their clipping and adjustments: in PDF as an image (with transparency), in SVG as an embedded PNG and in PNG through the same rasterizer as the screen. The frame with IMAGEFRAME 2 does not plot. A PDF underlay plots as geometry.
DXF and DWG
The image goes into DXF and DWG like AutoCAD's: the IMAGE with the IMAGEDEF (in the ACAD_IMAGE_DICT dictionary), the IMAGEDEF_REACTOR and the RASTERVARIABLES; the PDF as a PDFUNDERLAY with the PDFDEFINITION (in ACAD_PDFDEFINITIONS). Inverted clipping before DXF/DWG 2010 and the PDF layers turned off go in BadBit CAD's XDATA (AutoCAD in those versions shows the normal clipping). The PDF page size is not in the file: when opening, BadBit CAD reads it from the PDF. IMAGEFRAME goes into RASTERVARIABLES and comes back when opening; unreferenced definitions come back to the dictionary; draw order goes into the order of the entities and into SORTENTSTABLE.
Transmittal package (ETRANSMIT)
ETRANSMIT (the drawing must be saved) opens the Create Transmittal dialog:

- Files Tree and Files Table: the drawing, the external references (and those inside them), the images, the PDF underlays, the SHX fonts (and big fonts) and TrueType fonts of the text styles, the pen tables (the
.ctb/.stbfiles themselves, found in the drawing folder, in itsPlot Stylesfolder or in thePlot Stylesfolders of AutoCAD on the computer; only one that is not found is regenerated from the profile), the sheet sets (.dst, when the drawing came from an AutoCAD sheet set), the data link spreadsheets (the.xlsx/.xls/.csvfiles of DATALINK) and the data files (the.patfiles of hatch patterns that are not BadBit CAD's, in the drawing folder). What is not found is shown in red and goes into the report. - Notes: go into the report.
- Transmittal setup: named setups are kept in the profile (Save, Delete). Transmittal package type: Zip or Folder. File format: Keep existing file formats (DWG and DXF in the source version;
.bbdas it is) or DWG 2018/2013/2010/2007/2004/2000 or DXF 2018. Folders: Use organized folder structure (what is in the drawing folder keeps its relative path; the rest goes toxrefs/,imagens/,fontes/,penas/,folhas/,dados/) or Place all files in one folder. Bind external references (BIND: they come into the drawing and do not go as files). - View Report shows the report; OK builds the package in a thread (the
.zipor the folder, with the drawing saved again with the package's relative paths and the.txtreport with the drawing's name). The path of the sheet set (.dst) and that of the data link spreadsheets stored in the drawing are also rebuilt for their place in the package (relative to the drawing), and the package drawing carries the thumbnail of the current view, as when saving (in.bbdtoo). The package's.bbdis a new file, but it carries everything "Save As" carries: the objects, components and preferences from a newer BadBit CAD version that this version kept without displaying come back unchanged in the package.
Password (SECURITYOPTIONS)
SECURITYOPTIONS opens the Security Options dialog: the password to open the drawing, the confirmation and Encrypt drawing properties (the preview and the summary too). The password applies at the next save in DWG 2004, 2007, 2010, 2013 and 2018; with no password, the drawing is saved unprotected. DWG 2000 has no password (AutoCAD 2000 did not protect drawings): it is saved without protection, with the warning DWG 2000 has no password (AutoCAD 2000 did not protect drawings): the file will be saved without protection. on the command line.

When opening a password-protected DWG, BadBit CAD asks for the password in a dialog; a wrong one shows Invalid password. Please enter the password again. and asks again. A drawing opened with a password keeps it when saving. The protection format follows the ODA open specification; what it does not describe is assumed (see docs/formatos/dwg-senha.md) and still needs to be checked in AutoCAD.