Project

General

Profile

Actions

Support #23261

open

kanji is not appearing

Added by Marilyn Weber 4 months ago. Updated 16 days ago.

Status:
New
Priority name:
Normal
Assignee:
-
Category name:
WordPress Plugins
Target version:
Start date:
2025-08-26
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

In the message below one of our authors is pointing out some issues we are having with rendering the pdf version of their article. They are seeing extra pages and the kanji is not appearing. I tried a few solutions with DKpdf but it is not working. I also went through the post to try to find anything strange in the html but have not come up with anything yet. Do you think you could take a look? This is the post.

https://pirjournal.commons.gc.cuny.edu/2025/08/22/interdisciplinary-dialogue-between-puppeteer-and-researchers-reflections-on-the-2025-symposium-of-the-society-for-arts-and-anthropology/

And then I believe I have Scott and Laurie as admins but let me know if I need to add another permission.

Best,

Melissa Flower Gladney
From: yam <>
Sent: Monday, August 25, 2025 10:08 PM
To: Claudia Orenstein <>
Cc: Karen Smith <>; Melissa Flower Gladney <>
Subject: [EXTERNAL]Re: PIR article online review

ATTENTION: This email came from an external source. Do not open attachments or click on links from unknown senders or unexpected emails.

Dear Orenstein,
cc: Editors

Thank you for your message.
I sincerely appreciate the editors’ cooperation and patience.

Regarding the manuscript, there are minor issues in both the web and PDF versions. Please see the attached files, where I have added brief notes indicating the desired corrections.

The requests labeled 'web1–3' on the web version should also be applied to the corresponding sections in the PDF version.
The requests on the PDF version mainly concern garbled Japanese text and page break issues, which I believe do not occur in the web version.

Actions #1

Updated by Raymond Hoh 4 months ago

  • Category name set to WordPress Plugins
  • Target version set to 2.5.15

The DK PDF plugin currently doesn't support non-English page content properly by default.

I've temporarily added a code snippet to enable CJK support for DK PDF on the PIR Journal site. Can you ask the PIR Journal folks to see if that addresses their problems? If so, I will commit the fix to production.

Boone, here's the code snippet:

add_filter(
    'dkpdf_mpdf_config',
    function( $retval ) {
        $retval['mode'] = '+aCJK';
        $retval['autoScriptToLang'] = true;
        $retval['autoLangToFont'] = true;
        return $retval;
    }
);

DK PDF uses the mPDF library to generate the PDF. The variables used in the code snippet are outlined on the mPDF documentation page: https://mpdf.github.io/reference/mpdf-variables/overview.html. The 'mode' = '+aCJK' portion addresses support for Chinese, Japanese and Korean characters when combined with the 'autoScriptToLang' and the 'autoLangToFont' variables.

Other Chinese, Japanese and Korean sites on the Commons could benefit from this, so this code snippet would probably work best as a separate plugin unless we code a special exception for the PIR Journal site.

Actions #2

Updated by Raymond Hoh 4 months ago

The additional pages in the PDF are due to the images used in the post content. See https://github.com/mpdf/mpdf/discussions/1523.

Not sure how to address this one without suggesting that the images in the post be cropped, but then that would interrupt the page layout on the site. It might be possible to force the PDF to use the cropped version of the images, but I'm just thinking out loud at the moment.

Actions #3

Updated by Boone Gorges 4 months ago

Ray, is there a reason why we can't just add the '+aCJK' across-the-board? Sites that aren't using any of these character sets would not be affected, right?

Regarding image-related layout issues in dkpdf, I think there's only so much we can do. We don't really have much control over this upstream library, and in any case it's not possible for us to automatically generate PDFs with the same layout quality as what you'd get if you manually built them. And we don't really have the capacity to diagnose problems like this in dkpdf.

Actions #4

Updated by Raymond Hoh 4 months ago

Ray, is there a reason why we can't just add the '+aCJK' across-the-board? Sites that aren't using any of these character sets would not be affected, right?

There is a performance hit when enabling the 'autoScriptToLang' and the 'autoLangToFont' variables due to how DK PDF / mPDF needs to run through the entire document to parse the content. See https://mpdf.github.io/fonts-languages/automatic-font-selection.html#using-text-with-multiple-languages. So having CJK support only enabled on sites where necessary is preferable.

Actions #5

Updated by Boone Gorges 4 months ago

  • Target version changed from 2.5.15 to 2.5.16
Actions #6

Updated by Boone Gorges 2 months ago

  • Target version changed from 2.5.16 to 2.5.17
Actions #7

Updated by Boone Gorges about 2 months ago

  • Target version changed from 2.5.17 to 2.6.1
Actions #8

Updated by Boone Gorges about 1 month ago

  • Target version changed from 2.6.1 to 2.6.2
Actions #9

Updated by Boone Gorges 30 days ago

  • Target version changed from 2.6.2 to 2.6.3
Actions #10

Updated by Boone Gorges 16 days ago

  • Target version changed from 2.6.3 to 2.6.4
Actions

Also available in: Atom PDF