0X8004006C

DV_E_DVTARGETDEVICE_SIZE (0X8004006C): tdSize Invalid

Windows Errors Intermediate 👁 6 views 📅 May 27, 2026

The tdSize in a DVTARGETDEVICE structure doesn't match its actual size. Usually from bad clipboard data or printer driver mismatches.

1. Corrupted Clipboard Data — The Most Common Trigger

What's actually happening here is that an application copied a DVTARGETDEVICE structure into the clipboard with a tdSize that doesn't match the real memory footprint of the structure. The OLE APIs that read it back—like OleSetClipboard or IDataObject::GetData—validate tdSize against the actual size of the data in the clipboard's global memory handle. If they disagree, you get 0x8004006C.

This usually happens after you've copied something from a buggy app (old Office versions, some CAD tools, or misbehaving screen capture software) and then try to paste into another app that inspects the clipboard metadata. The real-world trigger? Copying a chart from Excel 2010 and pasting into an older Word document while a custom printer driver is active.

  1. Press Win + R, type clipbrd (Windows 10/11) — if that doesn't work, use Start > Settings > System > Clipboard > Clear clipboard data.
  2. Clear the clipboard. On Win10/11, also toggle Clipboard history off and on again under the same settings pane.
  3. Restart the app that showed the error. The fix works because clearing the clipboard removes the malformed DVTARGETDEVICE structure entirely.

If the error persists, reboot. Some apps cache clipboard data in memory that survives a simple clear.

2. Printer Driver Mismatch — tdSize Too Large or Too Small

The DVTARGETDEVICE structure is printer-specific — it includes a tdDeviceName (the printer name), tdDriverName (the driver name), and tdPortName (the port). If your printer driver version or name changes between when the structure was created and when it's read, tdSize no longer reflects the actual size of those strings.

For example: you copy a document layout from a printer named "HP LaserJet 400 MFP on LPT1" with a v4 driver, then later the printer gets updated to a v3 driver (or vice versa). The structure's tdSize might be computed based on the old driver's string sizes, but the new driver returns different lengths — causing the validation to fail.

  1. Open Control Panel > Devices and Printers.
  2. Right-click your default printer and select Printer properties.
  3. Go to the Advanced tab and note the driver name. If you see a mismatch (e.g., v4 vs v3), uninstall the printer entirely.
  4. Re-add the printer using the Add a printer wizard. Do not import old settings — let it install fresh.
  5. Restart the application that errored.

Skip the registry edit that some blogs suggest — digging into HKEY_CURRENT_USER\Printers to adjust tdSize manually is risky and rarely fixes the root cause. The real fix is a clean driver install that produces consistent structure sizes.

3. Broken OLE Object in Documents — The Sneaky Cause

Sometimes the error shows up not from clipboard operations, but when opening a document containing an embedded OLE object (like an Excel sheet inside a Word doc). The OLE object's storage includes a DVTARGETDEVICE structure serialized with the wrong tdSize — often because the document was saved in a different version of the source app, or the object was created by a third-party app that didn't follow the spec.

The reason step 3 works is that re-embedding the object forces the source application to reconstruct the DVTARGETDEVICE from scratch, using the current printer driver and environment, so tdSize will be correct.

  1. Open the document that triggers the error.
  2. Right-click the embedded object (e.g., an Excel chart) and choose Object > Convert.
  3. In the Convert dialog, select Convert to and pick the same type (e.g., Microsoft Excel Worksheet).
  4. Check OK. This re-creates the OLE object and its accompanying DVTARGETDEVICE with correct sizing.
  5. Save the document under a new name.

If the object can't be converted, delete it and re-insert it fresh from the source file. That's more work, but it's the nuclear option that always works.

Quick-Reference Summary Table

CauseSymptomFix
Corrupted clipboard dataError on paste, after copy from buggy appClear clipboard history, restart app
Printer driver mismatchError when printing or previewing with printer-specific dataReinstall printer driver fresh
Broken OLE objectError on document open, not on clipboardConvert or re-embed the OLE object

One last thing: if you're a developer and you're seeing this in your own code, check that your tdSize field is set to sizeof(DVTARGETDEVICE) + strlen(tdDeviceName) + strlen(tdDriverName) + strlen(tdPortName) + 3 (the +3 for null terminators). The spec says tdSize is the total structure size in bytes, including any trailing strings. Get that wrong, and you'll fire 0x8004006C every time.

Was this solution helpful?