V
V
Vorchun2011-02-11 09:11:57
PDF
Vorchun, 2011-02-11 09:11:57

Problem with Russian in PDF form?

There is a site. It has a closed section with orders. There are quite a few different documents with simple formatting (contracts) and complex formatting (various forms and forms). Requirement: give site visitors completed documents in PDF.
Requirements: free libraries, PHP, no way to rebuild PHP There
were 2 solutions:

  • Make simple documents in html and convert to PDF using mpdf
  • Mark up complex shapes in OpenOffice, export to PDF, generate FDF and merge PDF and FDF with pdftk

There are no problems with the first. But the second option is more difficult.
At first I did it head-on: I marked up the document in OpenOffice, entered default values ​​for the test into the fields, exported it to PDF. I open the result: English letters are visible, and instead of Russian ones - coryabitsa. But! If you click in the field, then a normal Russian text appears.
I found on the net that I need to embed fonts. And it is desirable that they be in OTF format and in Unicode. Found, filled in, set the flag "embed fonts" when exporting. The result is the same as in the first option.
Began to search further. It is written that only Acrobat Pro should be used for markup. Found this program. Marked out. Entered test data. And for the test, they generated an FDF file directly from Acrobat. Now it's interesting:
  • if you open FDF with Adobe Reader, then he swears at security (I say that I agree) and then he opens the PDF and inserts the data correctly. But this option does not suit, because. the client must be given a ready-made, non-editable PDF
  • if using pdftk to cross PDF and FDF from Acrobat, then the field in the final file is empty. But if you click on it, then the data from the FDF will appear. Those. almost exactly what I need.

I also experimented with field visibility settings and read-only mode - nothing worked.
Has anyone managed to fill out PDF forms in Russian using PHP?
PS: I have 2 options left: a) compose forms in HTML (but there are doubts that mpdf will digest everything) b) translate complex forms into an intermediate format (TeX, SVG), and then get PDF (this is quite difficult and for a long time)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Savostin, 2011-02-11
@savostin

www.tcpdf.org/ will save you, IMHO.
In particular www.tcpdf.org/examples/example_006.phps and www.tcpdf.org/examples/example_014.phps (it seems to even support Javascript there)

A
Alexey, 2011-02-17
@alman

Your task is elementarily solved by report generators. For example FastReport.NET . Can generate HTML, PDF and many other formats on the fly.

D
dddeeemmmooonnn, 2019-03-20
@dddeeemmmooonnn

in pdftk something with fonts, there is no Russian and much more.
my solution - https://stackoverflow.com/a/55254071/10737395

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question