We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Can not be read.Unable to cast object of type ' ' to type ' '

Acrobat reader can open the document but the aspose could not open the file as the following error:
Attachment ABC.pdf can not be read.Unable to cast object of type ’ ’ to type ’ '.

0x08 hexadecimal character appears so that this error produces.

How can I fix this issue?

Aspose.pdf.dll version 17.4.0


Please try to test the scenario using Aspose.PDF for .NET 21.2 which is the latest available version. In case issue still persists, please share your sample PDF document with us so that we can test the scenario in our environment and address it accordingly.

Hi, I have bought a licence and tried it worked very well on test environment but on the another server in the same location, it did not work after producing the error as follows: what could be causing this issue?

Paginate error: Object reference not set to an instance of an object.

stack trace at Aspose.Pdf.Text.Font…ctor(#=zKHE90QBpfm7hufzIylyiCzs= #=zQ2Kd9a4=)**

at #=zyJecUYaB6pdDfKOoDlWBYrLOpAfMlPpsDNckR_meNoC6a_d3l5eI5ks=.#=zJYqpgDDR2d8uZKJppQeKgI$mPiIl(String #=zsZf7C5o=, Font #=zQ2Kd9a4=, Font& #=zGfLL29r9mZ6XlFXfETKqNEg=)

at Aspose.Pdf.Text.TextSegment.set_Text(String value)

at Aspose.Pdf.Text.TextFragment.set_Text(String value)

at Aspose.Pdf.TextStamp.Put(Page page)

at Aspose.Pdf.Facades.PdfFileStamp.#=zXag2axeZdstl(Stamp #=z6EZURqM=, Int32 #=zEmkcrZJhQTBS)

at Aspose.Pdf.Facades.PdfFileStamp.#=zXag2axeZdstl(Stamp #=z6EZURqM=)

I could not share pdf because of the confidential document. But I am sure you can help me using the error above.

var esignature ="IT IS A SIGN"
    Document newPdf = new Document();

                    Aspose.Pdf.Facades.PdfFileStamp fileStamp = new Aspose.Pdf.Facades.PdfFileStamp(newPdf);
                    Aspose.Pdf.Facades.Stamp textStamp = new Aspose.Pdf.Facades.Stamp();
                    Aspose.Pdf.Facades.FormattedText text = new Aspose.Pdf.Facades.FormattedText("E-İmza var\n---------------\n" + esignature, System.Drawing.Color.Blue, System.Drawing.Color.White, Aspose.Pdf.Facades.FontStyle.Helvetica, Aspose.Pdf.Facades.EncodingType.Winansi, false, 11.0f);
                    textStamp.SetOrigin(50, 50);
                    textStamp.Opacity = 1.0f;
                    textStamp.IsBackground = false;
                    fileStamp.AddStamp(textStamp);// this line produces the error above.

We use aspose pdf.net build on 4.5.1 framework. .NET framework version:
installed version. 4.5.01586
It is licensed product and it works on my local computer but it has problem running on server.


The error seems related to missing fonts in the system where you are using the API. Please try to install all Windows Essential Fonts in the system where error is being observed. In case you are using API in non-Windows environment, please make sure to install libgdiplus package along with msttcorefonts package in it. Please let us know if issue still persists by sharing the environment details with us.

I saw it is installed on server - Arial. Bu I get this error.
Font Arial was not found
Aspose.Pdf.Text.FontRepository.FindFont(String fontName)
at Aspose.Pdf.Facades.FormattedText…ctor(String text, Color textColor, Color backColor, String fontName, EncodingType textEncoding, Boolean embedded, Single fontSize)
at Miyav.Service.PdfPaginator.TestDocument(String filename)


Please check the folder in which the required fonts are present over your server and add that folder into sources of FontRepository as following:

FontRepository.Sources.Add(new FolderFontSource("Font_Folder_Path")); 

In case issue still persists, please share the complete environment details with us so that we can test the scenario in our environment and address it accordingly.

Aspose.Pdf.Text.FolderFontSource fss = new Aspose.Pdf.Text.FolderFontSource(@“C:\Windows\Fonts”);

This method which I tried yesterday worked. Thanks for your kind support.


It is nice to know that you are able to set up the API now for usage. Please keep using our API and feel free to let us know in case you need further assistance.