ocg

How to get resource names for optional content group in a pdf?

可紊 提交于 2019-12-12 02:26:12
问题 I am trying to implement functionality to allow user to add markups to existing layers in a pdf. Here is the code that I am using to draw lines on to a layer in a pdf: PDResources resources = page.findResources(); PDPropertyList props = resources.getProperties(); COSName resourceName = getLayerResourceName("Superimposed3", resources, props); PDPageContentStream cs1 = new PDPageContentStream(document, page, true, false); cs1.beginMarkedContentSequence(COSName.OC, resourceName); cs1

iText 7 - Merge PDF layers (OCG) with the base PDF

淺唱寂寞╮ 提交于 2019-12-06 14:51:49
问题 Is it possible to merge layers of a PDF (OCG) with the base PDF to result in a PDF without layers? I saw that it's possible to accomplish this using an application as Adobe Acrobat DC using a "Flatten Layers" option but I need this programmed in my Java application using iText7. EDIT: @joelgeraci has a useful and good answer that solves the previous question, but I have initially some hidden layers that will be displayed anyway when removing the OCProperties from the catalog. 回答1: You don't

How to delete an optional content group alongwith its content from pdf using pdfbox?

Deadly 提交于 2019-12-02 11:53:23
问题 I have implemented functionality to delete the layer from pdf, but the problem is that, the content that I had drawn on the layer, does not get delete.Here is the code that I am using to delete the layer: PDDocumentCatalog documentCatalog = doc.getDocumentCatalog(); PDOptionalContentProperties ocgProps = documentCatalog.getOCProperties(); PDOptionalContentGroup ocg = ocgProps.getGroup(markupLayerName); COSDictionary ocgsDict = (COSDictionary)ocgProps.getCOSObject(); COSArray ocgs = (COSArray

How to delete an optional content group alongwith its content from pdf using pdfbox?

为君一笑 提交于 2019-12-02 07:23:49
I have implemented functionality to delete the layer from pdf, but the problem is that, the content that I had drawn on the layer, does not get delete.Here is the code that I am using to delete the layer: PDDocumentCatalog documentCatalog = doc.getDocumentCatalog(); PDOptionalContentProperties ocgProps = documentCatalog.getOCProperties(); PDOptionalContentGroup ocg = ocgProps.getGroup(markupLayerName); COSDictionary ocgsDict = (COSDictionary)ocgProps.getCOSObject(); COSArray ocgs = (COSArray)ocgsDict.getItem(COSName.OCGS); int indexToBeDeleted = -1; for (int index = 0; index < ocgs.size();

IText edit or remove the layer on PDF

给你一囗甜甜゛ 提交于 2019-11-27 09:33:05
H All, I am Using IText for adding text layers on PDF. Now i want to edit the existing layers on the PDF, layers are also created by IText only. Seems IText dont have such methods to suppport. I thought of other way around is remove existing Layer and place new layer on its place. Seems remove also not supported by IText. Any way todo these? Thanks in adavance. mkl As it turned out in comments, the layers in question are what iText indeed calls layers but what actually in PDF lingo is called optional content groups. There indeed is a utility class for removing such layers in the iText Xtra

IText edit or remove the layer on PDF

孤街醉人 提交于 2019-11-26 11:35:57
问题 H All, I am Using IText for adding text layers on PDF. Now i want to edit the existing layers on the PDF, layers are also created by IText only. Seems IText dont have such methods to suppport. I thought of other way around is remove existing Layer and place new layer on its place. Seems remove also not supported by IText. Any way todo these? Thanks in adavance. 回答1: As it turned out in comments, the layers in question are what iText indeed calls layers but what actually in PDF lingo is called