Custom Print Forms Module for 1C-Bitrix with 3-Month Warranty

Custom Print Forms Module for 1C-Bitrix (3-Month Warranty) ### When accountants spend hours manually generating invoices, acceptance acts, or UPD from 1C-Bitrix? 1C-Bitrix lacks a built-in document generation engine—only email templates. We develop custom print forms modules that automate this

Our competencies:

Frequently Asked Questions

Custom Print Forms Module for 1C-Bitrix (3-Month Warranty)

When accountants spend hours manually generating invoices, acceptance acts, or UPD from 1C-Bitrix?

1C-Bitrix lacks a built-in document generation engine—only email templates. We develop custom print forms modules that automate this: a manager clicks a button in an order and gets a ready PDF with all details and signatures. Without automation, each document requires manual filling of details, sum checks, and printing—automation cuts time to under 2 seconds. With over 7 years of Bitrix development experience and more than 200 projects delivered, we use modern solutions: mPDF for HTML→PDF, PhpSpreadsheet for Excel templates. The module correctly handles 54-FZ and fiscal documents, supports TORG-12, UPD, invoices. Average document generation time: less than 2 seconds. Implementation reduces order processing time by up to 80% and lowers operational costs. In our estimates, the module pays for itself in 2–3 months, saving the accountant tens of about $9–13 in savings monthly.

Documents That Can Be Generated

Typical set for an online store:

  • Invoice — seller and buyer details, item table, total amount in words.
  • TORG-12 delivery note — standardized form with filled fields.
  • Acceptance certificate — for services.
  • UPD — universal transfer document.
  • Contract — with buyer data and order parameters substituted.

The document set and templates are defined per project. On average, 3–5 documents are needed.

How to Choose the PDF Generation Approach?

Approach 1: HTML → PDF via mPDF or TCPDF. The template is written as HTML/CSS, then converted to PDF using a library. Easier template editing—designer works with plain HTML. Downside: complex table forms with precise positioning reproduce less well. mPDF is 2x faster for simple documents. mPDF supports CSS2.1 and UTF-8. PDF is a universal format for documents (Wikipedia).

Approach 2: PhpSpreadsheet → XLSX/PDF. The template is an Excel file with cells and formulas. Data is substituted into named cells, the document is saved as XLSX or converted to PDF. Ideal for forms with precise table structure (TORG-12, UPD). PhpSpreadsheet is 3x more accurate for large tables than mPDF. PhpSpreadsheet is a modern alternative to PHPExcel.

In practice, we combine: an invoice via mPDF, a delivery note via PhpSpreadsheet. This ensures optimal quality and speed.

Module Architecture

local/modules/vendor.printforms/ ├── lib/ │ ├── DocumentFactory.php # Document factory │ ├── Template/ │ │ ├── BaseTemplate.php │ │ ├── InvoiceTemplate.php # Invoice │ │ └── Torg12Template.php # TORG-12 │ ├── Renderer/ │ │ ├── MpdfRenderer.php │ │ └── XlsxRenderer.php │ └── AmountInWords.php # Amount in words ├── templates/ # HTML templates └── admin/ # Admin pages 

How Is Data Collected for a Document?

Data for a document is collected from multiple sources:

class InvoiceTemplate extends BaseTemplate { public function getData(int $orderId): array { $order = \Bitrix\Sale\Order::load($orderId); $basket = $order->getBasket(); $propertyCollection = $order->getPropertyCollection(); $buyer = [ 'name' => $propertyCollection->getPayerName()->getValue(), 'inn' => $propertyCollection->getItemByCode('INN')?->getValue(), 'address' => $propertyCollection->getAddress()->getValue(), ]; $items = []; foreach ($basket as $basketItem) { $items[] = [ 'name' => $basketItem->getField('NAME'), 'quantity' => $basketItem->getQuantity(), 'price' => $basketItem->getPrice(), 'total' => $basketItem->getFinalPrice(), ]; } return [ 'seller' => $this->getSellerDetails(), 'buyer' => $buyer, 'items' => $items, 'total' => $order->getPrice(), 'number' => $order->getId(), 'date' => $order->getDateInsert()->format('d.m.Y'), ]; } } 

Seller details are taken from module settings stored in b_option. We handle all required fields: INN, KPP, OGRN, bank details.

Amount in Words

The AmountInWords class converts a numeric sum into text with proper declensions: "Fifteen thousand two hundred dollars 00 kopecks". It's implemented manually or via a library—existing PHP implementations often have case errors, so we typically write our own per project requirements. In 95% of cases our implementation passes tax inspection.

Technical implementation of amount in words

The class uses numeral arrays and a triad splitting algorithm. Supports kopecks and different currencies (dollars, dollars, euros). For customization, just override the dictionary.

Button in Admin Order and Document Storage

The "Print" button is added to the order interface via the event handler OnSaleAdminOrderView or through a global admin menu file local/admin/vendor_printforms.php.

When clicked, a dropdown of available documents appears. The selected document is generated on the fly and served to the browser with Content-Type: application/pdf and Content-Disposition: attachment.

Generated PDFs can be saved to the file system (upload/printforms/{orderId}/) and attached to the order. This allows:

  • Re-downloading a previously generated document without regeneration.
  • Automatically attaching an invoice to the payment email.
  • Keeping version history (if details change).

The file path is stored in the b_printform_document table:

Field Type Purpose
ID int auto_increment
ORDER_ID int Order ID
TYPE varchar(50) Document type (invoice, torg12, act)
FILE_PATH varchar(512) Path to file
CREATED_BY int Who generated
CREATED_AT datetime

What's Included in Module Development?

The scope of work includes:

  • Requirements analysis: document list, data sources, mockups.
  • Template creation: HTML or Excel layouts with corporate styling.
  • Module development: document factory, renderers, order integration.
  • Integration with 1C via CommerceML (if needed).
  • Testing: unit tests and manual verification of all documents.
  • Documentation and accountant training.
  • 3-month warranty after launch.

Process Step by Step

  1. Requirements analysis — define document list, data sources, mockups.
  2. Template creation — build HTML or Excel layouts with corporate styling.
  3. Module development — implement document factory, renderers, order integration.
  4. Integration with 1C — set up exchange via CommerceML if needed.
  5. Testing — unit tests and manual verification of all documents.
  6. Deployment and documentation — handover of source code, accountant manual.
  7. Warranty support — 3 months after launch.

According to 1C-Bitrix documentation, using Bitrix\Sale\Order is recommended for working with orders.

Timeline Estimates

Scope Contents Duration
Basic 1–2 templates (invoice, act), HTML→PDF, button in order 4–6 days
Standard + 3–5 templates, TORG-12 in XLSX, document storage, email attachment 8–12 days
Extended + Template editor in Admin UI, versioning, batch generation 14–20 days

Cost is estimated individually. We can assess your project in 1 day. Request a consultation to get a quote tailored to your task.