PDF in aspose made is not showing chinese characters - package

I am using aspose.total package for pdf generation. The reports are generated fine for english language some characters in chinese language are not coming fine. I have found that instead of showing characters its showing square like image. Does any one know how to deal with this ?
Thanks,

Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you're converting documents to Pdf. Please refer to the following articles:
How Aspose.Words Uses True Type Fonts
I work with Aspose as Developer evangelist.

You can set the font as follow:
TextFragment textFragment = new TextFragment("text");
textFragment.TextState.Font = FontRepository.OpenFont("C:\\WINDOWS\\FONTS\\SIMHEI.TTF");

Related

How to render ₹ symbol in PDF in C# using PDFsharp

I want to render ₹ in PDF using C#.
Instead of this I am getting ?.
In form am able to print how to render ₹ but I am facing this issue only with PDF.
Attached image
Make sure Unicode is enabled in PDFsharp and also make sure the font use are using contains that symbol.
Since you get "?" instead of the symbol, you most likely just have to set the PdfFontEncoding.Unicode option as shown in the sample.
See this sample:
http://pdfsharp.net/wiki/Unicode-sample.ashx

PDF to text extraction using Poppler C API

I need do extract the text from the PDF file.With the help of Poppler API i can able to extract all text available in that page . even i can able to get the font information like Bold and italic .But i cant able to get the size of the text.Please let me know the way to get the size of text.
Thanks
Although late by an eternity, take a look at TextWord::getFontSize().

Custom font Xcode 4.6 using storyboard

I have added Imago font (including bold, italic and those both with those names: boolta, med and medlta) to Info.plist, but now I'm totally stuck with several tutorials.
I'm using storyboard mode.
Could someboby tell me what codes I have to write and where to get these font to work?
been having a lot of issues with fonts myself recently and there are a few things I suggest checking: -
1/ Always use .ttf format
2/ Make sure your font is included in 'Copy Bundle Resources' in your project 'Build Phases'
3/ Custom fonts should be defined in the array in your '[appname]-Info.plist' like you said above, it's under the heading 'Fonts provided by application'
4/ Make sure that you are using the correct font name as it is usually different to the filename. To get a list of available font names use the below code. Just using finders 'Get Info' is not always reliable: -
for (NSString* family in [UIFont familyNames]){
for (NSString* name in [UIFont fontNamesForFamilyName: family]){
NSLog(#"font=%#", name);
}
}
Then use the font name outputted in your log
5/ If that STILL doesn't work, it may mean your font encoding is a little messed up. I had this recently with a .ttf font, the app just couldn't see it so I stuffed the file into this online converter and whatever the issue was disappeared, magic!

iTextSharp to generate PDF from WPF FixedDocument

I have a simple WPF app that displays and prints some
reports with a FixedDocument.
How can generate PDF's from that, with a free and open solution,
such as iTextSharp?
A WPF FixedDocument, also known as an XPS document, is a definite improvement over PDF. It has many capabilities that PDF lacks. In most cases it is better to distribute your document as XPS rather than PDF, but sometimes it is necessary to convert from XPS to PDF, for example if you need to open the document on devices that have only PDF support. Unfortunately most free tools to convert from XPS to PDF, such as CutePDF and BullzipPDF, require installing a printer driver or are not open source.
A good open-source solution is to use the "gxps" tool that is part of GhostPDL. GhostPDL is part of the Ghostscript project and is open-source licensed under GPL2.
Download GhostPDL from http://ghostscript.com/releases/ghostpdl-8.71.tar.bz2 and compile it.
Copy the gxps.exe executable into your project as Content and call it from your code using Process.Start.
Your code might look like this:
string pdfPath = ... // Path to place PDF file
string xpsPath = Path.GetTempPath();
using(XpsDocument doc = new XpsDocument(xpsPath, FileAccess.Write))
XpsDocument.CreateXpsDocumentWriter(doc).Write(... content ...);
Process.Start("gxps.exe",
"-sDEVICE=pdfwrite -sOutputFile=" +
pdfPath +
"-dNOPAUSE " +
xpsPath).WaitForExit();
// Now the PDF file is found at pdfPath
A simple way, which is easy, but probably not the most efficient way is to render the Fixed document to an image and then embed the image in a PDF using iTextSharp.
I have done it this way before successfully. Initially I tried to convert the control primitives (shapes) to PDF equivalents, but this proved too hard.
If you can get it into an image from WPF then you can import it into iTextSharp like they do in this article. You can even avoid the filesystem all together if you write it to a MemoryStream and then use that instead of using a FileStream.
http://www.mikesdotnetting.com/Article/87/iTextSharp-Working-with-images
IF you want to do it programatically, your Best bet would be the following path XPS (Fixed Document) -> Print to PS -> Use Ghostscript to read the PS and convert to PDF.
If you dont care about reading the PDF back in the code, you can print to any one of the free PDF printers to which you can pass the destination path. This way your target PDF file will still be searchable if you have any test in your report.

Exporting SSRS reports to PDF when they contain Wingdings with char value above 127

In Report Builder 2008 I use code such as
=Chr(224)
in textbox expressions to get Wingdings chars such as the up, down, straight arrows, etc. I run the report and it looks fab on screen, as well as exported to Excel.
But if I export to PDF, I've noticed any Wingdings with character values above 127 do not display inside the PDF correctly (just an empty little box.) Inside Acrobat, I go to File-Properties, look at the Fonts tab and I see that Wingdings is successfully embedded, but the encoding is set to ANSI. (If I export a document from OpenOffice using their excellent PDF export feature, the encoding says "Built in" and the Wingdings characters all look great.)
Wingdings under Chr(127) look fine on the SSRS reports. Any idea if I can do anything about the higher chars?
Thanks,
Bill
Workaround:
I wanted to use an empty square and a square with a tickbox in it.
Originally I was using windings characters 254 and 168.
Basically try to use characters below 128, and don't forget that there's wingdings 2, 3 and webdings. I found Wingdings 2 characters 82 and Wingdings 111 would work instead.
Also, you can mix and match multiple fonts by setting an expression for the font property of your expression.
Note for others: If your looking for a basic tick for your document you can switch to WebDings and use a lower case "a". This exports to PDF correctly as a tick.
I got an answer over at the official Sql Server Reporting Service forum.
The long and short of it: it's a bug. I'll be filing an issue as Andre Milbrandt suggested.
I faced the same issue with Chinese locale. Then i fixed that issue by installing Chinese language on server (where SQL reporting services are running).
Also same issue fixed by installing SQL CU6 update (without installing language pack). Here is the link for that update http://support.microsoft.com/kb/2489376

Resources