Hi all,
I need to convert XML that has Unicode characters in it . I want to get them displayed on PDF. It is like this. I have a HTML Form displayed on PDF and I am inserting Form Data into respective fields. While inserting it into Text fields in PDF , my unicode characters are not displayed correctly but they show some weird symbols. Does Aspose.pdf for java have api that supports displaying these unicode characters as it is in PDF?
Please let me know the possibilities and I’ve no problem with pricing.
You can send me replies here or on my email address. ibrahim.06eee@gmail.com
Thanks and Regards,
Ibrahim
Hi Aspose,
I have a blank PDF created using a template that contains a HTML form in it. I also have an XML that contains data that is to be inserted in that HTML fields present in PDF file.
But problem here is my XML contains data that has utf8 characters in it. So when I try to display these characters on PDF’s HTML fields, they display weird symbols instead of original utf8 characters. So I believe that the current PDF api is not interpreting the characters correctly. Does aspose have a solution for this?
Please let me know if you have a solution and proposed approach.
If there is a solution we shall discuss the pricing details as well.
You can reply to this or email me on ibrahim.06eee@gmail.com
Thanks and Regards,
Ibrahim Baig
Hi Aspose,
I have a blank PDF created using a template that contains a HTML form in it. I also have an XML that contains data that is to be inserted in that HTML fields present in PDF file.
But problem here is my XML contains data that has utf8 characters in it. So when I try to display these characters on PDF’s HTML fields, they display weird symbols instead of original utf8 characters. So I believe that the current PDF api is not interpreting the characters correctly. Does aspose have a solution for this?
Please let me know if you have a solution and proposed approach.
If there is a solution we shall discuss the pricing details as well.
You can reply to this or email me on ibrahim.06eee@gmail.com
Thanks and Regards,
Hi Ibrahim,
Hi Tilal,
We are currently using Aspose tool in our product. We are looking out for some priority support from Aspose team.
Let me know if Priority support is chargeable for current customers as well?
If so let me know the pricing and details because we have this problem as a show stopper now.
Regards,
Ibrahim Baig
Hi Ibrahim,
We are sorry for the inconvenience. Please share your sample PDF template and XML, containing UTF-8 characters. We will investigate it further and share the information accordingly.
Moreover in reference to Priority support purchase, yes Priority support is paid support and purchase of Priority support ensures that you will get initial response within 12 hours and your issue is treated on priority but resolution is subject to the complexity and priority of issue. Please check Priority Support policies and Enhanced support FAQs for details.
Please feel free to contact our sales department for any further query related to purchase of Priority Support
Best Regards,
Hi Tilal Ahmed,
Thank you for your response.
Initially there are two requirements here.
1. Placing Unicode data in PDF form template . The template is attached in here.(PN_xxxx_PDF.pdf)
2. We have a place where we insert unicode data into Tables cells.
I have code like this
Row r= table.getRows().add();
Cell c = r.getCells().add(result);
c.setBorder(new BorderInfo(BorderSide.All.getValue(), 0.5F));
where “r” is aspose.pdf.Row and “result” is a String object.
Note: Eg String result = “परीक्षण”; in Hindi.
I have tried pdf.setUnicode(); and giving Arial Unicode MS font as well after looking into one of the forum answers
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val=“–”/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><span style=“font-size:11.0pt;font-family:“Calibri”,“sans-serif”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA”>https://forum.aspose.com/t/103918
Please let me know how to insert Unicode data into these cells of table.<!–[if gte mso 10]>
<![endif]–>
Please let me know if you need more information.
Thanks and Regards,
Ibrahim baig
Hi Ibrahim,
// Open a document<o:p></o:p>
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("c:/pdftest/PN__xxxxx_PDF.pdf");
// Get a field
com.aspose.pdf.TextBoxField textBoxField = (com.aspose.pdf.TextBoxField)pdfDocument.getForm().get("JNDBMKPLCBMGLFGDOHMIMHGHAKEPLCFN.form2.x.f1");
// Create an instance of font object and try loading ComicSansMS font from system font repository
com.aspose.pdf.Font font = com.aspose.pdf.FontRepository.findFont("Arial Unicode MS");
// Set the font information for form field by using Font object
textBoxField.setDefaultAppearance(new com.aspose.pdf.DefaultAppearance(font, 10, Color.black));
//Set the field value
textBoxField.setValue("परीक्षण");
// Save the updated document
pdfDocument.save(“c:/pdftest/ValueFilled.pdf”);
Hi Nayyar Shahbaz,
Thanks for the information.
In my question in point 2, I am creating a pdf from the scratch.
There I use aspose.pdf instead of com.aspose.pdf packages…
I n my process I use aspose.pdf.Table and aspose.pdf.Cell and Row classes and try to insert unicode data in the Cells.
It is exactly this way.
A table containing 3 columns .
column1 : label of form, column 2: field value , column 3:annotation.
Question here is , when I try to insert unicode vaues in cell 2 and cell3 , I see that data is not displayed in cell 2 and since cell3 is an annotation , unicode data appears as ??? symbols in paragraph.
Im attaching you the screen shot of this problem which will give you more insight of the problem.
Here in attachment you can notice that the value for UTFField is How are धर्मेश you?.
But we can see How are you? But in the annotation you can see ??? for
धर्मेश.
Let me know if you need more details…
Thanks and Regards,
Ibrahim Baig
Hi Ibrahim,
as PDFNEWJAVA-34011 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.
aspose.pdf.Pdf pdf = new
aspose.pdf.Pdf();<o:p></o:p>
aspose.pdf.Section sec = pdf.getSections().add();
//Instantiate a table object
Table table = new Table(sec);
//Add the table in paragraphs collection of the desired section
sec.getParagraphs().add(table);
//Set with column widths of the table
table.setColumnWidths("150 150 50");
//Set default cell border using BorderInfo object
table.setDefaultCellBorder(new BorderInfo(aspose.pdf.BorderSide.All, 0.1F));
//Set table border using another customized BorderInfo object
table.setBorder(new BorderInfo(aspose.pdf.BorderSide.All, 1F));
//Create MarginInfo object and set its left, bottom, right and top margins
MarginInfo margin = new MarginInfo();
margin.setLeft(5f);
margin.setRight(5f);
margin.setTop(5f);
margin.setBottom(5f);
//Set the default cell padding to the MarginInfo object
table.setDefaultCellPadding(margin);
//Create rows in the table and then cells in the rows
Row row1 = table.getRows().add();
aspose.pdf.Cell cell1 = new aspose.pdf.Cell(row1);
cell1.getParagraphs().add(new aspose.pdf.Text("How are धर्मेश you? © ® ™ µ ¢ £ € « » ♠ ♣ ♥ ♦ ¿ �"));
cell1.getDefaultCellTextInfo().setFontName("Mangal"); // Mangal is font which supports Hindi characters
row1.getCells().add(cell1);
aspose.pdf.Cell cell2 = new aspose.pdf.Cell(row1);
aspose.pdf.FormField field = new aspose.pdf.FormField();
field.setFormFieldType(aspose.pdf.FormFieldType.Text);
field.setFieldName("TextField");
field.setFormHeight(20);
field.setFormWidth(100);
field.setFieldValue("How are धर्मेश you?");
cell2.getParagraphs().add(field);
cell2.getDefaultCellTextInfo().setFontName("Mangal");
cell2.getDefaultCellTextInfo().setFontSize(10);
row1.getCells().add(cell2);
row1.getCells().add("col3");
Row row2 = table.getRows().add();
row2.getCells().add("item1");
row2.getCells().add("item2");
row2.getCells().add("item3");
pdf.setUnicode();
pdf.save(“c:/pdftest/UTF-8_Characters.pdf”);
Hi Nayyar,
It has been a while I have heard from you.
We were waiting for the solution for the issue PDFNEWJAVA-34011 where we can display UTF8 characters on PDF page.
On your request Iam again providing you the problem details here.
We have a requirement where we need to display UTF8 data ( It may be any language not only English) on a PDF page.
Currently when I try to use your code , it is displaying blank for me and you too agreed on it in the above conversation.
For your convenience I had attached a method of our implementation which explains what exactly we are doing with it
sss.txt contains the code you need and 666.pdf is the pdf file where I am expecting the utf 8 data.
in the pdf file in EQ5D section ecrf , you can find UTF Filed which is column1 and in column 2 I am expecting utf8 data. and in the column 3 is nothing but the annotation .
Please let me know if you need more details.
Thanks and Regards,
Ibrahim baig
SaqibBaig:It has been a while I have heard from you.
We were waiting for the solution for the issue PDFNEWJAVA-34011 where we can display UTF8 characters on PDF page.
SaqibBaig:We have a requirement where we need to display UTF8 data ( It may be any language not only English) on a PDF page.
Currently when I try to use your code , it is displaying blank for me and you too agreed on it in the above conversation.
SaqibBaig:For your convenience I had attached a method of our implementation which explains what exactly we are doing with it
sss.txt contains the code you need and 666.pdf is the pdf file where I am expecting the utf 8 data.
in the pdf file in EQ5D section ecrf , you can find UTF Filed which is column1 and in column 2 I am expecting utf8 data. and in the column 3 is nothing but the annotation .
The issues you have found earlier (filed as PDFNEWJAVA-34011) have been fixed in Aspose.Pdf for Java 10.2.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.