Hello, please help me figure out how to modify image color (brightness, gamma, contrast, RGB....whatever can be modified) inside a PDF.
I have the following code which works without an error, the part I need help with is marked {.....what to do here ....} thank you very much in advance. Hakan Imports iTextSharp Imports iTextSharp.text Imports iTextSharp.text.pdf Imports System.IO Dim reader As PdfReader = New pdf.PdfReader("c:\testfile.pdf") Dim pdfObj As PdfObject Dim pdfdict As PdfStream Dim pdfsubtype As PdfObject Dim pdfcolorspace As PdfObject For i As Integer = 0 To reader.XrefSize - 1 pdfObj = reader.GetPdfObject(i) If pdfObj IsNot Nothing Then If pdfObj.IsStream Then pdfdict = DirectCast(pdfObj, PdfStream) pdfsubtype = pdfdict.Get(PdfName.SUBTYPE) If pdfsubtype IsNot Nothing Then If Not pdfsubtype.ToString.Equals(PdfName.IMAGE.ToString) Then Continue For pdfcolorspace = pdfdict.Get(PdfName.COLORSPACE) If pdfcolorspace.ToString.Equals(PdfName.DEVICERGB.ToString) Then 'here is where it gets exciting.... 'comment.. this code catches the single image that is in the original PDF and returns DEVICERGB...debug confirms this code block executes as expected '{...help needed here onwards ....what kind of action do I have to take to set a new image property like different brightness, gamma, RGB values etc....eventually a user will look at the PDF and change values a couple of times making the PDF darker or lighter etc....} .... ... .. 'Im guessing I need something like... pdfdict.Put(PdfName.COLORSPACE, {....what do I need to prepare for this ....}) 'finally write back to a new pdf Dim stp As PdfStamper = New PdfStamper(reader, New IO.FileStream( "C:\output.pdf", IO.FileMode.Create)) stp.Close() reader.Close() ' ....at the moment the outcoming PDF is identical to the original..as expect, no errors or warnings End End If End If End If End If Next reader.Close()
------------------------------------------------------------------------------
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/