Second section of optional content group ends. Continue the optional content group here. First section of optional content group ends. PdfOptionalContentGroup multipartOcg = new PdfOptionalContentGroup() PdfPen redPen = new PdfPen(PdfRgbColor.DarkRed, 5) PdfBrush yellowBrush = new PdfBrush(PdfRgbColor.Yellow) PdfBrush greenBrush = new PdfBrush(PdfRgbColor.DarkGreen) The code below shows how to create an optional content group that consists of 2 content sections with some other content between them. By using the same optional content group with multiple BeginOptionalContentGroup method calls all the content sections are linked to the same optional content group. PDF specification allows to create optional content groups that span over multiple content sections (non-contiguous optional content groups) and XFINIUM.PDF supports this feature. (bluePen, greenBrush, 20, 100, 570, 400)ĭocument.OptionalContentProperties = New PdfOptionalContentProperties()ĭim ocgNode As New PdfOptionalContentDisplayTreeNode(ocg)ĭ.Add(ocgNode)ĭocument.Save("SimpleOptionalContent.pdf") Multipart PDF optional content groups PdfOptionalContentDisplayTreeNode ocgNode = new PdfOptionalContentDisplayTreeNode(ocg) ĭ.Add(ocgNode) ĭocument.Save("SimpleOptionalContent.pdf") Dim greenBrush As New PdfBrush(PdfRgbColor.DarkGreen)ĭim bluePen As New PdfPen(PdfRgbColor.DarkBlue, 5)ĭim page As PdfPage = ()ĭim ocg As New PdfOptionalContentGroup() (bluePen, greenBrush, 20, 100, 570, 400) ĭocument.OptionalContentProperties = new PdfOptionalContentProperties() PdfOptionalContentGroup ocg = new PdfOptionalContentGroup() PdfFixedDocument document = new PdfFixedDocument() PdfPen bluePen = new PdfPen(PdfRgbColor.DarkBlue, 5) Also optional content group objects can be locked or not.Ī simple optional content group is created like this: PdfBrush greenBrush = new PdfBrush(PdfRgbColor.DarkGreen) The optional content group object specifies the name, visibility, print and export states. The BeginOptionalContentGroup method receives as parameter a PdfOptionalContentGroup object, thus associating the section of content in the page graphics with the optional content group. This capability is useful in items such as CAD drawings, layered artwork, maps, and multi-language documents.”.Īn optional content section is started in the page graphics using the BeginOptionalContentGroup method and it ends with a call to EndOptionalContentGroup method. PDF specification describes optional content as “sections of content in a PDF document that can be selectively viewed or hidden by document authors or consumers. With this new version we include full support for manipulating optional content in PDF files, whether it is optional content creation or extraction. Today we released XFINUM.PDF 3.4 which brings support for pdf optional content extraction.
0 Comments
Leave a Reply. |