PdfArray bBox = existingLayer.GetAsArray(PdfName.BBOX)
PdfStream existingLayer = frmXobjectResources.GetAsStream(layerName) With this helper method: void clearLayer(PdfWriter writer, PdfDictionary frmXobjectResources, PdfName layerName) PdfStamper.MarkUsed(frmXobjectResources)
PdfDictionary frmXobjectResources = frmResources?.GetAsDict(PdfName.XOBJECT) Ĭonsole.WriteLine("Found XObject resources of FRM XObject") ĬlearLayer(pdfStamper.Writer, frmXobjectResources, PdfName.N1) ĬlearLayer(pdfStamper.Writer, frmXobjectResources, PdfName.N3) ĬlearLayer(pdfStamper.Writer, frmXobjectResources, PdfName.N4) PdfDictionary frmResources = frm?.GetAsDict(PdfName.RESOURCES) PdfDictionary frm = normal?.GetAsDict(PdfName.RESOURCES)?.GetAsDict(PdfName.XOBJECT)?.GetAsStream(PdfName.FRM) PdfDictionary normal = PdfReader.GetPdfObject(fields.GetNormalAppearance(name)) as PdfDictionary Using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(dest, FileMode.Create, FileAccess.Write), '\0', true))ĪcroFields fields = pdfStamper.AcroFields You can do that like this: using (PdfReader pdfReader = new PdfReader(source)) This, by the way, would be the correct thing to do.Īs the extra layers from before Acrobat 6 are all drawn in the signature appearance in the saved file, you have to clear them. I have no experiences with the Aspose PDF-to-image rendering, but it looks like it probably simply renders the signature appearance as it is in the PDF.