PDFig — PDF Importer for Figma
Author: Valeriy Isachenkov
Version: 1.1.1

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HOW TO INSTALL (Development mode)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

1. Unpack this folder somewhere permanent — NOT the Desktop, NOT Downloads,
   and NOT a OneDrive-synced folder. Figma remembers the absolute path and
   stops working if the folder is moved, renamed or synced away.
   A good place: C:\FigmaPlugins\PDFig\  or  ~/FigmaPlugins/PDFig/
2. Open Figma Desktop (the web version does not support local plugins)
3. Go to Plugins → Development → Import plugin from manifest...
4. Select the file: manifest.json (in this folder)
5. The plugin will appear under Plugins → Development → PDFig

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HOW TO USE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

1. Open the plugin: Plugins → Development → PDFig
2. Drop a PDF file onto the drop zone (or click to browse)
3. Select which pages to import
4. Optional: check "Editable text" to import text as real text nodes
   (missing fonts can be substituted before the import starts)
5. Click Import
6. Each PDF page becomes a separate Figma Frame on the canvas

The Export tab does the opposite: selected frames → a single PDF, or a PPTX
with a PNG background per slide and optional editable text on top.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHAT'S NEW IN 1.1.1
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

- Pages using Type3 fonts are imported as vector. Those fonts are drawing
  procedures — the glyphs are already part of the page graphics, so the
  editable layer on top was a second, garbled copy of the same words sitting
  over the real ones. Such pages are now listed in the report instead.
- The text is cross-checked against a second reading of the page: when the
  page clearly contains non-Latin letters and the text walker returns none,
  the encoding is broken (Cyrillic arriving as "A:>;L:>" is plain ASCII, so
  the earlier garbled-character check could not see it) and the page is kept
  as vector.
- Type3 fonts no longer appear in the font-substitution dialog under names
  like "Type3 (95 0 R)" — there is nothing to substitute.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHAT'S NEW IN 1.1
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

- Hidden text layers (scan OCR) are no longer imported as visible text.
  This was the cause of pages arriving with text duplicated on top of the
  scan. A checkbox brings the old behaviour back when the OCR layer is
  actually wanted.
- Pages whose fonts have no usable Unicode mapping are kept as vector
  instead of producing garbled characters, and the page is listed in the
  report at the end of the import.
- Text is split by style: a heading whose first word has a different colour
  or size now becomes separate text nodes with the original colours, rather
  than one node repainted in the majority colour.
- Colours are read correctly from CMYK and greyscale documents.
- Pages are extracted and handed over one at a time, so large documents no
  longer build the whole file in memory at once.
- MuPDF objects are released after every page — long imports no longer grow
  in memory until the plugin stalls.
- One failed page no longer aborts the rest of the import; failures and
  warnings are listed on the final screen.
- Standard PDF font names (Helvetica, ArialMT, TimesNewRomanPSMT, Nimbus…)
  are mapped to the fonts those names actually mean.
- PPTX export: text boxes are positioned relative to the frame, so text no
  longer drifts by the frame's position on the canvas.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
NOTES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

- Vectors, images, and text (as paths) are fully supported
- Editable text mode preserves font sizes, line heights, and colours
- If a PDF font is not installed in Figma, you'll be prompted to choose
  a replacement from your available fonts
- Text used as a clipping mask in the PDF is imported as ordinary text
- Very large PDFs (40+ pages) may take a moment to process
- All processing happens locally — no data is sent to any server

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CONTENTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

manifest.json         — Figma plugin manifest (point Figma here)
dist/plugin/main.js   — Plugin main thread
dist/ui/index.html    — Plugin UI (self-contained)
dist/ui/mupdf-wasm.*  — PDF rendering engine (MuPDF WASM)
icon.png / icon.svg   — Plugin icon
