Some text is not rendered correctly in PDF

I'm trying to generate sample PDFs and it works most of the time, but time to time, I get text that gets rendered liked this:

It's supposed to read "DRAFT INTERNAL CONFIDENTIAL"

In the same PDF, some other text can have the same problem. There's a PdfGrid that's getting paginated and some text inside of it can be rendered incorrectly, too. It doesn't seem to be a problem when the PdfGrid fits in one page.

What causes this?


5 Replies

KC Karthikeyan Chandrasekar Syncfusion Team August 23, 2018 10:12 AM UTC

Hi Carlo, 
We have faced similar kind of issues before, we have suggested to enable the property “PdfDocument.EnableThreadSafe = true;” to resolve the issue. But we could not confirm that this code snippet will fix this issue. If the issue is not resolved, please share us your output PDF document. So that we could analysis in this further and provide you the solution. 

Regards, 
Karthikeyan 



CA Carlo August 29, 2018 03:18 AM UTC

I tried PdfDocument.EnableThreadSafe = true; and that didn't help.

Ultimately, I have a solution. I can switch between these two and can reproduce/fix the issue. I think the main factor is allowing some time to elapse before generating another PDF. FYI, the first PDF is what gets incorrectly rendered text, but the second one is fine.

Edit: In hindsight, I realized the code below doesn't reflect Syncfusion's code directly, but the key is to allow some time between PDF files.

//this works and results in correctly rendered text on both PDFs
var internalPdfStream = await CreatePdfStream(true);
var storageFileInternalPdf = await SavePdfStorageFile(internalPdfStream, "First PDF", pfolder);
await Windows.System.Launcher.LaunchFileAsync(storageFileInternalPdf);
//allows some time before second PDF is generated
var pdfStream = await CreatePdfStream(false);
var storageFilePdf = await SavePdfStorageFile(pdfStream, "Second PDF", pfolder);
await Windows.System.Launcher.LaunchFileAsync(storageFilePdf);

//this renders the first PDF with incorrectly rendered text
var pdfStream = await CreatePdfStream(false);
var internalPdfStream = await CreatePdfStream(true);
var storageFilePdf = await SavePdfStorageFile(pdfStream, "Second PDF", pfolder);
var storageFileInternalPdf = await SavePdfStorageFile(internalPdfStream, "First PDF", pfolder);
await Windows.System.Launcher.LaunchFileAsync(storageFileInternalPdf);
await Windows.System.Launcher.LaunchFileAsync(storageFilePdf);



KC Karthikeyan Chandrasekar Syncfusion Team August 29, 2018 09:43 AM UTC

Hi Carlo, 
We are glad to know that the issue is resolved at your end. Meanwhile, if we could get the complete code snippet for your initial issue to reproduce from our end, we will analyze in this deeper and provide a proper resolution. 
 
Regards, 
Karthikeyan  



CA Carlo January 14, 2020 05:42 AM UTC

This started happening again with 17.4.0.x as far as I can tell. I've only received complaints within the last week or two, and seems to coincide with this version.


GK Gowthamraj Kumar Syncfusion Team January 15, 2020 01:08 PM UTC

Hi Carlo, 

Thank you for your update. 

Can you please provide more details such as complete code snippet, product version, output documents and simple sample to reproduce the issue in our end. So, that it will be helpful for us to analyze and assist you further on this.  

Regards, 
Gowthamraj K 


Loader.
Up arrow icon