'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsSystem.DrawingImportsGrapeCity.Documents.PdfImportsGrapeCity.Documents.Svg PublicClassSaveAsSvgPublicFunctionCreatePDF(ByVal stream AsStream) AsIntegerDim doc = NewGcPdfDocument()Dim page = doc.NewPage() Dim rc = Util.AddNote("We load an existing PDF into a temporary GcPdfDocument, " &"save its first page as an SVG image to a stream, and then " &"draw that image on the page of the resulting PDF.", page) ' Load a one page document into a temp PDF:Using fs = File.OpenRead(Path.Combine("Resources", "PDFs", "svg-spec-art.pdf"))Dim docSrc = NewGcPdfDocument() docSrc.Load(fs) ' Save the first page of the loaded PDF as SVG:Using svgStream = NewMemoryStream() docSrc.Pages(0).SaveAsSvg(svgStream, NewSaveAsImageOptions() With {.BackColor = Color.Transparent}) svgStream.Position = 0' Create a GcSvgDocument from the saved SVG so that we can draw it in the resulting PDF:Using svgDoc = GcSvgDocument.FromStream(svgStream)' For illustration purposes we render the SVG with transparent background' on a rectangle with a custom fill and border: rc = NewRectangleF(0, rc.Bottom, page.Size.Width, page.Size.Height - rc.Bottom) rc.Inflate(-4.0F, -4.0F) page.Graphics.DrawRectangle(rc, Color.DarkGoldenrod) page.Graphics.FillRectangle(rc, Color.PaleGoldenrod) page.Graphics.DrawSvg(svgDoc, rc)EndUsingEndUsingEndUsing '' Done: doc.Save(stream)Return doc.Pages.CountEndFunctionEndClass