编程知识 cdmana.com

Sample demo! Using Aspose to convert PDF to SVG format in Java

PDF Digital document formats have dominated the world for years , For document printing , share , Exchange and archive . however ,PDF In some cases it may not be appropriate , For example, in Web Show it on the page , Because it needs browser support or other plug-ins . under these circumstances ,SVG Can replace . because SVG File screen resolution independence , So you can easily display them on a web page without affecting the user experience .

therefore , In this case PDF To SVG Transformation . In this paper , You will learn how to use Java take PDF The file is converted to SVG Format .

  • PDF To SVG Transformation
  • Using other options will PDF Convert to SVG

at present ,Java edition Aspose.PDF Upgrade to v20.10 edition , Add signature >> You can Click here Experience Aspose.Words for Java v20.10.

PDF To SVG Java Transformation

Here are the USES Aspose.PDF for Java take PDF The file is converted to SVG Format steps .

  • Use Document Class loading PDF file .
  • Create a SvgSaveOptions Class object .
  • Use Document.save(String,SvgSaveOptions) Methods will PDF Save as SVG .

The following code example shows how to use Java take PDF Convert to SVG.

// Load PDF file
Document doc = new Document("Input.pdf");

// Instantiate an object of SvgSaveOptions
SvgSaveOptions saveOptions = new SvgSaveOptions(); 

// Save the PDF as SVG file
doc.save("output.svg", saveOptions);

Using other options will PDF Convert to SVG

Aspose.PDF There are also some other options to customize PDF To SVG Transformation . The SvgSaveOptions Class can do this with the following options .

  • CompressOutputToZipArchive
  • CustomStrategyOfEmbeddedImagesSaving
  • ScaleToPixels
  • TreatTargetFileNameAsDirectory

Here are some other options that will PDF Convert to SVG Steps for .

  • Use Document Class loading PDF file .
  • Create a SvgSaveOptions Class object .
  • Set the required SVG Options , for example CompressOutputToZipArchive.
  • Use Document.save(String,SvgSaveOptions) Methods will PDF Save as SVG .

The following code example shows how to perform a custom PDF To SVG Transformation .

// Load PDF file
Document doc = new Document("Input.pdf");

// Instantiate an object of SvgSaveOptions
SvgSaveOptions saveOptions = new SvgSaveOptions();

// Do not compress SVG image to Zip archive
saveOptions.CompressOutputToZipArchive = false; 

// Save the PDF as SVG file
doc.save("output.svg", saveOptions);

If you have any questions or needs , Please feel free to join Aspose Technology exchange group (642018183), We are glad to provide you with inquiry and consultation .

版权声明
本文为[mnrssj]所创,转载请带上原文链接,感谢

Scroll to Top