How do I get the ICC name(如何获取ICC的名字)

Product: PDFNet(c#)

Product Version: 9.1.7.8488

Please give a brief summary of your issue:
我想要获取ICC文件的名称,我查看了颜色字典,发现里面没有对应的名称。
(Think of this as an email subject)

Please describe your issue and provide steps to


reproduce it:
(The more descriptive your answer, the faster we are able to help you)

Please provide a link to a minimal sample where the issue is reproducible:
ICC.pdf (5.2 KB)

The ICC profile name you see in your screenshot is embedded in the binary ICC profile data, which you can get from our SDK, but you would need your own ICC profile parsing code to find that string in the binary data.

If you let me know what language you are coding in I can then provide you code to get the profile data.

Do you have such a means to parse ICC profile for this metadata?

C#( .NET Framework),
I need you to provide an example
我需要你提供一个例子。
谢谢!

The following code shows how to extract the ICC profile binary from a ColorSpace object.

static void ProcessColorSpace(ColorSpace cs, bool isFill)
{
	if (cs.GetType() == ColorSpace.Type.e_icc)
	{
		MemoryStream memoryStream = new MemoryStream();

		Obj csObj = cs.GetSDFObj();
		Obj iccObj = csObj.GetAt(1);
		Filter filter = iccObj.GetDecodedStream();
		FilterReader reader = new FilterReader(filter);
		pdftron.Filters.FilterReader fReader = new pdftron.Filters.FilterReader(filter);
		byte[] buffer = new byte[64 * 1024]; //64 KB chunks
		int bytesRead = 0;
		bytesRead = fReader.Read(buffer);
		while (bytesRead > 0)
		{
			memoryStream.Write(buffer, 0, bytesRead);
			bytesRead = fReader.Read(buffer);
		}
		memoryStream.Seek(0, SeekOrigin.Begin);
		File.WriteAllBytes("temp", memoryStream.GetBuffer());
	}
}

The following code shows how to iterate through a page content stream and find the used color spaces (note could see the same ICC color over and over again, so might want to store the csObj object number by calling csObj.GetObjNum().

static void ProcessElements(ElementReader reader)
{
	Element element;
	while ((element = reader.Next()) != null) 	// Read page contents
	{
		if(element.GetType() == Element.Type.e_form)
        {
			reader.FormBegin();
			ProcessElements(reader);
			reader.End();
		}
		else
        {
			GSChangesIterator gs_itr = reader.GetChangesIterator();
			for (; gs_itr.HasNext(); gs_itr.Next())
            {
				GState.GStateAttribute changedAttr = gs_itr.Current();
				if(changedAttr == GState.GStateAttribute.e_fill_cs)
                {
					ColorSpace cs = element.GetGState().GetFillColorSpace();
					ProcessColorSpace(cs, true);

				}
				else if (changedAttr == GState.GStateAttribute.e_stroke_cs)
                {
					ColorSpace cs = element.GetGState().GetStrokeColorSpace();
					ProcessColorSpace(cs, false);
				}
			}
		}
	}
}

PageIterator itr;
for (itr = doc.GetPageIterator(); itr.HasNext(); itr.Next())
{
	page_reader.Begin(itr.Current());
	ProcessElements(page_reader);
	page_reader.End();
}

There are other ways to search all the objects in the PDF, but that might include ones not actually used, while the above will show actually what is used on each page.