c# - Identify rgb and cmyk color from pdf -


i have pdf consists of different color text , background color. how identify colors used in pdf cmyk or rgb format?

stringbuilder sb_sourcepdf = new stringbuilder(); pdfreader reader_firstpdf = new pdfreader(pdf_of_firstfile);  document document = new document();  pdfparser parser = new pdfparser(new fileinputstream(pdf_of_firstfile)); parser.parse(); pddocument docum = parser.getpddocument();  pdfstreamengine engine = new pdfstreamengine();  pdpage page = (pdpage)docum.getdocumentcatalog().getallpages().get(0);  engine.processstream(page, page.findresources(), page.getcontents().getstream()); pdgraphicsstate graphicstate = engine.getgraphicsstate(); string colorname = graphicstate.getstrokingcolor().getcolorspace().getname(); graphicstate.gettextstate().getfont(); int r = graphicstate.getnonstrokingcolor().getjavacolor().getred(); int g = graphicstate.getnonstrokingcolor().getjavacolor().getgreen(); int b = graphicstate.getnonstrokingcolor().getjavacolor().getblue(); int rgb = graphicstate.getnonstrokingcolor().getjavacolor().getrgb(); float[] cosp = graphicstate.getnonstrokingcolor().getcolorspacevalue(); pdcolorspace pd = graphicstate.getnonstrokingcolor().getcolorspace();  string re = graphicstate.getstrokingcolor().tostring(); int rgbcolor = graphicstate.getstrokingcolor().getjavacolor().getrgb();  float[] components = { java.awt.color.black.getred(), java.awt.color.black.getgreen(), java.awt.color.black.getblue() };  float[] colorspacevalues = graphicstate.getstrokingcolor().getcolorspacevalue();   foreach (float c in colorspacevalues) {     debug.writeline(c * 255.00); } 

i used pdfbox getting value 0.0

 pdfreader reader_firstpdf = new pdfreader(pdf_of_firstfile);               (int = 1; <= reader_firstpdf.numberofpages; i++)             {  textwithfont_sourcepdf sourcepdf = new textwithfont_sourcepdf(); }                 text_first_file = itextsharp.text.pdf.parser.pdftextextractor.gettextfrompage(reader_firstpdf, i, sourcepdf);               public void rendertext(itextsharp.text.pdf.parser.textrenderinfo renderinfo)             {  int r = renderinfo.getcolornonstroke().r;                   int g = renderinfo.getcolornonstroke().g;                    int b = renderinfo.getcolornonstroke().b;  } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -