Hi Pdfbox team, Regarding your previous response on the thread here: https://lists.apache.org/thread/pn1hvwvlszz9h74gy9vv7nx7gt30qlbt, we've made customizations to the PDFBox classes. Please refer to the attached document for details of the changes.
As a result, we can now able to display various language characters in PDFs opened via web browsers. However, we've encountered an issue where these characters are not visible when the PDF is opened using Adobe Acrobat Reader (version 2024.002.20933). Could you please advise on how we might resolve this issue? Thank You, Anil -----Original Message----- From: Tilman Hausherr <thaush...@t-online.de> Sent: Tuesday, June 18, 2024 11:52 AM To: Anil Basavaraju <abasavar...@accurate.com> Subject: Re: File size issue when we use arial-unicode-ms font with pdfbox [You don't often get email from thaush...@t-online.de. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. Hi, There were two answers. If you did subscribe to the mailing list you should have seen them https://lists.apache.org/thread/t3w9k93k015wzzpnt4mvhbcozt924t9y https://lists.apache.org/thread/pn1hvwvlszz9h74gy9vv7nx7gt30qlbt Tilman On 18.06.2024 07:29, Anil Basavaraju wrote: > Hi Pdfbox team, > > Any update on this? > > Thank You, > Anil B > > From: Anil Basavaraju > Sent: Monday, June 3, 2024 5:54 PM > To: users@pdfbox.apache.org > Cc: Sudarshan Desai <sde...@accurate.com> > Subject: RE: File size issue when we use arial-unicode-ms font with > pdfbox > > Hi Pdfbox team, > > Can you please check our request below. > > Thank You, > Anil B > > From: Anil Basavaraju > Sent: Thursday, May 30, 2024 9:06 PM > To: users@pdfbox.apache.org<mailto:users@pdfbox.apache.org> > Cc: Sudarshan Desai <sde...@accurate.com<mailto:sde...@accurate.com>> > Subject: File size issue when we use arial-unicode-ms font with pdfbox > > Hi Pdfbox team, > > We have a requirement to prefill the pdf with different languages including > CJK (Chinese, Japanese, Korean) and some special characters. > So we embedded arial-unicode-ms.ttf with pdfbox. The ttf file is about 22.7 > MB. We are able to prefill the pdf form with the languages and special > characters. > But the issue is the size of the pdf file becomes around 27 MB. Before > prefilling the pdf file size is around 2 MB. > We need to upload this pdf file after prefilling, which is taking more time > which is not a good user experience. > Is there any way where we can reduce the pdf file size using pdfbox? > > Note: If we use any other font/ttf file which is smaller in size, it is not > supporting CJK. > > Thanks, > Anil >
PDTextField ----------------------------- public String getValue() { return getStringOrStream(getInheritableAttribute(COSName.getPDFName("F1"))); } @Override public String getValueAsString() { return getValue(); } @Override void constructAppearances() throws IOException { AppearanceGeneratorHelper apHelper = new AppearanceGeneratorHelper(this); apHelper.setCustomFont(customFont); apHelper.setAppearanceValue1(getValueAsString()); } AppearenceGeneraterHelper -------------------------------------- public void setAppearanceValue1(String value) throws IOException { PDAppearanceStream appearanceStream = new PDAppearanceStream(pdTerminalField.getAcroForm().getDocument()); PDResources resources = new PDResources(); appearanceStream.setResources(resources); PDFont font = customFont != null ? customFont : pdTerminalField.getAcroForm().getDefaultResources().getFont(COSName.getPDFName("F1")); resources.put(COSName.getPDFName("F1"), font); try (PDPageContentStream contentStream = new PDPageContentStream(pdTerminalField.getAcroForm().getDocument(), appearanceStream)) { contentStream.setFont(font, 10); contentStream.beginText(); contentStream.showText(value); contentStream.endText(); } PDAppearanceDictionary pdAppearanceDictionary = new PDAppearanceDictionary(); pdAppearanceDictionary.setNormalAppearance(appearanceStream); pdTerminalField.getWidgets().get(0).setAppearance(pdAppearanceDictionary); } Java Class ----------------------------- File primaryFile = new File("src/main/resources/arial-unicode-ms.ttf");
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org