Questions tagged [ocg]

Optional content (PDF 1.5) refers to sub-clauses of content in a PDF document that can be selectively viewed or hidden by document authors or consumers. This capability is useful in items such as CAD drawings, layered artwork, maps, and multi-language documents. Optional content groups often also are called "layers".

17 questions
5
votes
1 answer

IText edit or remove the layer on PDF

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…
JAVAC
  • 1,062
  • 2
  • 15
  • 32
3
votes
1 answer

how to make pdf layers(optional content group) in tree structure

I have not long ago post a quesion about how to use the optional content group in pdf. But now I have a new question. How to make these optional content group in a tree structure. For example. I have 4 different layers. these layers are all OCG…
user1279988
  • 749
  • 1
  • 9
  • 27
2
votes
2 answers

Using PDFBox to remove Optional Content Groups that are not enabled

I'm using apache PDFBox from java, and I have a source PDF with multiple optional content groups. What I am wanting to do is export a version of the PDF that includes only the standard content and the optional content groups that were enabled. …
markt1964
  • 2,258
  • 1
  • 17
  • 42
2
votes
3 answers

Remove or hide PDF layer using ABCPdf?

Is is possible to remove or hide a layer from a PDF using ABCPdf or another framework?
Junior Developer
  • 151
  • 1
  • 1
  • 4
2
votes
2 answers

after merge PDFs lose layer settings

Is here some tools to merge PDFs with layers? Tried to merge PDFs with layers with pdftk, fpdf/fpdi, Gswin32c. In any cases output PDF was as simple PDF without layers. Thanks. Edit. I am looking for tool suitable for use it in PHP project (PHP…
Vladimirs
  • 7,364
  • 4
  • 37
  • 68
1
vote
2 answers

Extract Geometry Elements from PDF by OCG (by Layer)

So I've spent the good majority of a month on this issue. I'm looking for a way to extract geometry elements (polylines, text, arcs, etc.) from a vectorized PDF organised by the file's OCGs (Optional Content Groups), which are basically PDF layers.…
1
vote
1 answer

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

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…
mbanchero
  • 75
  • 8
1
vote
1 answer

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

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 =…
V K
  • 1,495
  • 3
  • 16
  • 40
1
vote
0 answers

PDFRender render not visible Optional Content Group

For my work, I need to translate pdf document into Image with PDFBox. PDDocument document = PDDocument.load(new File(fileUrl)); PDFRenderer pdfRenderer=new PDFRenderer(document); BufferedImage bim=pdfRenderer.renderImageWithDPI(page,…
Guyard
  • 29
  • 5
1
vote
2 answers

How to programmatically remove PDF layers?

I know about Doc.SetOCGOrder() and the likes, but apparently the Acrobat API does not provide means to remove layers (aka optional content groups, ocgs), only to hide them from users while leaving them accessible via scripting. I'm not forced to use…
Tobias Kienzler
  • 21,611
  • 21
  • 111
  • 204
1
vote
1 answer

How are layers stored in PDF

In PDF everything is in the format of /name. I couldn't find a /Layers throughout the document. If I want to look for all the layers what key should I look for?
user5495269
  • 147
  • 5
0
votes
0 answers

Merging PDFs with Python while retaining OCGs (Layer Control)

Is it possible to merge PDFs using Python while retaining OCGs (Layer Control). I've tested PyPDF2 without much success and through investigation, it seems as this is not possible. Has anyone achieved this using 'PyPDF2' or other packages?
0
votes
0 answers

Adding an image to a PDFBox OCG layer?

I'm having trouble adding an image to an OCG layer using PDFBox 2.0.20. I based my code on mkl's answer in PDFbox - how can i add content to a layer? at one point I could have sworn it was working, but now if I view generated PDFs and toggle the…
jobu1342
  • 73
  • 7
0
votes
0 answers

How to find the OC COSName in a PDPage belong to which Optional Content Group?

I have implemented functionality to allow user to draw a cloud shape on a pdf, using the PDPageContentStream class's curve methods.And, I am drawing each of this cloud on a separate layer(OCG). Now I want to implement functionality to delete this…
V K
  • 1,495
  • 3
  • 16
  • 40
0
votes
0 answers

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

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 =…
V K
  • 1,495
  • 3
  • 16
  • 40
1
2