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

How add replacement_font option to command #281

Closed
Sak1s opened this issue Apr 1, 2022 · 5 comments
Closed

How add replacement_font option to command #281

Sak1s opened this issue Apr 1, 2022 · 5 comments

Comments

@Sak1s
Copy link

Sak1s commented Apr 1, 2022

Hello everyone

can anyone help me how to pass the replacement_font parameter to the following example

$pdf = new Pdf('/path/example.pdf', [
'command' => '/usr/bin/pdftk',
'useExec' => true,
]);

$pdf->fillForm($fields)
->needAppearances()
->flatten();

$pdf->saveAs(/path/output.pdf)

@Sak1s
Copy link
Author

Sak1s commented Apr 1, 2022

i add the following before $pdf->saveAs(/path/output.pdf) and seems that is working.

$pdf->getCommand()
->addOption('replacement_font', "/path/arial.ttf");

@mikehaertl
Copy link
Owner

@Sak1s I've added another utility method for this. Could you maybe help testing it (see MR above)?

$pdf = new Pdf('/full/path/to/form.pdf');
$result = $pdf->fillForm($data)
    ->replacementFont('/usr/share/fonts/dejavu/DejaVuSans.ttf')
    ->saveAs('filled.pdf');

@Sak1s
Copy link
Author

Sak1s commented Apr 4, 2022

Hello @mikehaertl

I test it and works fine . Thank you

@mikehaertl
Copy link
Owner

Great. I've released 0.12.0 containing this change. Thanks for the pointer to this new method.

mikehaertl added a commit that referenced this issue Jul 7, 2022
Issue #281 Implement `replacementFont($font)` (requires pdftk-java >= 3.3.0)
@mikehaertl
Copy link
Owner

Hmm, seems like nobody noticed that I forgot to merge my MR before releasing 0.12.0. I've now created 0.12.1 which this time really includes this new method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants