Open PDF file with PDfViewer, some Chinese characters are not displayed

2 Answers 542 Views
PDFViewer
Mingchang
Top achievements
Rank 1
Iron
Iron
Mingchang asked on 20 Aug 2021, 09:48 AM

This is what it looks like in the PDfViewer.Some characters are not shown.  '成'  Unable to display。

There are characters in the document.

 

Mingchang
Top achievements
Rank 1
Iron
Iron
commented on 20 Aug 2021, 09:49 AM

here is a PDF file.

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 23 Aug 2021, 09:39 AM

Hi Mingchang,

I was able to reproduce the observed issue. I have logged the issue on our feedback portal. You can track its progress, subscribe to status changes, and add your comment to it here. I have updated your Telerik points as well. 

Unfortunately due to the nature of the issue, I cannot suggest a workaround for it.  

Thank you for your understanding.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 24 Aug 2021, 07:34 AM

Hi Mingchang,

Are you sure attached pdf document has valid standard. (RadPDF viewer has some limitation, where some pdf documents working fine with adobe reader but RadPDFViewer failed to render). I faced some issue with radPdfviewer before, which is fixed in current release.

As per your sample document it seems document is produced by Rad rich textbox. But I prepared another document having same content, and it is rendering fine. 

 

Mingchang
Top achievements
Rank 1
Iron
Iron
commented on 26 Aug 2021, 02:07 AM

My customer feedback is as follows: the document was edited by MSWord, and then opened through RadRichTextBox to modify and add some content.

After the modified document is converted to PDF, some text is not displayed. (The PDF reader in our software is the RadPdfViewer).

However, when we checked the problem, the PDF appeared normally when opened with other software, such as a browser, Adobe Reader, WPS, or Foxit Reader.

I have uploaded the MSWord document. You can open it with a RadRichTextBox and save it as a PDF file. Then open the PDF file with the RadPdfViewer to reproduce my feedback.

I found that if I save the document as PDF using MSWord directly, it will display normally in RadPdfView.
I uploaded the same document including two PDF files, respectively saved by MSWord and RadRichText。

 

 

Dimitar
Telerik team
commented on 26 Aug 2021, 12:08 PM

Hi Mingchang, 

Thanks for the additional inforamtion.

I have tested this with the WordsProcessing library and it works as expected. You can consider using it as a workaround and covert the docx file to PDF with it until the issue is resolved. 

I hope this helps. Should you have any other questions do not hesitate to ask.
Mingchang
Top achievements
Rank 1
Iron
Iron
commented on 27 Aug 2021, 02:10 AM

Hi Dimitar,

How to use WordsProcessing to export radrichtext to pdf?

I would be grateful if you could provide some sample code.

Mingchang
Top achievements
Rank 1
Iron
Iron
commented on 27 Aug 2021, 03:44 AM

Hi Dimitar,

I implemented WordsProcessing to export PDF files from RadRichTextBox, but I found that some of the text was wrapped.

It shows one line in my document, but two lines in the PDF

show in my docx document and pdf document:

 

my export code like


var docxProvider = new Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
            var docxByte = docxProvider.Export(radRichTextBox.Document);
            Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
            RadFlowDocument flowdocument = provider.Import(docxByte);
            Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider pdfprovider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
            var resultDoc = pdfprovider.Export(flowdocument);
            File.WriteAllBytes(pdfFilePath, resultDoc);
I uploaded an app, and you can see that neither approach shows up as expected.

The first character is not displayed, and the second document is wrapped
Dimitar
Telerik team
commented on 30 Aug 2021, 09:31 AM

I am sorry to hear that this does not work as expected. 

What I can suggest is increasing the page size when converting to pdf. This way the text would not be wrapped:

RadFlowDocument flowdocument = provider.Import(docxByte);

foreach (var section in flowdocument.Sections)
{
    section.PageSize = new Size(1200, 1500);
}

Let me know how this works for you.

 

Mingchang
Top achievements
Rank 1
Iron
Iron
commented on 31 Aug 2021, 12:43 AM

Hi Dimitar,

Thank you very much for your reply.

I'm sorry to tell you that this method cannot be accepted as our solution. We do not know the width and height of the document, which should be set by the user.

We tried to increase the width and height based on the original document, but this did not meet our expectations, we need to do our best to ensure that the display is consistent with the original document.


foreach (var section in flowdocument.Sections)
            {
                section.PageSize = new Size(section.PageSize.Width + 3, section.PageSize.Height + 5);
            }

The exported PDF file has too many contents that are different from the original document.Not only is it wrapped, it also loses the style and the first line  indented.

Is there any other solution? Any reply would be greatly appreciated.

Dimitar
Telerik team
commented on 01 Sep 2021, 09:18 AM

Hi Mingchang,

On my side only the wrapping is different. The indent and the styles look similar. Which version of the suite are you using?

Unfortunately, I cannot provide another workaround for this. Please note that 3 is a very little increase of the size, can you try with a 100 and see the results? 

I am looking forward to your reply.

 

Mingchang
Top achievements
Rank 1
Iron
Iron
commented on 02 Sep 2021, 06:30 AM

Hi,

I use the latest Telerik. In the application I provide, it is easy to reproduce the following differences.

when note with  a 100 width size, The indent look similar,but other differences still exist.

Dimitar
Telerik team
commented on 02 Sep 2021, 12:17 PM

Hi Mingchang, 

This works on my side with your project and the latest version of the suite (see attached). This is why I was asking for the version of the suite that you are using?

I am looking forward to your reply.

 

Mingchang
Top achievements
Rank 1
Iron
Iron
commented on 08 Sep 2021, 03:46 AM

Hi Dimitar,

Our version is 2021.2.615.45 .

In your image, the style is there, but there are still a lot of differences from the docx file.

Dimitar
Telerik team
commented on 08 Sep 2021, 08:23 AM

Hi Mingchang, 

I am testing with the same version, I am not sure why you are getting different results. Please note that the PDF and Docx formats are very different and the output depends on many factors like paragraph length, page and symbols sizes. It is not expected that every symbol will have the exact same position in the result pdf. 

Thank you for your understanding.

Tags
PDFViewer
Asked by
Mingchang
Top achievements
Rank 1
Iron
Iron
Answers by
Dimitar
Telerik team
Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
Share this question
or