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.

Wed Dec 25, 2019 1:34 pm

Hello i want to convert html to pdf with new plugin and its include UTF-8 characters. When I convert a file with new plugin, it's okay but when I convert a string, the characters become ????? .
I have tried some similar solutions suggested but it does not support CSS.

parand99
 
Posts: 2
Joined: Tue Nov 05, 2019 5:39 pm

Thu Dec 26, 2019 3:13 am

Hi,

Thanks for your inquiry.
To help us investigate your issue accurately, please offer us the following information.
1. Your input Html string.
2. The complete code you were using which could reproduce your issue directly.
3. Your result Pdf file.
4. The OS and Region information, e.g. Win7 64bit, China/Chinese.

You could upload them here or send us(support@e-iceblue.com) via email.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Thu Dec 26, 2019 3:14 pm

this is my C# code to convert string html to pdf
Code: Select all
string input = @"<html><head><style>
            td{
               width:52mm;
               height:73mm;}
            h2{
               writing-mode: vertical-lr;
               FONT-SIZE : 30px;
                text-align : right;   }
            @media print {pre{page-break-inside: avoid;}}
            div{ width:210mm;
                height:297mm;}
             </style>
             </head>
             <body>
             <div>
             <table border=1 rules=all align=center frame=void>
               <tr align=center valign=center>
                <td><p><h2>خانه شماره اول</h2></p></td>
                <td><p><h2>strArray[2]</h2></p></td>
                <td><p><h2>strArray[4]</h2></p></td>
                <td><p><h2>strArray[6]</h2></p></td>
               </tr>
                  <tr align=center valign=center>
                <td><p><h2>strArray[8]</h2></p></td>
                <td><p><h2>strArray[10]</h2></p></td>
                <td><p><h2>strArray[12]</h2></p></td>
                <td><p><h2>strArray[14]</h2></p></td>
               </tr>
                     <tr align=center valign=center>
                <td><p><h2>strArray[16]</h2></p></td>
                <td><p><h2>strArray[18]</h2></p></td>
                <td><p><h2>strArray[20]</h2></p></td>
                <td><p><h2>strArray[22]</h2></p></td>
               </tr>
                     <tr align=center valign=center>
                <td><p><h2>strArray[24]</h2></p></td>
                <td><p><h2>strArray[26]</h2></p></td>
                <td><p><h2>strArray[28]</h2></p></td>
                <td><p><h2>strArray[30]</h2></p></td>
               </tr>
              </table>
             <div/>
             </body></html>";
            string outputFile = "D:\\htmlStringToPDF.pdf";
            Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert(input,
            outputFile,
            //enable javascript
            true,
            //load timeout
            10 * 1000,
            //page size
            new SizeF(612, 792),
            //page margins
            new Spire.Pdf.Graphics.PdfMargins(0),
            //load from content type
            LoadHtmlType.SourceCode
            );

and my system is windows8.1 -64x --persian Language

parand99
 
Posts: 2
Joined: Tue Nov 05, 2019 5:39 pm

Fri Dec 27, 2019 3:15 am

Hi,

Thanks for your information.
I have reproduced your issue and logged it into our bug tracking system. Once there is any progress, we will inform you.
Sorry for the inconvenience caused.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Fri Feb 05, 2021 2:17 am

I've got the similar issues with spire pdf. I'm using spire pdf registered version 6.2

I've some characters in the pdf files like: ’ ‘’ . When I read this characters using C# code & render these characters in html page its gives me some wired character like ? mark or 
Could you please help?

Here is my code:
PdfDocument doc = new PdfDocument();
try
{
doc.LoadFromFile(path);
}
catch (Exception ex)
{
//return ex.ToString();
}

PdfFormWidget formWidget = doc.Form as PdfFormWidget;
PdfCheckBoxWidgetFieldWidget checkBoxField;
PdfTextBoxFieldWidget textBoxField;

if (formWidget != null)
{
for (int i = 0; i < formWidget.FieldsWidget.List.Count; i++)
{
PdfField field = formWidget.FieldsWidget.List[i] as PdfField;

//Fill the data for textBoxField
if (field is PdfTextBoxFieldWidget)
{
textBoxField = field as PdfTextBoxFieldWidget;
var str=textBoxField.Text;
}

}
}

lipuahmed
 
Posts: 1
Joined: Fri Feb 05, 2021 2:02 am

Fri Feb 05, 2021 11:54 am

Hello,

Thanks for your inquiry.
According to your code, it looks like you are getting the fill value of the textbox field. Do you mean that when you render the textbox field text in the html page, some characters are displayed as "?" mark?

To help us better understand your issue, please provide the following information. Thanks in advance for your assistance.
1) Your input PDF file, your OS information (e.g. Win7 64bit) and your region settings (e.g. China, Chinese).
2) How do you render the text in html page? Your code or some screenshots may help a lot.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Sat Feb 20, 2021 1:54 am

Hello,

Greetings from E-iceblue!
How is your issue now? Could you please provide more information to help us better investigate your issue?
Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Apr 21, 2021 7:18 am

Hello
This issue is not fixed yet; I'm using the latest spire pdf nuget package - 7.4.5

Here I attached an input & output pdf file as an example. I just read the value from input file and I edit the text programmatically and print output in another pdf file. Out file couldn't copy some characters correctly.

Here is the code I'm used to modify the pdf.

PdfDocument doc = new PdfDocument();
Console.Write("Loading..");
doc.LoadFromFile(@"C:\Test_PDF\formtest-input.pdf");
Console.WriteLine("ok.");
PdfFormWidget formWidget = doc.Form as PdfFormWidget;

foreach (PdfField field in formWidget.FieldsWidget.List)
{
if (field is PdfTextBoxFieldWidget)
{
PdfTextBoxFieldWidget textBoxField = field as PdfTextBoxFieldWidget;
string value1 = "";

switch (textBoxField.Name)
{
case "txtTest1":
value1 = textBoxField.Text;
textBoxField.Text = value1 + " - after edit";
break;

case "txtTest2":
value1 = textBoxField.Text;
textBoxField.Text = value1 + " - after edit";
break;
}
}
}
doc.SaveToFile(@"C:\Test_PDF\formtest-output.pdf");

Thanks
Lipu

toopandtoop
 
Posts: 3
Joined: Thu Jul 26, 2018 2:31 am

Wed Apr 21, 2021 7:57 am

Hello,

Thanks for providing more information.
I did an initial test with your file and indeed reproduced your issue. I have posted this issue to our Dev team with the ticket SPIREPDF-4219 for further investigation.
We will let you know if there is any update. Apologize for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri May 07, 2021 8:49 am

Hi Lipu,

Glad to inform you that we just released Spire.PDF Pack(Hot Fix) Version:7.5.0 which fixes the issue SPIREPDF-4219. Welcome to download it from the following links.

Website link: https://www.e-iceblue.com/Download/down ... t-now.html
NuGet links: https://www.nuget.org/packages/Spire.PDF/7.5.0
https://www.nuget.org/packages/Spire.PDF.NETCore/7.5.0

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.PDF