Height = pd.Get(PdfName.HEIGHT).ToString()īpp = pd.Get(PdfName.BITSPERCOMPONENT).ToString()īytes = PdfReader.GetStreamBytesRaw(DirectCast(obj, PRStream)) If pd.Contains(PdfName.SUBTYPE) AndAlso pd.Get(PdfName.SUBTYPE).ToString() = () Thenįilter = pd.Get(PdfName.FILTER).ToString() ''//See if it has a subtype property that is set to /IMAGE If (obj IsNot Nothing) AndAlso obj.IsStream() Then ''//Make sure we have something and that it is a stream ''//Loop through all of the references in the file Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loadĭim InputFile = Path.Combine(Environment.GetFolderPath(), "SampleImage.pdf")ĭim pixelFormat As ĭim bmd As Below is a full working WinForms app targetting iTextSharp 5.1.1.0 Option Explicit On Since you've got raw bytes so you could also easily pump those into a object and write them back into a new PdfWriter object which is sounds like you are familiar with. At the end of the code I'm saving the images to the desktop. Much of the code below comes from this post. If you don't want to go down this route, let me get you going on what you need to do to extract images. I know this sounds like a pain but you should only have to do this once per document I assume. Finally use iTextSharp to combine all of the images in each folder back into a PDF. Then write your overlay text onto the images. Then use some program (Ghostscript, Photoshop, maybe GIMP) that you can batch and convert each page to an image. Using iTextSharp (or another library) extract each page of a given document to a folder. If I were you I would go down a different path.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |