Development of a 1C-Bitrix printed forms module

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1175
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Developing a Print Forms Module for 1C-Bitrix

Bitrix lacks built-in document generation mechanism. Orders can be printed via browser, but yield unformatted pages without details, signatures, and branding. Legally significant documents — invoice, packing list, act — must be created manually. Print forms module closes this gap: manager clicks button and gets PDF.

Required Documents

Typical e-commerce set:

  • Invoice — seller/buyer details, product table, total in words
  • Packing List TORG-12 — unified form with filled fields
  • Act of Services — for services
  • UPD — universal transfer document
  • Contract — with buyer data and order parameters

Document set determined per project.

PDF Generation Approaches

Approach 1: HTML → PDF via mPDF/TCPDF — Document template written as HTML/CSS, then converted to PDF. Easier to edit — designer works with standard HTML. Drawback: complex table forms with exact positioning render worse.

Approach 2: PhpSpreadsheet → XLSX/PDF — Document template is Excel file with cells and formulas. Data substituted into named cells, document saved as XLSX or converted to PDF. Perfect for precise table forms (TORG-12, UPD).

In practice, first approach for invoices/acts, second for packing lists.

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        # Sum in words
├── templates/                   # Document HTML templates
└── admin/                       # Admin pages

Data Substitution

Document data 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(),
        ];
        // ... more data
    }
}

Generation on Demand

In order admin page, "Download Invoice" button triggers:

GET /bitrix/admin/order_print.php?ORDER_ID=123&DOCUMENT=invoice

Script renders template, passes to renderer, returns PDF with appropriate headers.

Сроки разработки

Stage Duration
Base setup, Invoice + TORG-12 8–10 days
+ Act, UPD, Contract templates 12–16 days
+ Admin UI, batch generation, email sending 16–20 days