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

Free Support Forum - aspose.com

Value cannot be null. Parameter name: format

Can someone please help me? I am getting this error on only one of three images that my report is trying to render. Please send me your suggestions for things to look at. I have to solve this problem immediately and for the life of me I can't figure out what is wrong!

Thank you,


This is the specific detail behind the error message being returned:

System.ArgumentNullException was caught
Message="Value cannot be null.
Parameter name: format"
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
at Aspose.Pdf.Xml.ᕂ.ᕃ(Pdf ᅛ, Section Ꮈ, Table પ, Row ሶ, Cell ቓ, Image ਤ, ჸ ᄇ, ኩ ᒍ, Boolean ᒎ)
at Aspose.Pdf.Xml.ᇙ.ᇛ(Pdf ᅛ, Section ᅦ, ჸ ᄇ)
at Aspose.Pdf.Xml.ࣲ.ᆸ(Pdf ᅛ)
at Aspose.Pdf.Xml.ᅕ.ᅚ(༞ ༔, Pdf ᅛ)
at Aspose.Pdf.Pdf.Save(String pdfFile)
at LibBarePrint.BarePrint.PDFOut(String aUserName, String aSubject, String aTitle, String aProducer, String aOutputFileName) in C:\V7 Root\V7\BarePrint\LibBarePrint\BarePrint.vb:line 2632

Hello George,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

We apologies for inconvenience. Can you please little more elaborate the scenario in which you are facing this problem and if it does not violate your privacy, can you please share the resources that can generate this issue so that we can test it at our end.

Thank you for your response. Unfortunately I cannot send you the code as it is proprietary.

The code is VB.net 2005 referencing aspose.pdf.dll

A report is generated on the screen that displays three graphs. There is a button on the screen that permits creation of the screen report into a pdf file. The same code is used to create the pdf. The first of the three graphs, apparently, triggers the error. I can step around the code of this graph and when I do the create pdf works just fine.

I've also downloaded a later version dll and tested it out. I don't get the error message but my reports, the format, is all different and incorrect.

What kinds of things can I look at that might be causing the error to occur int he first place?


First you should try the latest version. If it still won't work, you should send a project that can reproduce the error to us. Otherwise it is difficult for us to check the problem. Sorry for the inconvenience.

I've downloaded aspose.pdf.dll As I said in the previos post, when using this DLL the "Value Cannot Be Null. Parameter name: Format" message goes away but then I have a whole slew of new format errors on the report as most objects, text, images, etc., are out of alignment, not centered, or otherwise out of place.

So tell me please which problem I can solve that is easiest, and please suggest a few things that I can look at for each dll. If you can, please temporarily license and send me the absolute latest and greatest dll and if that solves both problems then I'll have my client update their purchase.


Please try Aspose.Pdf 3.7.0. If you need a temp license please refer to How to get a Temporary License.

If it still won’t work please send us the project that can reproduce this error.

I’ve tried version and The “Value cannot be null” error message goes away but I’m faced with a new problem: the formatting of my reports is all messed up. Attached are screen shots of the reports and the XML that is used to generate them. I cannot send you the code but note this, the very same code (which has NOT changed) is used to produce the previews as it is to produce the PDF. What has changed in the aspose software or what things in the XML can I look at?


I have noticed the format issues through your attached documents. However, I am afraid we are not able to reproduce the error without your codes and related files(docs and xml files). If you can’t do this for privacy problem, please send it through email (firefoxyw@gmail.com). We will keep it private. Sorry for inconvenience.

Best regards.

I cannot send you the project source code for two reasons:

1) It is licensed, proprietary software.

2) The software has not changed in two years.

Under, the format is clean but creating the PDF throws an error.

Under, the format is messy but creating the PDF does not throw an error.

We can work with until an explanation/better solution is provided. Please send me some suggestions or sample vb.net code to compare and in the meantime, I will see if the project manager will let me send some code snippets.


As your xml is not created under our xml schema, we can’t convert it into pdf without your codes. I guess it reads the xml elements and constructs a pdf in the code. In order to resolve the problem and find a solution, it is necessary send us some code snippets with which we could reproduce the error. Thanks for your understanding and help.

Best regards.

Below is the code that creates the PDF. Using dll, the program fails on pdf1.save Using dlls and, the pdf1.save does not fail but does not apply the correct formatting as show in the preview that was generated before the save. That same code that generates the preview are the lines:


Me.doPrintXml(Me.ppea, pdf1)

Simple example, a string is drawn on the preview indicating the report title should be centered. It is centered on the preview. However, when written to PDF it is left justified. Here is the snippet for that:

Dim ti As New Aspose.Pdf.TextInfo()

ti.FontName = font.Name

ti.FontSize = font.Size

Select Case stringFormat.Alignment

Case System.Drawing.StringAlignment.Near : ti.Alignment = Aspose.Pdf.AlignmentType.Left

Case System.Drawing.StringAlignment.Center : ti.Alignment = Aspose.Pdf.AlignmentType.Center

Case System.Drawing.StringAlignment.Far : ti.Alignment = Aspose.Pdf.AlignmentType.Right

End Select

I can't send you the whole project. It is proprietary and too object-oriented, i.e., linked to many other projects in my client's solution. Instead of or in addition to trying to reproduce the errors from my point of context, can you send me some simple code that generates to screen and then to pdf without formatting issues? Can you point me to a specific section in your developer manual that may tell me some things I should look at?


Here are some most used ways to generated a pdf:
1. Use our API to create a pdf.
2. Bind a xml file which is created under our xml schema to a pdf.
3. Convernt a doc into pdf file.(Cooperate with Aspose.Words).
4. Bind a custom defined xml file and xslt to pdf object.

The attached xml is not created under our xml schema. We can’t figure out how you construct the pdf object as above code is too simple. We can send you some sample codes to describe how to create a pdf file through methods mentioned above. But it is of no help to determine what the issue is in this thread.

Best regards.

Please tell me then, what specifically changed in the aspose.pdf.DLL between versions and


I have asked our customer supporter to provide you some links on how to use our product to create pdf.
I have checked those attached files. There are at least two different format issues. In each version, we revise some bugs and implement some new features. Between Aspose.Pdf and Aspose.Pdf, there must be lot of changes. I guess these format issues must be exsist in Aspose.Pdf too. I will consult with our developer on how to help you better.


Please understand:

1) our issue with is that when we actually create the PDF, we get the message, "Value cannot be null. Parameter name: format." We cannot verify formatting errors in the actual PDF because we cannot generate it due to the error so I can't guess these issues exist in that version.

2) our issue with is that when we actually create the PDF, we get formatting errors in the PDF, i.e., text that is left justified when it should be centered.

In both cases, I know for certain that my client's code has NOT changed and renders to the screen using the very same code to prepare for PDF. Rendering to the screen is perfect using both DLLs.

So we need two explanations:

1) under, what is causing aspose.pdf.dll to return the error "Value cannot be null. Parameter name: format." Please have your people look into YOUR code and tell me what they find.

2) under, what is causing aspose.pdf.dll to left justify text when the actual vb.net code says to center it.


We will test our dll fully(600 xmls and 500 docs) before we publish a new release. This is important to avoid regression bugs. So, I guess those format issues should be still exsist in Aspose.Pdf
Here are my explantions:

  1. under, what
    is causing aspose.pdf.dll to return the error “Value cannot be null.
    Parameter name: format.” Please have your people look into YOUR code
    and tell me what they find.

I looked through our project and found no hint on how it is fixed at present. Since it is fixed in Aspose.Pdf and, this should be ok. I don’t think Aspose.Pdf would resolve those format issues once the exception error is fixed.

  1. under, what is causing aspose.pdf.dll to left justify text when the actual vb.net code says to center it.

There would be lots of reasons to cuase this problem. That is why I am asking for your detail codes(at least detail enough to reproduce the error) to debug it and find out where the issue is.

Best regards.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Concerning your query on how to create Pdf using Aspose.pdf component, following are some mostly used ways to generate a pdf.

1. Use our API to create a pdf, please visit Create a Hello World PDF document through API
2. Bind a xml file which is created under our xml schema to a pdf, please visit Create a Hello World PDF document through XML
3. Convert a doc into pdf file.(Cooperate with Aspose.Words), please visit Converting Word documents to PDF
4. Bind a custom defined xml file and xslt to pdf object, please visit Create a Hello World PDF document through XML and XSLT

As replied by Hans, we are unable to generate the Pdf using your provided XML. In order to create Pdf using XML it should be in Aspose.Pdf compatible format. For information please visit Introduction to XML
You can also use your XML to create Pdf, but in order to make your XML compatible to Aspose.Pdf format you need to use XSL, which is used to d
efine how XML documents should be displayed. For more detailed information regarding XSL please visit Introduction to XSL


I have checked the code of 3.2.1 but I was not able to find that error message. I think that exception is defined in .Net but not in our code so it is not possible for us to find it. As for the justification problem, we also can't find it just through checking the code.

I know your code is not changed and I agree the probelm is cuased by our product. We'd like to help you ASAP. But without the test case to reproduce the error it is almost not possible to resolve your problem. I hope you can understand. I appologize again for the inconvenience you have experienced.

I have received permission to send you an extract of my client's project, the project that contains the report writer in question. I am sending via email to the address previously listed due to privacy and confidentiality reasons.

Please write me directly at SignificantSoftware@gmail.com if you have questions about setting up the project in your environment.

Thank you for helping us.

george h.

Dear Guys,

Just to share, if you need to discuss or share any confidential information, you can mark this thread PRIVATE and then it won't be visible to other users except Aspose Staff Members.

Moreover, if you need to send some confidential documents, you can follow the approach shared in http://www.aspose.com/corporate/purchase/faqs/send-license-to-aspose-staff.aspx

Have a good time.