ImageGear provides the ability to convert and save any page from a PDF document to a Scalable Vector Graphics (SVG) file. This can be done by using one of the following API calls:
Since SVG format is not a multi-page format, the SaveDocument API called with default options will only convert and save the first page of the provided PDF document.
This topic provides information about the following:
Text Conversion
ImageGear PDF to SVG converter is optimized to provide the best text fidelity results. For that purpose, all PDF text elements are converted to SVG outlining paths, which are not searchable for text.
Color Profiles
ImageGear PDF to SVG color converter applies the default color space defined in the PDF document. If no default color space is defined, all PDF colors defined in CMYK color space are converted to RGB using the Windows ICM and the color profiles enabled in the ImageGear color profile manager. The color profile transformation uses the ICC profile specified in ImGearColorProfileManager.CmykProfile. If this is not set, then the default color profile distributed with ImageGear (ig_cmyk_profile.icm) is used.
Password-Protected PDF Documents
ImageGear PDF to SVG converter requires “Content Copying” permission to the source PDF document to be granted, which means that if a PDF document is secured, it should be opened with the password that allows access to its internals.
If this permission is not granted, the ImageGear PDF to SVG converter will turn on the rasterizaton mode for this document, which will rasterize any PDF page from this document prior to converting to SVG. The resolution of the raster image embedded to SVG will be set using the PDF control parameters.
Anti-Aliasing
Most SVG viewers, including Internet Explorer, Chrome, and Firefox browsers, enable edge anti-aliasing, but do not allow turning it off. Although in most cases anti-aliasing makes vector graphics look much better and smoother, there are cases when anti-aliasing leads to unintended SVG rendering effects like the following:
- Although using a set of thin bars of different shades of a color to emulate a gradient background may look good in PDF, it may not produce the desired effect in SVG. Thin white lines may appear between bars, depending on the viewer’s zoom. It is recommended that the PDF producers use the native PDF gradients instead of emulating them.
- Small sized text in the converted SVG may look blurry compared to the original PDF, because of the differences between the algorithms specific to PDF text anti-aliasing and anti-aliasing of the graphic paths representing text in SVG.
No Thin Line Enhancement in SVG
While the ImageGear PDF renderer provides enhanced rendering of thin lines when a PDF page is zoomed out, ensuring that 1 pixel lines are still visible even when the page is zoomed far out, SVG viewers normally don’t support that. So, thin lines converted from PDF will have the correct widths in SVG, but will be scaled proportionally and may disappear if a page is zoomed out too much.
ConvertPDFtoSVG Sample
The following ConvertPdftoSVG sample method illustrates how you can convert a PDF file to SVG file.
Also you can specify a background color for the converted SVG file using PDF control parameters.