Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri Feb 18, 2022 3:43 pm

HI, I'm using the latest version of 8.1.4, I use DrawString() to add some texts to a pdf file. It shows correctly when I view the pdf file on a PDF viewer or browser. But when I copy that text to notepad, it shows some strange characters. Other texts are fine.

Tung,..ham,..ham.tung....48....6486@yo..mail.com


(original text: Tung,Pham,pham.tung2348236486@yopmail.com)

This is the code:
Code: Select all
private static readonly PdfTrueTypeFont Font = new PdfTrueTypeFont(new Font("Arial", 11), true);
private static readonly PdfSolidBrush Brush = new PdfSolidBrush(Color.Blue);

// I create a new layer and drawString on this layer
var layer = pdfDoc.Layers.AddLayer("Layer1", Spire.Pdf.Graphics.Layer.PdfVisibility.On);

PdfCanvas graphic = layer.CreateGraphics(pdfDoc.Pages[i].Canvas);
// the drawing code
graphic.DrawString(text, Font, Brush, new PointF(x, textTop));


It does not happen every time. When I restart the app using it, it suddenly works well. But I want to make sure it will work stably.

Could you please help on that?

Thanks a lot!

tungpham
 
Posts: 7
Joined: Fri Feb 18, 2022 3:27 pm

Mon Feb 21, 2022 5:53 am

Hello,

Thanks for your inquiry!

I tested the code you provided and copy the text to notepad in multiplied times, but did not reproduce your issue. To help us better investigate in your issue, please provide us with the following information. Thanks in advance!

1. Your input file and the output file. (which has the issue you mentioned)
2. The target framework of your project. (E.g. .net framework 4.0)
3. Your system information (E.g. Win7, 64 bit) and region setting (E.g. China, Chinese).
4. The type of your project. (E.g. console application)

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Mon Feb 21, 2022 4:30 pm

Sorry for keep you waiting.
I have spent a lot of time trying to test it and reproduce the error. I realized that the error only happends when I processed the second files.

I have created a sample project that you can run to test it.

Just run the console project (in SpirePdfTest.zip) and it will generate 2 pdf files in bin\Debug\netcoreapp3.1\output folder. And then you can open the file 2test1pagexxxx,
copy the text "[!Sign.1.F.W=168.H=47.IDCHECK.NZDL,Tung,Pham,pham.tung2348236486@yopmail.com]" right below the line "Evaluation Warning : The document was created with Spire.PDF for .NET."

Then paste it to notepad, it will become some strange text.
Image

I hope you can find it helpful and fix it asap.

Thanks!

tungpham
 
Posts: 7
Joined: Fri Feb 18, 2022 3:27 pm

Tue Feb 22, 2022 2:35 am

Hi team,

I forgot some information.
- Win10 64bit, region: United State, regional format: English
- The app is web but the sample project I created is console 3.1 it has the same issue.

Hope that helps.

tungpham
 
Posts: 7
Joined: Fri Feb 18, 2022 3:27 pm

Tue Feb 22, 2022 8:34 am

Hello,

Thanks for sharing more information!

I did reproduce the issue based on the project you provided, and the issue has been logged it in our issue tracking system with the ticket SPIREPDF-4957 for further investigation.

We will let you know if there is any update. Sorry for the inconvenience caused.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Tue Feb 22, 2022 9:03 am

Thanks for the reply.

I really hope you can fix it soon, because we're going to release our product to the production in the next few weeks. And our system relies a lot on that PDF function, without it we cannot release to users.

Sincerely.

tungpham
 
Posts: 7
Joined: Fri Feb 18, 2022 3:27 pm

Tue Feb 22, 2022 9:18 am

Hello,

Thanks for your feedback!

Kindly note that our developers deal with the issues according to the customer's priority and deal with the purchasing customer first. If you or your company has purchased our product, could you please provide us with your order number or purchase email address for recording? Thanks in advance!

Anyway, I have informed our developers of your situation. Our developers will estimate the implementation time as soon as possible. I will keep you informed of any updates.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Tue Feb 22, 2022 9:26 am

Hi Marcia,

This is our order:
[Order No.10491] Spire.PDF Pro Edition

Thanks!
Last edited by tungpham on Tue Feb 22, 2022 1:34 pm, edited 1 time in total.

tungpham
 
Posts: 7
Joined: Fri Feb 18, 2022 3:27 pm

Tue Feb 22, 2022 9:44 am

Hello,

Thanks for your quickly reply!

I have logged your purchase information, and give the issue SPIREPDF-4957 to higher priority. If there is any good news, we will notify you immediately.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Feb 23, 2022 6:48 am

Hello,

Thanks for your patience!

I just got news from our dev team that the issue of incorrect characters is caused by the font cache when draw the string by our Spire.PDF. I just recommend that you can use "PdfDocument.EnableFontCache = false;" before you load files as a temporary method. After using this code, the characters in the generated file can be copied right.

We will continue to investigate in this issue, and once there is any good news, we will notify you immediately.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Feb 23, 2022 2:44 pm

Great, your team investigate that very fast! It's very helpful for us even though it's a temporary solution.

We will try testing it and hope it will work.

Thanks so much!

tungpham
 
Posts: 7
Joined: Fri Feb 18, 2022 3:27 pm

Thu Feb 24, 2022 1:24 am

Hello,

You are welcome!

If there are any questions during your tests, just feel free to contact us. Once there is any progress regarding the issue SPIREPDF-4957, we will notify you immediately.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Fri Feb 25, 2022 8:29 am

The temporary solution works well. So take your time. Thanks :)

tungpham
 
Posts: 7
Joined: Fri Feb 18, 2022 3:27 pm

Fri Feb 25, 2022 8:59 am

Hello,

Thanks for your feedback!

Glad to hear that the method is working. Besides, the issue SPIREPDF-4957 is in the testing phase, once it passes the test, we will inform you ASAP.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Sat May 07, 2022 11:37 am

Hello,

Thanks for your patience.

Greetings from E-iceblue.
Kindly note that we just released Spire.PDF Pack(Hot Fix) Version:8.5.0 which resolves the issue SPIREPDF-4970 and the issue SPIREPDF-4957, welcome to test it

Website link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link: https://www.nuget.org/packages/Spire.PDF/8.5.0

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 194
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.PDF