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

Free Support Forum - aspose.com

Detect if PDF is B&W, Grayscale or RBG using Aspose.PDF for .NET


We managed to replicate the said error in our environment. It has been logged under the ticket ID PDFNET-44428 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

I have a similar issue with version 18.4.1 (latest) …

attempting to set the background color - of the page or document throws the same error.

(crazy nested colour syntax is lifted from one of your own samples in desperation).

image.png (17.9 KB)


We could not replicate this error in our environment. Kindly send us your source PDF and code. We will investigate your scenario in our environment, and share our findings with you.

The issues you have found earlier (filed as PDFNET-44428) have been fixed in Aspose.PDF for .NET 18.5. This message was posted using BugNotificationTool by asad.ali

We encounter the same error while converting PDF’s to PDF-A documents. Not always, but certain PDF documents. Source documents have color images.

Can you share some more details on the origin of the error?
We haven’t seen this in our development or testing environments and want to rule out the possibility the calling party produces different PDF’s on production. Can we identify the PDF’s which will cause a problem?


The linked ticket ID PDFNET-44428 is regarding the error in retrieving the color type of the PDF page, which has already been fixed. Please download and try the latest version 18.6.1 of Aspose.PDF for .NET API, and then let us know how that goes into your environment.


I am using Aspose.PDF for ,NET version 20.1
Trying to merge two accessible(508) PDFs(Aspose.Pdf.PdfFormat v_1_7 from the client),I get the error:

"Object reference not set to an instance of an object"

		StackTrace	"   at #=zu5qia_28cCgQA48$TjyrY8KZIE$f.#=zohST7j8Kt92y(Page #=zKQHMiyU=, MCRElement #=z8dIGGnlUVfjn)\r\n   at Aspose.Pdf.LogicalStructure.MCRElement.#=zpzbmSgY=()\r\n   at Aspose.Pdf.LogicalStructure.Element.#=zpzbmSgY=()\r\n   at Aspose.Pdf.LogicalStructure.Element.#=zpzbmSgY=()\r\n   at Aspose.Pdf.LogicalStructure.Element.#=zpzbmSgY=()\r\n   at Aspose.Pdf.LogicalStructure.Element.#=zpzbmSgY=()\r\n   at Aspose.Pdf.LogicalStructure.StructTreeRootElement.#=zZy1iQtpJ6D0q()\r\n   at #=zAMHZBH$wbA$bReK5CGkCW0tFkyW4.#=zpzbmSgY=()\r\n   at Aspose.Pdf.Document.#=zC$6G4a2eX0Uv(Stream #=zueqnKEo=, SaveOptions #=z2XCn_$4TQiAL)\r\n   at Aspose.Pdf.Document.#=zHPNFWS3F3WB1(String #=znLfuW3TOwpnn)\r\n   at Aspose.Pdf.Document.Save(String outputFileName)\r\n   at WebApplication3.Preview_FinRep.Page_Load(Object sender, EventArgs e) in c:\\Users\\colariu\\Documents\\Visual Studio 2012\\Projects\\WebApplication3\\WebApplication3\\Preview_FinRep.aspx.cs:line 215"	string

Is it referring to the MCR? What can be the issue?

When I try to set the background color to one of the PDFS I get: Second argument of BDC operator can be inline dictionary or name object. Inline dictionary is implemented only

The PDFs and the code:


We tested the scenario in our environment using Aspose.PDF for .NET 20.9 and following code snippet. We were unable to notice any exception.

Merge PDF files

Facades.PdfFileEditor pfe = new Facades.PdfFileEditor();
pfe.CopyLogicalStructure = true;
pfe.CopyOutlines = true;
pfe.Concatenate(dataDir + "4186_EN_MRFP_A.pdf", dataDir + "4186_EN_Q1.pdf", dataDir + "result.pdf");

result.pdf (665.1 KB)

We also tried to change background of pages of both PDFs and no exception was thrown:

// Tried with both PDFs
Document pdf = new Document(dataDir + "4186_EN_Q1.pdf");
foreach (Aspose.Pdf.Page page in pdf.Pages)
 page.Background = Aspose.Pdf.Color.White;

Would you please try to use latest version of the API and in case you still face any issue, please let us know.

Thank you very much for your reply and advice.
I am using Aspose.PDF 20.9 for .NET now. After merging some of the PDFs (that have annotations) I get “Tagged Annotations failed” error message in the Accessibility Checker.
Copying the logical structure into the merged PDF does not copy the Annotations too?
Please advice.
The code and the original PDF files are at:


We have logged an issue in our environment as PDFNET-48888 for further investigation against this scenario. We will further look into its details and keep you informed about its rectification status. Please be patient and spare us some time.

We are sorry for the inconvenience.

PS: Would you please share which Validity Checker are you using to validate the output. Please share a screenshot of error in checker as well.

Thank you for your help.
I am using the Accessibility Checker from Adobe Acrobat Pro DC.

I have placed a word document(ScreenshotsAnnotations.docx) with all of the screenshots at:



Thanks for providing requested information.

We have updated the logged ticket accordingly and will let you know in case of additional updates regarding its resolution.

Hello again,

We have received new PDF documents.
When merging these documents , we get errors on
"Notes" (ID entry in “Note” structure element is not unique in the merged PDF) and
"Annotations" (“Link” annotation is not nested inside a “Link” structure element in the merged PDF).
I have used PAC 3 accessibility checker( the client is using the same).
Also the “Title” of the merged PDF does not show in PAC 3.

I have placed all files and a PNG on:

The merged PDF is 786f5647-2245-4f58-85d3-79a560475639.pdf.

If we want to expedite the fix what should we do?
How much is the paid support for these 2 items? (Notes and Annotations in the merged PDF? and maybe the title)

Thank you,
Carmen Olariu


We tried to access the files over the given link but they did not exist. Would you kindly provide a link with which we can download the files and proceed further?

Please try https://www.dropbox.com/sh/8132h2kok43hn28/AACjgw2A_Nck4QWylxaQ4m4fa?dl=0

I have set the merged document’s title, but PAC 3 says that there is no title.


We have logged an issue as PDFNET-48998 in our issue management system for further investigation on this scenario. We will look into its details and keep you posted with the status of its correction. Please spare us some time.

Once the issue is moved to priority support, its precedence would be increased accordingly and the investigation process will be expedited in terms of getting a resolution of ETA. Furthermore, you can please create a post in our Purchase forum to get the information related to pricing and plans.

Would you please share how you are trying to set the title of the document by sharing the sample code snippet. We will investigate from this perspective as well.

Good morning,
Our client have sent us new PDFs, new structure of the Pdf document, and the merge API is not working anymore.
The PDFs were created to address persons with disabilities (508) and the merged PDF should also be accessible.
I am using Aspose.pdf version 20.10
When save merged PDF command is run(line 313 in the code: taggedDocument.Save(Server.MapPath("~/files/Output/") + fileName, SaveFormat.Pdf);), the error is “Object reference not set to an instance of an object”
2 PDFs, and the code are at https://www.dropbox.com/sh/b3djqd5ihrw47nr/AADQZBKliH7wg8wn0SrWjZ87a?dl=0
This is a time sensitive matter. The website should function ASAP. Please advise.


With simple merging while using Aspose.PDF for .NET 21.3, we noticed that the obtained/merged PDF was not completely tagged. The tags were not working in the 2nd page.

Facades.PdfFileEditor pfe = new Facades.PdfFileEditor();
pfe.CopyLogicalStructure = true;
pfe.CopyOutlines = true;
//pfe.KeepActions = true;
pfe.Concatenate(dataDir + "825_EN_Q3.pdf", dataDir + "4003_EN_Q3.pdf", dataDir + "result.pdf");

Furthermore, we used the complete code snippet that you provided and noticed the same Exception that you mentioned. We have logged an issue as PDFNET-49636 in our issue tracking system for the sake of further investigation. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We apologize for the inconvenience.

PS: In the meanwhile, could you please share why do you need to modify tagged content and metadata of the resultant PDF file? It would help us in investigating the ticket accordingly.

Good morning,

I had similar issues before (with the “notes” and “annotations” from the clients PDFs) when the merge API did not work and because my tickets with Aspose free support were not resolved, I fixed the issues by modifying the tagged content of the output file.
With the notes and annotations I think that some field’s names and values taken from the original files were creating duplicates in the merged PDF. I was able to fix that with my code.
This time, with these new files I was not able to figure out the issue from the debug data, so I placed this ticket. I am assuming also duplicates but not sure where.
If you can present this info to the development team it would be greatly appreciated.
The client also wanted his metadata of the resultant PDF file to be from initial files.
Thank you.

If you can get back to me with the duplication location I would also be fine, as I will be able to modify my code and I can go live with the client’s files sooner than waiting for a new Aspose.PDF version.
Thank you.