Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fill: override font for filling #715

Open
maocatooo opened this issue Sep 22, 2023 · 3 comments
Open

fill: override font for filling #715

maocatooo opened this issue Sep 22, 2023 · 3 comments
Assignees

Comments

@maocatooo
Copy link

Thank you for submitting a possible bug!

Please ensure the following:

  • Your issue is based on the latest commit
  • State your OS and OS version
  • When reporting a problem with a specific PDF input file please avoid stating the organization responsible for the PDFWriter - just refer to the PDFWriter

os: windows11
pdfcpu: 0.5.0

I am from China, and I have configured the form with Chinese fonts. How should I fill it?

I have tried using api.FillForm to populate it and have set up local fonts through api.InstallFonts. However, I have noticed that regardless of how I change the font in the PDF form, the font read by pdfcpu is always 'SimSun,' which corresponds to the GBK-EUC-H encoding.

@maocatooo maocatooo changed the title how to fill forms by set my How to fill the form with Chinese content Sep 22, 2023
@hhrutter
Copy link
Collaborator

this is interesting.
Can you share a simple example form and the corresponding fill.json and point me to the font you would like to use.

Then I can reproduce, analyze and fix this which I am pretty sure is a bug.

Thank you for using pdfcpu 💚

@maocatooo
Copy link
Author

https://github.com/maocatooo/pdfcpu_example

I'm sorry for keeping you waiting for so long.

I have uploaded my sample to GitHub, which includes the incorrect methods I've been using, along with the corresponding PDF and fonts. I've also included a successful example using the pdfcpu test. Please help me identify where the issue is.

Thank you once again for your assistance.

@hhrutter
Copy link
Collaborator

Hello!

This sample form was created especially to be filled using UnifontMedium:

7: was compressed 52[7] generation=0 types.Dict type=Font subType=Type0
<<
	<BaseFont, UnifontMedium>
	<DescendantFonts, [(44 0 R)]>
	<Encoding, UniGB-UTF16-H>
	<Name, UnifontMedium>
	<Subtype, Type0>
	<Type, Font>
>>

if you want to fill this form using pdfcpu you have to have UnifontMedium installed as a pdfcpu user font.
Right now there is no other way.

What we need is a way to specify an alternative fill font during filling and in the fill.json.
This part is still missing :(

Do you think you can provide me with a simple, genuine chinese PDF form.
Maybe you can also point me to 2 different popular chinese fonts used for PDF form filling.
And then you fill this test form once with font A and then with font B and send me the resulting 2 PDFs.
Providing support for this issue will be much easier.
Thank you.

@hhrutter hhrutter changed the title How to fill the form with Chinese content fill: override font for filling Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants