Hi Team,
We are converting a word file to pdf where in first page in word a paragraph is of 5 lines gets converted into 6 lines This causes formatting issue in final pdf.
Paragraph in word file -
Paragraph in pdf -
Sample document -
rde30213096.docx (1.0 MB)
Thanks
@forasposeissues Most likely the problem on your side occurs because the fonts used in your input document are not available on the machine where document is processed. The fonts are required to build document layout. If Aspose.Words cannot find the font used in the document, the font is substituted. This might lead into fonts mismatch and document layout differences due to the different fonts metrics. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/
The following fonts used in your document are not available on my side:
- ‘Citi Sans Text’
- ‘Citi Serif Display’
- ‘Citi Sans Condensed’
- ‘MS Shell Dlg 2’
Hi,
Custom Fonts.zip (857.4 KB)
Please try with these missing custom fonts.
Thanks
@forasposeissues Thank you for additional information. unfortunately, I cannot reproduce the problem after using the provided fonts. I have used the following simple code for testing:
Document doc = new Document(@"C:\Temp\in.docx");
doc.FontSettings = new FontSettings();
doc.FontSettings.SetFontsSources(new FontSourceBase[] { new SystemFontSource(), new FolderFontSource(@"C:\Temp\fonts", true) });
doc.Save(@"C:\Temp\out.pdf");
Here is the output PDF produced on my side: out.pdf (1.4 MB)
Hi,
As we can see in out.pdf you sent the second paragraph has 6 lines.
But in word document which I sent the paragraph is of 5 lines.
@forasposeissues Could you please save the document as PDF using MS Word on your side and attach it here for our reference? The difference can be caused by different fonts available on machine where the document is viewed in MS Word and on the machine where the document is converted to PDF using Aspose.Words.
rde30213096.pdf (4.5 MB)
Yes, When the document when saved on MS Word as pdf we do not see the issue as you can see in attached pdf. But when converting using Aspose library from word to pdf we see the paragraph size increasing.
@forasposeissues In the attached document CitiSans
font is not used. So it looks like the font is not available on the machine where you convert document to PDF using MS Word. MS Word substituted this font and that is why the rendering result is different:
As you mentioned that : In the attached document CitiSans font is not used. So it looks like the font is not available on the machine where you convert document to PDF using MS Word. MS Word substituted this font and that is why the rendering result is different.
But, I don’t see any font substitued font when MS word is converted into pdf. except (Font substitution: Font ‘MS Shell Dlg 2’ has not been found. Using ‘Tahoma’ font instead. Reason: font info substitution). Also, please find the log detail for the reference
Actual Result: MSWord and pdf are not identical
Expected Result: MSWord and pdf should be identical
I am sharing the MSword,pdf, font and log file.
Team, Please help to here.
This issue is creating noise on our all environment.
issue.zip (430.1 KB)
issue_msword
issue_pdf
Please refer the screenshot in which MSword paragraph is not similar with PDF
@forasposeissues The screenshots attached in your previous post were related to the above mentioned thread. The screenshots provided in your last post seems are not related to the above attached document. At least I cannot see the mentioned problem in the output PDF. Please make sure you have attached the correct document and screenthos.
Hi Team,
Both, previous post issue and latest post issue are similar. But, there inputs are different.
I am sharing some screenshot related to latest .
In the screenshot I have highlighted the issue.
Please find screenshot
screenshot.zip (1.0 MB)
Appreciate for help.
Thanks
@forasposeissues Unfortunately, I cannot reproduce the problem on my side using the latest 24.5 version of Aspose.Words and the following code:
// Open a document
Document doc = new Document("in.docx");
// When text shaper factory is set, layout starts to use OpenType features.
// An Instance property returns static BasicTextShaperCache object wrapping HarfBuzzTextShaperFactory
doc.getLayoutOptions().setTextShaperFactory(com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getInstance());
// Render the document to PDF format
doc.save("out.pdf");
See more about advanced typograph features in the documentation:
https://docs.aspose.com/words/java/enable-opentype-features/
Thanks for quick Update!
We will check and let you know if we face any issue.
Also, Please help to suggest which version of aspose words shaping we should use. To support the advanced typography.
@forasposeissues You should use the same version as version of Aspose.Words:
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>24.5</version>
<classifier>jdk17</classifier>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>24.5</version>
<classifier>shaping-harfbuzz-plugin</classifier>
</dependency>
Hi Team,
We are facing build issue while running our test case for shaping harfbuzz plugin.
Kindly assist
java.lang.UnsatisfiedLinkError: 'long com.aspose.words.shaping.harfbuzz.HB.hb_buffer_create(int)'
at com.aspose.words.shaping.harfbuzz.HB.hb_buffer_create(Native Method)
at com.aspose.words.shaping.harfbuzz.zzS.<init>(Unknown Source)
at com.aspose.words.shaping.harfbuzz.zzZ51.zzS(Unknown Source)
at com.aspose.words.shaping.harfbuzz.zzZ51.zzS(Unknown Source)
at com.aspose.words.shaping.harfbuzz.zzZ51.shapeText(Unknown Source)
at com.aspose.words.zzVWt.zzFH(Unknown Source)
at com.aspose.words.zzVWt.zzFH(Unknown Source)
at com.aspose.words.zzVTl.zzZZO(Unknown Source)
at com.aspose.words.zzVTl.zzXx5(Unknown Source)
at com.aspose.words.zzZ59.zzXx5(Unknown Source)
at com.aspose.words.zzXb.zzWZd(Unknown Source)
at com.aspose.words.zzYvR.zzZ4x(Unknown Source)
at com.aspose.words.zzYvR.zzg(Unknown Source)
at com.aspose.words.zzXb.zzg(Unknown Source)
at com.aspose.words.zzZvJ.zzVWZ(Unknown Source)
at com.aspose.words.zzZvJ.zzWDH(Unknown Source)
at com.aspose.words.zzZvJ.zzZw9(Unknown Source)
at com.aspose.words.zzX9j.zzFH(Unknown Source)
at com.aspose.words.zzX9j.zzX2I(Unknown Source)
at com.aspose.words.zzYK2.zzW4B(Unknown Source)
at com.aspose.words.zzYK2.zzWXy(Unknown Source)
at com.aspose.words.zzZOc.zzZAc(Unknown Source)
at com.aspose.words.zzZOc.zzZCJ(Unknown Source)
at com.aspose.words.zzZOc.zzWdb(Unknown Source)
at com.aspose.words.zzWPc.zzXgO(Unknown Source)
at com.aspose.words.zzWPc.zzWdb(Unknown Source)
at com.aspose.words.zzZxn.zzX5u(Unknown Source)
at com.aspose.words.zzZxn.zzZCJ(Unknown Source)
at com.aspose.words.zzZxn.zzFH(Unknown Source)
at com.aspose.words.zzVN.zzFH(Unknown Source)
at com.aspose.words.zzVN.zzXyt(Unknown Source)
at com.aspose.words.zzWsx$zzFH.zzW7Y(Unknown Source)
at com.aspose.words.zzXRi.zzW7Y(Unknown Source)
at com.aspose.words.zzWsx.zzWO6(Unknown Source)
at com.aspose.words.zzWsx.zzXx5(Unknown Source)
at com.aspose.words.zzXlC.zzW7Y(Unknown Source)
at com.aspose.words.zzXRi.zzW7Y(Unknown Source)
at com.aspose.words.zzYZK.zzWdb(Unknown Source)
at com.aspose.words.zzVWc.zzXyt(Unknown Source)
at com.aspose.words.zzWo1.zzXb9(Unknown Source)
at com.aspose.words.Document.updatePageLayout(Unknown Source)
at com.aspose.words.zzWfH.zzXEJ(Unknown Source)
at com.aspose.words.zzY61.zzVQt(Unknown Source)
at com.aspose.words.zzZji.zzVZ8(Unknown Source)
at com.aspose.words.zzZji.zzWdb(Unknown Source)
at com.aspose.words.zzZji.zzFH(Unknown Source)
at com.aspose.words.zzZji.zzXyV(Unknown Source)
at com.aspose.words.Document.zzG3(Unknown Source)
at com.aspose.words.Document.zzWdb(Unknown Source)
at com.aspose.words.Document.zzFH(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at com.citi.rendition.converters.aspose.word.filetypeconverters.RenditionWordToPDFConverter.convert(RenditionWordToPDFConverter.java:35)
at com.citi.rendition.converters.aspose.word.filetypeconverters.RenditionWordToPDFConverterTest.testRenditionWordToPDFConverter(RenditionWordToPDFConverterTest.java:33)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
@forasposeissues Does the problem occurs with the same document you have shared above? If not, please attach the problematic input document here for testing. We will check the issue and provide you more information.